Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@

MCP URL: `https://mcp.cloudflare.com/mcp`

Connection guides:

- [Claude Code](docs/connection-guides/claude-code.md)

### Option 1: OAuth (Recommended)

Just connect to the MCP server URL - you'll be redirected to Cloudflare to authorize and select permissions.
Expand Down
52 changes: 52 additions & 0 deletions docs/connection-guides/claude-code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Claude Code

Connect [Claude Code](https://code.claude.com/docs/en/overview) to the Cloudflare MCP server with one command:

```bash
claude mcp add --transport http cloudflare-api https://mcp.cloudflare.com/mcp
```

Then run `/mcp` inside Claude Code to sign in. Cloudflare will prompt you to
authorize access and select permissions with OAuth.

## API Token

For CI/CD and automation, skip OAuth and pass a
[Cloudflare API token](https://dash.cloudflare.com/profile/api-tokens) as a
bearer token:

```bash
claude mcp add --transport http cloudflare-api https://mcp.cloudflare.com/mcp \
--header "Authorization: Bearer YOUR_CLOUDFLARE_API_TOKEN"
```

Both user tokens and account tokens are supported. For account tokens, include
the **Account Resources : Read** permission so the server can auto-detect your
account ID.

## Share with Your Team

To check the server into your repo, add a `.mcp.json` file at the project root
(or run the command above with `--scope project`):

```json
{
"mcpServers": {
"cloudflare-api": {
"type": "http",
"url": "https://mcp.cloudflare.com/mcp"
}
}
}
```

Claude Code expands environment variables in `.mcp.json`, so an API token
header can reference `${CLOUDFLARE_API_TOKEN}` instead of committing the value
to the file.

## Disable Code Mode

To expose each Cloudflare API endpoint as an individual tool instead of the
compact code mode tools, add `?codemode=false` to the URL. This registers
~2,500 endpoint-specific tools and uses far more context, so only disable code
mode when you need it.