documentation/docs/mcp/cloudflare-mcp.md
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
This tutorial covers how to add Cloudflare's MCP Servers as goose extensions to manage your Cloudflare infrastructure, debug applications, analyze traffic, and more using natural language.
Cloudflare provides multiple specialized MCP servers for different aspects of their platform, allowing you to interact with Workers, DNS, security features, analytics, and development tools.
:::tip Quick Install
<Tabs groupId="interface"> <TabItem value="ui" label="goose Desktop" default> [Launch the installer](goose://extension?cmd=npx&arg=mcp-remote&arg=https%3A%2F%2Fobservability.mcp.cloudflare.com%2Fmcp&id=cloudflare-observability&name=Cloudflare%20Observability&description=Debug%20and%20get%20insight%20into%20your%20application%27s%20logs%20and%20analytics&env=CLOUDFLARE_API_TOKEN%3DCloudflare%20API%20Token) </TabItem> <TabItem value="cli" label="goose CLI"> **Command** ```sh npx mcp-remote https://observability.mcp.cloudflare.com/mcp ``` </TabItem> </Tabs> **Environment Variable** ``` CLOUDFLARE_API_TOKEN: Your Cloudflare API token with appropriate permissions ``` :::Cloudflare provides multiple specialized MCP servers for different use cases:
| Server | Description | Use Cases |
|---|---|---|
| Documentation | Get up-to-date reference information on Cloudflare | API reference, feature documentation, troubleshooting guides |
| Workers Bindings | Build Workers applications with storage, AI, and compute primitives | KV storage, R2 buckets, AI models, Durable Objects |
| Workers Builds | Get insights and manage your Cloudflare Workers builds | Deployment status, build logs, version management |
| Observability | Debug and get insight into your application's logs and analytics | Error tracking, performance monitoring, request analysis |
| Radar | Global Internet traffic insights, trends, URL scans, and utilities | Traffic analysis, threat intelligence, URL scanning |
| Container | Spin up sandbox development environments | Isolated testing, development containers |
| Browser Rendering | Fetch web pages, convert to markdown, take screenshots | Web scraping, content analysis, visual testing |
| Logpush | Get quick summaries for Logpush job health | Log management, data pipeline monitoring |
| AI Gateway | Search logs, get details about prompts and responses | AI usage analytics, prompt optimization |
| AutoRAG | List and search documents on your AutoRAGs | Document retrieval, knowledge base management |
| Audit Logs | Query audit logs and generate reports for review | Security monitoring, compliance reporting |
| DNS Analytics | Optimize DNS performance and debug issues | DNS troubleshooting, performance optimization |
| Digital Experience Monitoring | Get insight on critical applications for your organization | Application performance, user experience monitoring |
| Cloudflare One CASB | Identify security misconfigurations for SaaS applications | Security posture, compliance checking |
| GraphQL | Get analytics data using Cloudflare's GraphQL API | Custom analytics, data visualization |
npx command)Choose one or more servers based on your needs. Here are the most popular configurations:
Command-line Extensioncloudflare-observabilitynpx mcp-remote https://observability.mcp.cloudflare.com/mcp300 secondsCLOUDFLARE_API_TOKENLet's use the Observability server to debug performance issues with a Workers application:
I'm seeing high error rates on my Workers application "my-api-worker". Can you help me:
1. Check the recent error logs
2. Identify the most common error types
3. Analyze the performance metrics
4. Suggest optimizations based on the data
I'll help you debug the issues with your "my-api-worker" application. Let me gather the observability data to identify the problems.
First, let me check the recent error logs for your worker:
[goose uses the observability MCP server to fetch error logs]
I found several issues with your worker:
**Error Analysis:**
- 45% of errors are 500 Internal Server Errors
- 30% are timeout errors (exceeded 30s CPU limit)
- 25% are memory limit exceeded errors
**Performance Metrics:**
- Average response time: 2.3s (up 150% from last week)
- CPU usage: 85% average (critical threshold)
- Memory usage: 92% average (near limit)
**Root Causes Identified:**
1. Database connection pooling issues causing timeouts
2. Memory leaks in JSON parsing for large payloads
3. Inefficient regex operations in request validation
**Recommended Optimizations:**
1. Implement connection pooling with proper cleanup
2. Stream large JSON payloads instead of loading into memory
3. Replace regex with more efficient string operations
4. Add caching for frequently accessed data
Would you like me to help implement any of these fixes?
Using the Workers Bindings server to set up storage and AI capabilities:
I need to set up a new Workers project with:
1. KV storage for caching
2. R2 bucket for file uploads
3. AI binding for text analysis
4. Durable Object for real-time features
Can you help me configure these bindings?
Using the Radar server for security and traffic analysis:
Can you help me analyze the security posture of my domain example.com? I want to:
1. Check for any security threats or malicious traffic
2. Analyze global traffic patterns
3. Scan for vulnerabilities
4. Get recommendations for improving security
Authentication Errors:
Rate Limiting:
Connection Issues:
If you encounter issues:
With Cloudflare MCP servers enabled in goose, you can:
Try starting with the Observability server to get insights into your current applications, then expand to other servers based on your specific needs.