Skip to content

Commit 1072924

Browse files
docs(build-mcp-server, quickstart): swap Reddit demo for GitHub star (#980)
* docs(build-mcp-server, quickstart): swap Reddit demo for GitHub star Mirror the scaffold change in ArcadeAI/arcade-mcp (replacing the Reddit posts demo with a GitHub star_repo demo) so the build-mcp-server guide and mcp-server-quickstart stop dead-ending at the broken Reddit OAuth authorize flow. Reddit's authorize endpoint currently returns "bad request: invalid client id" against the managed OAuth client the Arcade Engine uses for the reddit provider, so readers who follow these pages today can't get past the "authorize the tool" step. Changes: build-mcp-server/page.mdx - server.py snippet: from arcade_mcp_server.auth import Reddit → GitHub, get_posts_in_subreddit → star_repo using GitHub(scopes=["public_repo"]) and PUT https://api.github.com/user/starred/{owner}/{repo}. - Also fixes a stale "finally-mcp-server" User-Agent left over from someone's local project name (the real template uses "{{ toolkit_name }}-mcp-server", which renders to "my_server-mcp-server" for the tutorial's app name). - Updates the "Since the Reddit tool…" prose to GitHub equivalent. - Updates the sample log-output line: "Added tool: get_posts_in_subreddit" → "Added tool: star_repo". mcp-server-quickstart/page.mdx - Updates the get_posts_in_subreddit bullet to describe star_repo. - Updates the sample log-output line. - Updates the "Since the Reddit tool…" prose. - Updates the example prompt list to "Star the ArcadeAI/arcade-mcp repository on GitHub". - Updates the troubleshooting header "The Reddit tool is not working" → "The GitHub tool is not working". Pairs with: ArcadeAI/arcade-mcp PR (swap minimal scaffold template). Not run locally: - pnpm install + ultracite + vale (heavy dep tree for a prose-only swap; relying on CI). Co-authored-by: Cursor <cursoragent@cursor.com> * Update docs to match merged implementation Remove scope from GitHub --------- Co-authored-by: Thierry Damiba <177760997+thierrypdamiba@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent f13d418 commit 1072924

2 files changed

Lines changed: 21 additions & 26 deletions

File tree

  • app/en
    • get-started/quickstarts/mcp-server-quickstart
    • guides/create-tools/tool-basics/build-mcp-server

app/en/get-started/quickstarts/mcp-server-quickstart/page.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ my_server/
9696

9797
- **`greet`**: This tool has a single argument, the name of the person to greet. It requires no secrets or auth
9898
- **`whisper_secret`**: This tool requires no arguments, and will output the last 4 characters of a `MY_SECRET_KEY` secret that you can define in your `.env` file.
99-
- **`get_posts_in_subreddit`**: This tool has a single argument, a subreddit, and will return the latest posts on that subreddit, it requires the user to authorize the tool to perform a read operation on their behalf.
99+
- **`star_repo`**: This tool takes a GitHub `owner` and `repo` name and stars that public repository on behalf of the authenticated user. It requires the user to authorize the tool to act on their behalf.
100100

101101
> If you're having issues with the `arcade` command, please see the [Troubleshooting](#troubleshooting) section.
102102
@@ -158,7 +158,7 @@ $env:MY_SECRET_KEY="my-secret-value"
158158

159159
## Connect to Arcade to unlock authorized tool calling
160160

161-
Since the Reddit tool accesses information only available to your Reddit account, you'll need to authorize it. For this, you'll need to create an <SignupLink linkLocation="docs:mcp-server-quickstart" utmCampaign="docs-quickstart-mcp-server">Arcade account</SignupLink> and connect from the terminal, run:
161+
Since the GitHub tool stars a repository on your behalf, you'll need to authorize it. For this, you'll need to create an <SignupLink linkLocation="docs:mcp-server-quickstart" utmCampaign="docs-quickstart-mcp-server">Arcade account</SignupLink> and connect from the terminal, run:
162162

163163
```bash
164164
arcade login
@@ -219,7 +219,7 @@ You should see output like this in your terminal:
219219
```bash
220220
2025-11-03 13:46:11.041 | DEBUG | arcade_mcp_server.mcp_app:add_tool:242 - Added tool: greet
221221
2025-11-03 13:46:11.042 | DEBUG | arcade_mcp_server.mcp_app:add_tool:242 - Added tool: whisper_secret
222-
2025-11-03 13:46:11.043 | DEBUG | arcade_mcp_server.mcp_app:add_tool:242 - Added tool: get_posts_in_subreddit
222+
2025-11-03 13:46:11.043 | DEBUG | arcade_mcp_server.mcp_app:add_tool:242 - Added tool: star_repo
223223
INFO | 13:46:11 | arcade_mcp_server.mcp_app:299 | Starting my_server v1.0.0 with 3 tools
224224
```
225225

@@ -272,7 +272,7 @@ Try calling your tool inside your assistant.
272272

273273
Here's some prompts you can try:
274274

275-
- "Get some posts from the r/mcp subreddit"
275+
- "Star the ArcadeAI/arcade-mcp repository on GitHub"
276276
- "What's the last 4 characters of my secret key?"
277277
- "Greet me as Supreme Lord of MCP"
278278

@@ -284,7 +284,7 @@ Here's some prompts you can try:
284284

285285
If you're getting issues with the `arcade` command, please make sure you did not install it outside of your virtual environment. For example, if your system-wide Python installation older than 3.10, you may need to uninstall arcade from that Python installation in order for the terminal to recognize the `arcade` command installed in your virtual environment.
286286

287-
### The Reddit tool is not working
287+
### The GitHub tool is not working
288288

289289
Ensure you run `arcade login` and follow the instructions in your browser to connect your terminal to your Arcade account.
290290

app/en/guides/create-tools/tool-basics/build-mcp-server/page.mdx

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,15 @@ from typing import Annotated
9797

9898
import httpx
9999
from arcade_mcp_server import Context, MCPApp
100-
from arcade_mcp_server.auth import Reddit
100+
from arcade_mcp_server.auth import GitHub
101101

102102
app = MCPApp(name="my_server", version="1.0.0", log_level="DEBUG")
103103

104-
105104
@app.tool
106105
def greet(name: Annotated[str, "The name of the person to greet"]) -> str:
107106
"""Greet a person by name."""
108107
return f"Hello, {name}!"
109108

110-
111109
# To use this tool locally, you need to either set the secret in the .env file or as an environment variable
112110
@app.tool(requires_secrets=["MY_SECRET_KEY"])
113111
def whisper_secret(context: Context) -> Annotated[str, "The last 4 characters of the secret"]:
@@ -124,32 +122,29 @@ def whisper_secret(context: Context) -> Annotated[str, "The last 4 characters of
124122

125123
# To use this tool locally, you need to install the Arcade CLI (uv tool install arcade-mcp)
126124
# and then run 'arcade login' to authenticate.
127-
@app.tool(requires_auth=Reddit(scopes=["read"]))
128-
async def get_posts_in_subreddit(
129-
context: Context, subreddit: Annotated[str, "The name of the subreddit"]
130-
) -> dict:
131-
"""Get posts from a specific subreddit"""
132-
# Normalize the subreddit name
133-
subreddit = subreddit.lower().replace("r/", "").replace(" ", "")
134-
135-
# Prepare the httpx request
125+
@app.tool(requires_auth=GitHub())
126+
async def star_repo(
127+
context: Context,
128+
owner: Annotated[str, "GitHub owner (user or org). E.g. 'ArcadeAI'"],
129+
repo: Annotated[str, "GitHub repository name. E.g. 'arcade-mcp'"],
130+
) -> Annotated[str, "Confirmation that the repository was starred"]:
131+
"""Star a public GitHub repository on behalf of the authenticated user."""
136132
# OAuth token is injected into the context at runtime.
137133
# LLMs and MCP clients cannot see or access your OAuth tokens.
138134
oauth_token = context.get_auth_token_or_empty()
139135
headers = {
140136
"Authorization": f"Bearer {oauth_token}",
141-
"User-Agent": "finally-mcp-server",
137+
"Accept": "application/vnd.github+json",
138+
"X-GitHub-Api-Version": "2022-11-28",
139+
"User-Agent": "my_server-mcp-server",
142140
}
143-
params = {"limit": 5}
144-
url = f"https://oauth.reddit.com/r/{subreddit}/hot"
141+
url = f"https://api.github.com/user/starred/{owner}/{repo}"
145142

146-
# Make the request
147143
async with httpx.AsyncClient() as client:
148-
response = await client.get(url, headers=headers, params=params)
144+
response = await client.put(url, headers=headers)
149145
response.raise_for_status()
150146

151-
# Return the response
152-
return response.json()
147+
return f"Starred {owner}/{repo}."
153148

154149
# Run with specific transport
155150
if __name__ == "__main__":
@@ -225,7 +220,7 @@ $env:MY_SECRET_KEY="my-secret-value"
225220

226221
## Connect to Arcade to unlock authorized tool calling
227222

228-
Since the Reddit tool accesses information only available to your Reddit account, you'll need to authorize it. For this, you'll need to create an Arcade account and connect to it from the terminal, run:
223+
Since the GitHub tool stars a repository on your behalf, you'll need to authorize it. For this, you'll need to create an Arcade account and connect to it from the terminal, run:
229224

230225
```bash
231226
arcade login
@@ -285,7 +280,7 @@ You should see output like this in your terminal:
285280
```bash
286281
2025-11-03 13:46:11.041 | DEBUG | arcade_mcp_server.mcp_app:add_tool:242 - Added tool: greet
287282
2025-11-03 13:46:11.042 | DEBUG | arcade_mcp_server.mcp_app:add_tool:242 - Added tool: whisper_secret
288-
2025-11-03 13:46:11.043 | DEBUG | arcade_mcp_server.mcp_app:add_tool:242 - Added tool: get_posts_in_subreddit
283+
2025-11-03 13:46:11.043 | DEBUG | arcade_mcp_server.mcp_app:add_tool:242 - Added tool: star_repo
289284
INFO | 13:46:11 | arcade_mcp_server.mcp_app:299 | Starting my_server v1.0.0 with 3 tools
290285
```
291286

0 commit comments

Comments
 (0)