openclaw-mcp 1.5.0 → 2.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,8 +10,9 @@ All configuration can be done via environment variables. Copy `.env.example` to
10
10
  | ------------------------ | --------------------------------------- | ------------------------ |
11
11
  | `OPENCLAW_URL` | OpenClaw gateway URL | `http://127.0.0.1:18789` |
12
12
  | `OPENCLAW_GATEWAY_TOKEN` | Bearer token for gateway authentication | (none) |
13
- | `OPENCLAW_TIMEOUT_MS` | Request timeout in milliseconds | `120000` (2 min) |
13
+ | `OPENCLAW_TIMEOUT_MS` | Request timeout in milliseconds. For async (streamed) tasks this is an **idle** timeout — it resets on every received chunk, so long-running gateway work is only aborted when the stream goes silent. | `120000` (2 min) |
14
14
  | `OPENCLAW_MODEL` | Model name for chat completions | `openclaw` |
15
+ | `OPENCLAW_TASK_CONCURRENCY` | How many async tasks run in parallel (1–20) | `3` |
15
16
 
16
17
  ### Multi-Instance Mode
17
18
 
@@ -170,6 +171,18 @@ When auth is enabled, the server exposes these OAuth 2.1 endpoints:
170
171
 
171
172
  Dynamic client registration is **disabled by default** — only the pre-configured client (from `MCP_CLIENT_ID` + `MCP_CLIENT_SECRET`) can authenticate. This prevents anyone who knows the server URL from self-registering and bypassing auth.
172
173
 
174
+ #### Redirect URI allow-list
175
+
176
+ `MCP_REDIRECT_URIS` restricts which `redirect_uri` values the `/authorize` endpoint accepts for the pre-configured client. When unset, any redirect URI is accepted (the client secret verified during token exchange remains the actual auth gate) — set it in production so authorization codes can only be delivered to callbacks you trust.
177
+
178
+ Claude.ai uses exactly this callback (note the `/api/mcp/auth_callback` path):
179
+
180
+ ```bash
181
+ MCP_REDIRECT_URIS=https://claude.ai/api/mcp/auth_callback,https://claude.com/api/mcp/auth_callback
182
+ ```
183
+
184
+ Matching is exact (scheme, host, path). A common mistake is registering `https://claude.ai/oauth/callback`, which does **not** match and makes Claude.ai fail with `Unregistered redirect_uri`. If you also connect other clients (e.g. MCP Inspector), append their callbacks to the comma-separated list — loopback callbacks (`http://localhost/...`, `http://127.0.0.1/...`) match on any port per RFC 8252.
185
+
173
186
  #### Cursor / Windsurf compatibility (dev only)
174
187
 
175
188
  Cursor and Windsurf only support MCP servers that expose OAuth 2.0 Dynamic Client Registration (RFC 7591). To let them connect, set `MCP_DANGEROUSLY_ALLOW_DCR=true`. The server will then advertise a `/register` endpoint and accept ad-hoc client registrations (kept in an in-memory FIFO store, capped at 100 entries).
@@ -24,6 +24,7 @@ services:
24
24
  - MCP_CLIENT_SECRET=${MCP_CLIENT_SECRET:-}
25
25
  - MCP_ISSUER_URL=${MCP_ISSUER_URL:-}
26
26
  - MCP_REDIRECT_URIS=${MCP_REDIRECT_URIS:-}
