|
| 1 | +# Cloudflare Radar MCP Server 📡 |
| 2 | + |
| 3 | +This is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server that supports remote MCP |
| 4 | +connections, with Cloudflare OAuth built-in. |
| 5 | + |
| 6 | +It integrates tools powered by the [Cloudflare Radar API](https://developers.cloudflare.com/radar/) to provide global |
| 7 | +Internet traffic insights, trends and other utilities. |
| 8 | + |
| 9 | +## 🔨 Available Tools |
| 10 | + |
| 11 | +Currently available tools: |
| 12 | + |
| 13 | +| **Category** | **Tool** | **Description** | |
| 14 | +| ---------------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------- | |
| 15 | +| **HTTP Requests** | `get_http_requests_data` | Fetches HTTP request data (timeseries, summaries, and grouped timeseries across dimensions like `deviceType`, `botClass`) | |
| 16 | +| **Autonomous Systems** | `list_autonomous_systems` | Lists ASes; filter by location and sort by population size | |
| 17 | +| | `get_as_details` | Retrieves detailed info for a specific ASN | |
| 18 | +| **IP Addresses** | `get_ip_details` | Provides details about a specific IP address | |
| 19 | +| **Traffic Anomalies** | `get_traffic_anomalies` | Lists traffic anomalies; filter by AS, location, start date, and end date | |
| 20 | +| **Domains** | `get_domains_ranking` | Get top or trending domains | |
| 21 | +| | `get_domain_rank_details` | Get domain rank details | |
| 22 | +| **URL Scanner** | `scan_url` | Scans a URL via [Cloudflare’s URL Scanner](https://developers.cloudflare.com/radar/investigate/url-scanner/) | |
| 23 | + |
| 24 | +This MCP server is still a work in progress, and we plan to add more tools in the future. |
| 25 | + |
| 26 | +### Prompt Examples |
| 27 | + |
| 28 | +- `What are the most used operating systems?` |
| 29 | +- `What are the top 5 ASes in Portugal?` |
| 30 | +- `Get information about ASN 13335.` |
| 31 | +- `What are the details of IP address 1.1.1.1?` |
| 32 | +- `List me traffic anomalies in Brazil over the last year.` |
| 33 | +- `Compare domain rankings in the US and UK.` |
| 34 | +- `Give me rank details for google.com in March 2025.` |
| 35 | +- `Scan https://example.com.` |
| 36 | + |
| 37 | +## Access the remote MCP server from Claude Desktop |
| 38 | + |
| 39 | +Open Claude Desktop and navigate to `Settings -> Developer -> Edit Config`. |
| 40 | +This opens the configuration file that controls which MCP servers Claude can access. |
| 41 | + |
| 42 | +Replace the content with the following configuration: |
| 43 | + |
| 44 | +```json |
| 45 | +{ |
| 46 | + "mcpServers": { |
| 47 | + "cloudflare": { |
| 48 | + "command": "npx", |
| 49 | + "args": ["mcp-remote", "https://radar.mcp.cloudflare.com/sse"] |
| 50 | + } |
| 51 | + } |
| 52 | +} |
| 53 | +``` |
| 54 | + |
| 55 | +Once you restart Claude Desktop, a browser window will open showing your OAuth login page. |
| 56 | +Complete the authentication flow to grant Claude access to your MCP server. |
| 57 | +After you grant access, the tools will become available for you to use. |
| 58 | + |
| 59 | +## Setup |
| 60 | + |
| 61 | +#### Secrets |
| 62 | + |
| 63 | +Set secrets via Wrangler: |
| 64 | + |
| 65 | +```bash |
| 66 | +npx wrangler secret put CLOUDFLARE_CLIENT_ID -e <ENVIRONMENT> |
| 67 | +npx wrangler secret put CLOUDFLARE_CLIENT_SECRET -e <ENVIRONMENT> |
| 68 | +npx wrangler secret put URL_SCANNER_API_TOKEN -e <ENVIRONMENT> |
| 69 | +``` |
| 70 | + |
| 71 | +#### Set up a KV namespace |
| 72 | + |
| 73 | +Create the KV namespace: |
| 74 | + |
| 75 | +```bash |
| 76 | +npx wrangler kv namespace create "OAUTH_KV" |
| 77 | +``` |
| 78 | + |
| 79 | +Then, update the Wrangler file with the generated KV namespace ID. |
| 80 | + |
| 81 | +#### Deploy & Test |
| 82 | + |
| 83 | +Deploy the MCP server to make it available on your workers.dev domain: |
| 84 | + |
| 85 | +```bash |
| 86 | +npx wrangler deploy -e <ENVIRONMENT> |
| 87 | +``` |
| 88 | + |
| 89 | +Test the remote server using [Inspector](https://modelcontextprotocol.io/docs/tools/inspector): |
| 90 | + |
| 91 | +```bash |
| 92 | +npx @modelcontextprotocol/inspector@latest |
| 93 | +``` |
| 94 | + |
| 95 | +## Local Development |
| 96 | + |
| 97 | +If you'd like to iterate and test your MCP server, you can do so in local development. |
| 98 | +This will require you to create another OAuth App on Cloudflare: |
| 99 | + |
| 100 | +1. Create a `.dev.vars` file in your project root with: |
| 101 | + |
| 102 | + ``` |
| 103 | + CLOUDFLARE_CLIENT_ID=your_development_cloudflare_client_id |
| 104 | + CLOUDFLARE_CLIENT_SECRET=your_development_cloudflare_client_secret |
| 105 | + URL_SCANNER_API_TOKEN=your_development_url_scanner_api_token |
| 106 | + ``` |
| 107 | + |
| 108 | +2. Start the local development server: |
| 109 | + |
| 110 | + ```bash |
| 111 | + npx wrangler dev |
| 112 | + ``` |
| 113 | + |
| 114 | +3. To test locally, open Inspector, and connect to `http://localhost:8788/sse`. |
| 115 | + Once you follow the prompts, you'll be able to "List Tools". |
| 116 | + |
| 117 | + You can also connect to Claude Desktop. |
0 commit comments