Can we use MCP server on Cloudflare?

Helga Rizka Putra Prayoga 100 Reputation points
2026-10-16T13:36:18.95+00:00

I want to use MCP SERVER using VS CODE for my coding and deploy via cloudflare, is it possible and can be used?

Microsoft Copilot | Microsoft 365 Copilot | Development
0 comments No comments

Answer accepted by question author

AI answer

2026-10-16T13:38:30.3966667+00:00

Yes—deploy the MCP server as a remote Cloudflare Worker/Agent using Streamable HTTP, then connect VS Code to its public HTTPS endpoint through .vscode/mcp.json. Cloudflare documents remote MCP hosting on Workers, while VS Code supports remote MCP servers over Streamable HTTP; SSE remains available only for legacy compatibility.^1^^2^

Deploy and connect

  1. Create the server
    • Follow Cloudflare’s remote MCP server guide.
    • Implement the tools, prompts, or resources that VS Code Copilot should access.
    • Use Streamable HTTP, not local stdio, because the server will run remotely.
    • Deploy it as a Cloudflare Worker and record the resulting MCP endpoint.
  2. Configure VS Code In your repository, create .vscode/mcp.json:
       {
         "servers": {
           "cloudflare-mcp": {
             "type": "http",
             "url": "${input:mcp-url}"
           }
         },
         "inputs": [
           {
             "type": "promptString",
             "id": "mcp-url",
             "description": "Cloudflare MCP endpoint"
           }
         ]
       }
    
    VS Code uses type: "http" for Streamable HTTP remote servers.^2^ You can alternatively press Ctrl+Shift+P → MCP: Add Server → HTTP or Server Sent Events, paste the deployed endpoint, name it, and choose workspace or global configuration.^3^
  3. Verify the connection
    • Open GitHub Copilot Chat and select Agent mode.
    • Run MCP: List Servers from the Command Palette.
    • Select cloudflare-mcp and start it if necessary.
    • Open the tools picker and enable the tools exposed by your server.^4^

Authentication

For a private server, do not embed permanent secrets directly in a repository’s mcp.json.

VS Code supports MCP authentication with OAuth and has built-in support for GitHub and Microsoft Entra ID. For other identity providers, VS Code supports OAuth 2.1/2.0 and begins with Dynamic Client Registration, falling back to client credentials when necessary.^2^

If using static API-token headers instead, collect the token as a password input and pass it in the header expected by your Worker:

{
  "servers": {
    "cloudflare-mcp": {
      "type": "http",
      "url": "${input:mcp-url}",
      "headers": {
        "Authorization": "Bearer ${input:mcp-token}"
      }
    }
  }
}

Define mcp-token as a promptString input with "password": true. The exact authorization header and validation logic must match the authentication implemented by your Cloudflare Worker.

Important distinction

The MCP server extends GitHub Copilot in VS Code with tools and context. It is separate from deploying your application code to Cloudflare: the same repository may contain both, but the application deployment and MCP server deployment are independent services.


References

  1. Build a Remote MCP server · Cloudflare Agents docs
  2. Visual Studio Code
  3. Connect Dataverse MCP with GitHub Copilot in Visual Studio Code and Copilot CLI
  4. Get started with Fabric MCP Server (local)
AI-generated content may be incorrect. Read our transparency notes for more information.

Was this answer helpful?

1 person found this answer helpful.

0 additional answers

Sort by: Oldest

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.