Cloudflare AI Gateway MCP server

Cloudflare's AI Gateway allows you to gain visibility and control over your AI apps. By connecting your apps to AI Gateway, you can gather insights on how people are using your application.
Back to servers
Provider
Cloudflare
Release date
May 01, 2025
Stats
2.0K stars

Cloudflare AI Gateway MCP Server provides a Model Context Protocol (MCP) implementation that connects to Cloudflare's AI Gateway API. This server enables access to Cloudflare's global Internet traffic insights and AI tools through a secure OAuth authentication flow.

Available Tools

The MCP server currently offers these tools:

  • list_gateways - Lists all AI Gateways in your account with pagination support
  • list_logs - Retrieves gateway logs with filtering options for date ranges, feedback scores, and more
  • get_log_details - Fetches detailed information about a specific log by ID
  • get_log_request_body - Retrieves the request body for a specific log
  • get_log_response_body - Retrieves the response body for a specific log

Note: You must have an active account set to use these tools. If needed, use accounts_list to see your accounts and set_active_account to select one.

Using the Remote MCP Server

With Native MCP Client Support

If your MCP client directly supports remote MCP servers:

  1. Enter the server URL https://ai-gateway.mcp.cloudflare.com in your client interface
  2. Follow the authentication prompts
  3. Start using the available tools

This is supported in tools like Cloudflare AI Playground.

Without Native MCP Client Support

If your client doesn't directly support remote MCP servers:

  1. Install the mcp-remote package:

    npm install mcp-remote
    
  2. Create or modify your client's configuration file with:

    {
      "mcpServers": {
        "cloudflare": {
          "command": "npx",
          "args": ["mcp-remote", "https://ai-gateway.mcp.cloudflare.com/sse"]
        }
      }
    }
    
  3. Restart your MCP client

  4. Complete the OAuth authentication flow in the browser window that opens

  5. After authentication, the tools will be available in your client

Example Prompts

Try these example prompts to get started:

  • "List all my AI Gateways."
  • "Show logs for gateway 'gateway-001' between January 1, 2023, and January 31, 2023."
  • "Fetch the latest errors from gateway-001 and debug what might have happened wrongly"

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later