27
+ - TRUST_PROXY=${TRUST_PROXY:-}
27
28
  - CORS_ORIGINS=${CORS_ORIGINS:-https://claude.ai}
28
29
  - NODE_ENV=production
29
30
  extra_hosts:
@@ -56,6 +57,12 @@ AUTH_ENABLED=true
56
57
  # Public URL (required when behind a reverse proxy)
57
58
  MCP_ISSUER_URL=https://mcp.your-domain.com
58
59
 
60
+ # Trust the reverse proxy's X-Forwarded-For (required behind a reverse proxy)
61
+ TRUST_PROXY=1
62
+
63
+ # Allowed OAuth redirect URIs — Claude.ai callbacks (recommended for production)
64
+ MCP_REDIRECT_URIS=https://claude.ai/api/mcp/auth_callback,https://claude.com/api/mcp/auth_callback
65
+
59
66
  # Allowed CORS origins
60
67
  CORS_ORIGINS=https://claude.ai
61
68
  ```
@@ -79,7 +86,7 @@ docker compose up -d
79
86
  - [ ] `MCP_CLIENT_SECRET` generated securely (`openssl rand -hex 32`, min 32 chars)
80
87
  - [ ] `MCP_ISSUER_URL` set to public HTTPS URL (when behind reverse proxy)
81
88
  - [ ] `TRUST_PROXY` set to the right hop count / CIDR (when behind reverse proxy)
82
- - [ ] `MCP_REDIRECT_URIS` restricted to known callback URLs
89
+ - [ ] `MCP_REDIRECT_URIS` restricted to known callback URLs (for Claude.ai: `https://claude.ai/api/mcp/auth_callback,https://claude.com/api/mcp/auth_callback`)
83
90
  - [ ] CORS restricted to known origins (`CORS_ORIGINS=https://claude.ai`)
84
91
  - [ ] `OPENCLAW_GATEWAY_TOKEN` set for gateway authentication
85
92
  - [ ] Dynamic client registration is disabled (default — no `/register` endpoint)
@@ -203,7 +210,19 @@ You're running behind a reverse proxy but haven't set `MCP_ISSUER_URL`. The OAut
203
210
 
204
211
  ### `POST /` or `GET /` returns 404 after OAuth succeeds
205
212
 
206
- Your Claude.ai connector URL is missing the `/mcp` path. The MCP Streamable HTTP transport is mounted at `/mcp`, not at the server root (which is intentional — root is reserved for `/health`, `/.well-known/*`, OAuth endpoints, and legacy SSE endpoints). Update the connector URL in Claude.ai to end with `/mcp`, e.g. `https://mcp.your-domain.com/mcp`.
213
+ Your Claude.ai connector URL is missing the `/mcp` path. The MCP Streamable HTTP transport is mounted at `/mcp`, not at the server root (which is intentional — root is reserved for `/health`, `/.well-known/*`, and OAuth endpoints). Update the connector URL in Claude.ai to end with `/mcp`, e.g. `https://mcp.your-domain.com/mcp`.
214
+
215
+ ### `invalid_request` / `Unregistered redirect_uri` on `/authorize`
216
+
217
+ The `redirect_uri` the client sent is not on the server's allow-list. Two common causes:
218
+
219
+ 1. **`MCP_REDIRECT_URIS` is set but doesn't contain the client's exact callback.** Claude.ai uses `https://claude.ai/api/mcp/auth_callback` (and `https://claude.com/api/mcp/auth_callback`) — a similar-looking entry like `https://claude.ai/oauth/callback` does **not** match. Matching is exact on scheme, host, and path; only loopback callbacks (`localhost`, `127.0.0.1`, `[::1]`) get port relaxation per RFC 8252.
220
+
221
+ 2. **You're on bridge ≤ 1.5.0 with `MCP_REDIRECT_URIS` unset.** The allow-any fallback in those versions was silently broken by a change in MCP SDK 1.29 (the SDK switched its membership check from `.includes()` to `.some()`), so *every* redirect_uri was rejected — fresh `npx openclaw-mcp@latest` installs picked the new SDK up automatically. Upgrade to bridge ≥ 1.6.0, or set `MCP_REDIRECT_URIS` explicitly (recommended for production anyway):
222
+
223
+ ```bash
224
+ MCP_REDIRECT_URIS=https://claude.ai/api/mcp/auth_callback,https://claude.com/api/mcp/auth_callback
225
+ ```
207
226
 
208
227
  ### `ValidationError: ERR_ERL_UNEXPECTED_X_FORWARDED_FOR` on `/token`
209
228
 
package/docs/index.html CHANGED
@@ -652,7 +652,7 @@ MCP_CLIENT_SECRET=$MCP_CLIENT_SECRET \
652
652
  MCP_ISSUER_URL=https://mcp.your-domain.com \
653
653
  CORS_ORIGINS=https://claude.ai \
654
654
  OPENCLAW_GATEWAY_TOKEN=your-token \
655
- npx openclaw-mcp --transport sse --port 3000</code></pre>
655
+ npx openclaw-mcp --transport http --port 3000</code></pre>
656
656
  </div>
657
657
  </div>
658
658
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-mcp",
3
- "version": "1.5.0",
3
+ "version": "2.0.0-beta.1",
4
4
  "mcpName": "io.github.freema/openclaw-mcp",
5
5
  "description": "Model Context Protocol (MCP) server for OpenClaw AI assistant integration",
6
6
  "author": "Tomáš Grasl <https://www.tomasgrasl.cz/>",
@@ -40,10 +40,16 @@
40
40
  "node": ">=20.0.0"
41
41
  },
42
42
  "dependencies": {
43
- "@modelcontextprotocol/sdk": "^1.0.0",
44
- "yargs": "^17.7.2"
43
+ "@modelcontextprotocol/express": "^2.0.0-beta.4",
44
+ "@modelcontextprotocol/node": "^2.0.0-beta.4",
45
+ "@modelcontextprotocol/server": "^2.0.0-beta.4",
46
+ "express": "^5.2.1",
47
+ "express-rate-limit": "^8.6.0",
48
+ "yargs": "^17.7.2",
49
+ "zod": "^4.4.3"
45
50
  },
46
51
  "devDependencies": {
52
+ "@types/express": "^5.0.6",
47
53
  "@types/node": "^20.11.0",
48
54
  "@types/yargs": "^17.0.32",
49
55
  "@typescript-eslint/eslint-plugin": "^6.21.0",