|
2 | 2 |
|
3 | 3 | This is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server that supports remote MCP connections, with Cloudflare OAuth built-in. |
4 | 4 |
|
| 5 | +It features tools powered by the [Cloudflare Radar API](https://developers.cloudflare.com/radar/). |
| 6 | + |
| 7 | +## Tools |
| 8 | + |
| 9 | +Currently available tools: |
| 10 | + |
| 11 | +- `list_autonomous_systems`: Lists autonomous systems (filterable by location and sortable by population size) |
| 12 | +- `get_as_details`: Retrieves details of an autonomous system by ASN |
| 13 | +- `get_ip_details`: Provides information about a specific IP address |
| 14 | +- `get_traffic_anomalies`: Lists traffic anomalies (filterable by AS, location, start date, and end date) |
| 15 | + |
| 16 | +This MCP server is still a work in progress, and we plan to add more tools in the future. |
| 17 | + |
5 | 18 | ## Getting Started |
6 | 19 |
|
7 | | -- Set secrets via Wrangler (ask in the `Cloudflare's Own MCP Servers` internal channel to get credentials) |
| 20 | +#### Secrets |
| 21 | + |
| 22 | +Set secrets via Wrangler (ask in the `Cloudflare's Own MCP Servers` internal channel to get credentials) |
8 | 23 |
|
9 | 24 | ```bash |
10 | | -wrangler secret put CLOUDFLARE_CLIENT_ID |
11 | | -wrangler secret put CLOUDFLARE_CLIENT_SECRET |
| 25 | +npx wrangler secret put CLOUDFLARE_CLIENT_ID -e <ENVIRONMENT> |
| 26 | +npx wrangler secret put CLOUDFLARE_CLIENT_SECRET -e <ENVIRONMENT> |
12 | 27 | ``` |
13 | 28 |
|
14 | 29 | #### Set up a KV namespace |
15 | 30 |
|
16 | | -- Create the KV namespace: |
17 | | - `wrangler kv:namespace create "OAUTH_KV"` |
18 | | -- Update the Wrangler file with the KV ID |
| 31 | +Create the KV namespace: |
| 32 | + |
| 33 | +```bash |
| 34 | +npx wrangler kv namespace create "OAUTH_KV" |
| 35 | +``` |
| 36 | + |
| 37 | +Then, update the Wrangler file with the generated KV namespace ID. |
19 | 38 |
|
20 | 39 | #### Deploy & Test |
21 | 40 |
|
22 | | -Deploy the MCP server to make it available on your workers.dev domain |
23 | | -` wrangler deploy` |
| 41 | +Deploy the MCP server to make it available on your workers.dev domain: |
| 42 | + |
| 43 | +```bash |
| 44 | +npx wrangler deploy -e <ENVIRONMENT> |
| 45 | +``` |
24 | 46 |
|
25 | 47 | Test the remote server using [Inspector](https://modelcontextprotocol.io/docs/tools/inspector): |
26 | 48 |
|
27 | 49 | ``` |
28 | 50 | npx @modelcontextprotocol/inspector@latest |
29 | 51 | ``` |
| 52 | + |
| 53 | +## Local Development |
| 54 | + |
| 55 | +If you'd like to iterate and test your MCP server, you can do so in local development. |
| 56 | +This will require you to create another OAuth App on Cloudflare: |
| 57 | + |
| 58 | +1. Create a `.dev.vars` file in your project root with: |
| 59 | + |
| 60 | + ``` |
| 61 | + CLOUDFLARE_CLIENT_ID=your_development_cloudflare_client_id |
| 62 | + CLOUDFLARE_CLIENT_SECRET=your_development_cloudflare_client_secret |
| 63 | + ``` |
| 64 | + |
| 65 | +2. Start the local development server: |
| 66 | + |
| 67 | + ```bash |
| 68 | + npx wrangler dev |
| 69 | + ``` |
| 70 | + |
| 71 | +3. To test locally, open Inspector, and connect to `http://localhost:8788/sse`. |
| 72 | +Once you follow the prompts, you'll be able to "List Tools". |
0 commit comments