Skip to content

Commit 5ff4529

Browse files
fix(graphql): handle error responses and deprecate dedicated server (#430)
* fix: handle path-less GraphQL errors (#402) * fix: address PR #430 review feedback - mock GraphQL API requests with the shared MSW server - fail on unhandled outbound requests and assert request details * chore(graphql): deprecate dedicated MCP server - direct users to the Cloudflare API MCP server - remove the GraphQL server from public listings - tighten GraphQL response diagnostics against the specification --------- Co-authored-by: agent-think[bot] <agent-think[bot]@users.noreply.github.com> Co-authored-by: Matt Carey <mcarey@cloudflare.com> Co-authored-by: Matt <77928207+mattzcarey@users.noreply.github.com>
1 parent ebcbad1 commit 5ff4529

12 files changed

Lines changed: 487 additions & 49 deletions
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"graphql-mcp-server": patch
3+
---
4+
5+
Deprecate the dedicated GraphQL MCP server in favor of the Cloudflare API MCP server at https://mcp.cloudflare.com/mcp. The replacement supports GraphQL queries, variables, and schema introspection through Code Mode.
6+
7+
The existing tools continue to work for now. The server exposes the migration notice through MCP instructions and is no longer advertised in the root server list or `server.json`.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"graphql-mcp-server": patch
3+
---
4+
5+
Surface GraphQL API errors with optional paths and extensions instead of throwing Zod validation errors, and pass through unrecognized upstream response shapes.

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ The following servers are included in this repository:
2424
| [**Digital Experience Monitoring server**](/apps/dex-analysis) | Get quick insight on critical applications for your organization | `https://dex.mcp.cloudflare.com/mcp` |
2525
| [**Cloudflare One CASB server**](/apps/cloudflare-one-casb) | Quickly identify any security misconfigurations for SaaS applications to safeguard users & data | `https://casb.mcp.cloudflare.com/mcp` |
2626
| [**Radar server**](/apps/radar) | Explore Cloudflare Radar internet insights | `https://radar.mcp.cloudflare.com/mcp` |
27-
| [**GraphQL server**](/apps/graphql) | Get analytics data using Cloudflare’s GraphQL API | `https://graphql.mcp.cloudflare.com/mcp` |
2827
| [**Cloudflare Blog server**](/apps/cloudflare-blog) | Search and read posts from the Cloudflare Blog | `https://blog.mcp.cloudflare.com/mcp` |
2928
| [**Demo Day server**](/apps/demo-day) | Demonstrate a minimal Cloudflare MCP server | `https://demo-day.mcp.cloudflare.com/mcp` |
3029

apps/graphql/CONTRIBUTING.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Setup
2+
3+
> This server is deprecated. See [`README.md`](./README.md) for the migration path to [`mcp.cloudflare.com/mcp`](https://mcp.cloudflare.com/mcp). Bug fixes are welcome, but new features should be proposed in the unified [`cloudflare/mcp`](https://github.com/cloudflare/mcp) repository.
4+
5+
You can run the server locally when maintaining existing behavior.
6+
7+
## Local development
8+
9+
1. Create a `.dev.vars` file in the project root.
10+
11+
Cloudflare employees can use OAuth credentials:
12+
13+
```text
14+
CLOUDFLARE_CLIENT_ID=your_development_cloudflare_client_id
15+
CLOUDFLARE_CLIENT_SECRET=your_development_cloudflare_client_secret
16+
```
17+
18+
External contributors can use a development API token:
19+
20+
```text
21+
DEV_DISABLE_OAUTH=true
22+
DEV_CLOUDFLARE_API_TOKEN=your_development_api_token
23+
```
24+
25+
2. Start the local development server:
26+
27+
```bash
28+
npx wrangler dev
29+
```
30+
31+
3. Open the [MCP Inspector](https://modelcontextprotocol.io/docs/tools/inspector) and connect to `http://localhost:8976/mcp`.
32+
33+
## Deploying the Worker (Cloudflare employees only)
34+
35+
Set secrets with Wrangler:
36+
37+
```bash
38+
npx wrangler secret put CLOUDFLARE_CLIENT_ID -e <ENVIRONMENT>
39+
npx wrangler secret put CLOUDFLARE_CLIENT_SECRET -e <ENVIRONMENT>
40+
```
41+
42+
Create the OAuth KV namespace, then add its ID to `wrangler.jsonc`:
43+
44+
```bash
45+
npx wrangler kv namespace create "OAUTH_KV"
46+
```
47+
48+
Deploy the server:
49+
50+
```bash
51+
npx wrangler deploy -e <ENVIRONMENT>
52+
```

apps/graphql/README.md

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,34 @@
11
# Cloudflare GraphQL MCP Server
22

3-
This is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server that supports remote MCP
4-
connections, with Cloudflare OAuth built-in. It integrates tools powered by the [Cloudflare GraphQL API](https://developers.cloudflare.com/analytics/graphql-api/) to provide insights and utilities for your Cloudflare account.
3+
## Deprecated
54

6-
The `/mcp` and `/sse` URLs use the same stateless SDK v2 handler and create a fresh server with request-scoped auth/account context for every request. `/sse` is not the deprecated HTTP+SSE transport. OAuth remains durable security state; no MCP protocol session or protocol Durable Object is retained.
5+
This dedicated MCP server is deprecated. Use the Cloudflare API MCP server at [`mcp.cloudflare.com/mcp`](https://mcp.cloudflare.com/mcp) instead. It supports the Cloudflare GraphQL Analytics API, including queries, variables, and schema introspection.
76

8-
## Available Tools
7+
The GraphQL Analytics API itself is not deprecated. Only this dedicated MCP server is being retired.
98

10-
Currently available tools:
9+
Configure the replacement server in your MCP client:
10+
11+
```json
12+
{
13+
"mcpServers": {
14+
"cloudflare-api": {
15+
"url": "https://mcp.cloudflare.com/mcp"
16+
}
17+
}
18+
}
19+
```
20+
21+
The replacement uses [Code Mode](https://blog.cloudflare.com/code-mode-mcp/). Its `search` and `execute` tools cover the full Cloudflare API, including `POST /client/v4/graphql`. See the [GraphQL Analytics API example](https://github.com/cloudflare/mcp#graphql-analytics-api) in [`cloudflare/mcp`](https://github.com/cloudflare/mcp).
22+
23+
The tools below still work for now, but no new features will be added. Please migrate to the Cloudflare API MCP server.
24+
25+
---
26+
27+
This is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server that supports remote MCP connections, with Cloudflare OAuth built in. It integrates tools powered by the [Cloudflare GraphQL Analytics API](https://developers.cloudflare.com/analytics/graphql-api/) to provide insights and utilities for your Cloudflare account.
28+
29+
Until retirement, the `/mcp` and `/sse` URLs use the same stateless SDK v2 handler and create a fresh server with request-scoped auth and account context for every request. `/sse` is not the deprecated HTTP+SSE transport. OAuth remains durable security state; the server retains no MCP protocol session or protocol Durable Object.
30+
31+
## Available tools
1132

1233
| **Category** | **Tool** | **Description** |
1334
| --------------------------- | ------------------------- | ----------------------------------------------------------------------------------------------- |
@@ -18,7 +39,7 @@ Currently available tools:
1839
| **GraphQL Query Execution** | `graphql_query` | Execute a GraphQL query against the Cloudflare API |
1940
| **GraphQL API Explorer** | `graphql_api_explorer` | Generate a Cloudflare [GraphQL API Explorer](https://graphql.cloudflare.com/explorer) link |
2041

21-
### Prompt Examples
42+
### Prompt examples
2243

2344
- `Show me HTTP traffic for the last 7 days for example.com`
2445
- `Show me which GraphQL datatype I need to use to query firewall events`
@@ -27,4 +48,8 @@ Currently available tools:
2748

2849
## Connect to the MCP server
2950

51+
> This connection information is retained for existing users. New users should configure [`mcp.cloudflare.com/mcp`](https://mcp.cloudflare.com/mcp) as shown above.
52+
3053
Connect your MCP client directly to `https://graphql.mcp.cloudflare.com/mcp`. If prompted, complete the Cloudflare OAuth flow in your browser. The tools become available after authorization.
54+
55+
Bug fixes are still accepted. See [CONTRIBUTING.md](CONTRIBUTING.md) for local setup. New features should be proposed in the unified [`cloudflare/mcp`](https://github.com/cloudflare/mcp) repository.

apps/graphql/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"devDependencies": {
2121
"@cloudflare/vitest-pool-workers": "0.16.11",
2222
"@types/node": "22.15.17",
23+
"msw": "2.14.6",
2324
"prettier": "3.5.3",
2425
"typescript": "5.5.4",
2526
"vitest": "4.1.8",

apps/graphql/src/graphql.app.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import { registerGraphQLTools } from './tools/graphql.tools'
77

88
import type { Env } from './graphql.context'
99

10+
export const DEPRECATION_INSTRUCTIONS =
11+
'DEPRECATED: Use the Cloudflare API MCP server at https://mcp.cloudflare.com/mcp instead; it supports the GraphQL Analytics API.'
12+
1013
const GraphQLScopes = {
1114
...RequiredScopes,
1215
'account:read': 'See your account info such as account details, analytics, and memberships.',
@@ -16,6 +19,7 @@ const GraphQLScopes = {
1619
const app = createAuthenticatedMcpApp<Env>({
1720
serviceHostnames: ['graphql-staging.mcp.cloudflare.com', 'graphql.mcp.cloudflare.com'],
1821
scopes: GraphQLScopes,
22+
serverOptions: { instructions: DEPRECATION_INSTRUCTIONS },
1923
createSentry: ({ env, executionCtx, request, props }) =>
2024
props?.type === 'user_token'
2125
? initSentryWithUser(env, executionCtx, props.user.id, request)

0 commit comments

Comments
 (0)