Skip to content

Commit 045a5e4

Browse files
authored
Merge pull request #229 from xdevplatform/mintlify/cb0fd67c
docs: split MCP getting started into simple and full routes
2 parents 9e3c5ca + c56f846 commit 045a5e4

1 file changed

Lines changed: 96 additions & 17 deletions

File tree

tools/mcp.mdx

Lines changed: 96 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,22 @@ flowchart LR
4646
- On **first run with no cached token**, it opens your browser for a one-time OAuth2 login, then caches and **auto-refreshes** the token forever after.
4747
- All diagnostics go to **stderr**; **stdout stays a clean JSON-RPC channel**.
4848

49-
### Before you begin
49+
### Getting started
5050

51-
1. **Create an X app** in the [X Developer Portal](https://developer.x.com) with **OAuth 2.0** enabled.
51+
Pick one of two routes:
52+
53+
* **Simple — App-only Bearer.** Paste your app's Bearer token into an `Authorization` header on the MCP client. No bridge, no browser login. Read-only endpoints; no user context (can't act as you). Works with clients that support remote MCP with custom headers.
54+
* **Full — `xurl mcp` bridge (OAuth 2.0 user context).** A local bridge handles the OAuth 2.0 PKCE login and auto-refreshes tokens, so the model acts with your account's scopes. Required for writes (bookmarks, Articles) and any user-context tool.
55+
56+
#### Simple route (app-only Bearer)
57+
58+
1. **Create an X app** in the [X Developer Portal](https://developer.x.com).
59+
2. **Copy your App-only Bearer token** from the app's "Keys and tokens" page.
60+
3. Point your client at `https://api.x.com/mcp` with the token as an `Authorization` header — see [App-only (direct URL, no bridge)](#app-only-direct-url-no-bridge) below for the snippet.
61+
62+
#### Full route (xurl bridge)
63+
64+
1. **Create an X app** with **OAuth 2.0** enabled.
5265
2. **Register the redirect URI** `http://localhost:8080/callback` on the app (required for the first-run browser login). To use a different one, set `REDIRECT_URI` and register that instead.
5366
3. **Copy your `CLIENT_ID` and `CLIENT_SECRET`** — you'll put them in the client config.
5467
4. **Have Node.js installed** (for `npx`).
@@ -68,18 +81,9 @@ flowchart LR
6881

6982
#### 1. Grok Build
7083

71-
Add the server with one command (the `-e` flags become the server's environment, args after `--` go to `npx`):
84+
<CodeGroup>
7285

73-
```bash
74-
grok mcp add xapi npx \
75-
-e CLIENT_ID=YOUR_X_APP_CLIENT_ID \
76-
-e CLIENT_SECRET=YOUR_X_APP_CLIENT_SECRET \
77-
-- -y @xdevplatform/xurl mcp https://api.x.com/mcp
78-
```
79-
80-
That writes this to `~/.grok/config.toml` (you can also edit it directly):
81-
82-
```toml
86+
```toml xurl bridge (~/.grok/config.toml)
8387
[mcp_servers.xapi]
8488
command = "npx"
8589
args = ["-y", "@xdevplatform/xurl", "mcp", "https://api.x.com/mcp"]
@@ -91,6 +95,26 @@ CLIENT_ID = "YOUR_X_APP_CLIENT_ID"
9195
CLIENT_SECRET = "YOUR_X_APP_CLIENT_SECRET"
9296
```
9397

98+
```toml App-only Bearer (~/.grok/config.toml)
99+
[mcp_servers.xapi]
100+
url = "https://api.x.com/mcp"
101+
enabled = true
102+
103+
[mcp_servers.xapi.headers]
104+
Authorization = "Bearer YOUR_APP_ONLY_BEARER_TOKEN"
105+
```
106+
107+
</CodeGroup>
108+
109+
Or add the xurl bridge with one command (the `-e` flags become the server's environment, args after `--` go to `npx`):
110+
111+
```bash
112+
grok mcp add xapi npx \
113+
-e CLIENT_ID=YOUR_X_APP_CLIENT_ID \
114+
-e CLIENT_SECRET=YOUR_X_APP_CLIENT_SECRET \
115+
-- -y @xdevplatform/xurl mcp https://api.x.com/mcp
116+
```
117+
94118
Verify and list:
95119

96120
```bash
@@ -104,7 +128,9 @@ The first time a tool is invoked (or on `doctor`), your browser opens for the X
104128

105129
Create `~/.cursor/mcp.json` (global, all projects) or `.cursor/mcp.json` (this project only):
106130

107-
```json
131+
<CodeGroup>
132+
133+
```json xurl bridge
108134
{
109135
"mcpServers": {
110136
"xapi": {
@@ -119,13 +145,30 @@ Create `~/.cursor/mcp.json` (global, all projects) or `.cursor/mcp.json` (this p
119145
}
120146
```
121147

148+
```json App-only Bearer
149+
{
150+
"mcpServers": {
151+
"xapi": {
152+
"url": "https://api.x.com/mcp",
153+
"headers": {
154+
"Authorization": "Bearer YOUR_APP_ONLY_BEARER_TOKEN"
155+
}
156+
}
157+
}
158+
}
159+
```
160+
161+
</CodeGroup>
162+
122163
Then open **Cursor → Settings → MCP**, confirm **xapi** shows a green dot and its tools. On first use Cursor spawns the bridge and your browser opens for login; the tool list populates once the handshake completes.
123164

124165
#### 3. Claude Desktop
125166

126167
Edit `claude_desktop_config.json` (macOS: `~/Library/Application Support/Claude/`, Windows: `%APPDATA%\Claude\`):
127168

128-
```json
169+
<CodeGroup>
170+
171+
```json xurl bridge
129172
{
130173
"mcpServers": {
131174
"xapi": {
@@ -137,13 +180,28 @@ Edit `claude_desktop_config.json` (macOS: `~/Library/Application Support/Claude/
137180
}
138181
```
139182

183+
```json App-only Bearer
184+
{
185+
"mcpServers": {
186+
"xapi": {
187+
"url": "https://api.x.com/mcp",
188+
"headers": { "Authorization": "Bearer YOUR_APP_ONLY_BEARER_TOKEN" }
189+
}
190+
}
191+
}
192+
```
193+
194+
</CodeGroup>
195+
140196
Restart Claude Desktop; the X tools appear in the tools (🔌) menu.
141197

142198
#### 4. VS Code (GitHub Copilot / Agent mode)
143199

144200
Add to `.vscode/mcp.json`:
145201

146-
```json
202+
<CodeGroup>
203+
204+
```json xurl bridge
147205
{
148206
"servers": {
149207
"xapi": {
@@ -156,9 +214,23 @@ Add to `.vscode/mcp.json`:
156214
}
157215
```
158216

217+
```json App-only Bearer
218+
{
219+
"servers": {
220+
"xapi": {
221+
"type": "http",
222+
"url": "https://api.x.com/mcp",
223+
"headers": { "Authorization": "Bearer YOUR_APP_ONLY_BEARER_TOKEN" }
224+
}
225+
}
226+
}
227+
```
228+
229+
</CodeGroup>
230+
159231
#### 5. Any MCP client
160232

161-
The universal stdio config is:
233+
**xurl bridge (stdio):**
162234

163235
| Field | Value |
164236
|---|---|
@@ -169,6 +241,13 @@ The universal stdio config is:
169241

170242
If you installed `xurl` natively, replace `command`/`args` with `"command": "xurl", "args": ["mcp", "https://api.x.com/mcp"]`.
171243

244+
**App-only Bearer (remote HTTP):**
245+
246+
| Field | Value |
247+
|---|---|
248+
| `url` | `https://api.x.com/mcp` |
249+
| `headers.Authorization` | `Bearer YOUR_APP_ONLY_BEARER_TOKEN` |
250+
172251
### Authentication
173252

174253
#### OAuth 2.0 user context (default)

0 commit comments

Comments
 (0)