home / mcp / remote mcp server
Provides a remote MCP server with OAuth login, local testing, and Cloudflare deployment for secure client access.
Configuration
View docs{
"mcpServers": {
"huanshenyi-mcp-server-bearer-auth": {
"url": "http://localhost:8787/sse"
}
}
}You deploy and run a remote MCP server on Cloudflare Workers that supports OAuth login, connect it with an MCP Inspector, and use it from MCP clients. This guide walks you through developing locally, connecting with clients, deploying, and debugging so you can securely access your MCP server from anywhere.
To use your remote MCP server with an MCP client, first run the server locally to develop and test. Then connect the MCP Inspector using SSE to the server’s /sse endpoint, which allows you to explore available tools and run them. When you deploy to Cloudflare, you’ll connect your client to the deployed worker endpoint and pass a bearer token for authentication. You can also connect Claude Desktop to your local or remote MCP server by pointing it at the server’s SSE URL and supplying an Authorization header.
Key steps you’ll perform as you work: start the server locally, connect the MCP Inspector to http://localhost:8787/sse, run the getToken tool to verify the Authorization header you set, and then use the inspector to list and run tools. When you’re ready, deploy to Cloudflare and connect your client to the deployed worker’s SSE endpoint, providing the same Authorization header as needed.
# prerequisites
- Ensure you have Node.js and npm installed
# clone the project
git clone [email protected]:cloudflare/ai.git
# install dependencies
cd ai
npm install
# run locally (development server for the remote MCP)
npx nx dev remote-mcp-server-bearer-auth
# you should be able to open http://localhost:8787/ in your browserDevelop locally by cloning the project, installing dependencies, and starting the remote MCP server component. The local development server runs on port 8787 and exposes a streaming endpoint at /sse for MCP clients to connect.
Connect the MCP Inspector to your server to explore capabilities: start the inspector, switch the Transport Type to SSE, and enter http://localhost:8787/sse as the URL. Add a bearer token and click Connect. From there you can click List Tools and run getToken to verify authentication headers.
Deploy to Cloudflare when you’re ready: run npm run deploy from the project root. After deployment, you’ll obtain a workers.dev URL for your deployed MCP server. Use this URL in the MCP Inspector as the server URL to connect remotely.
Debugging tips: if something goes wrong, you can restart the local server and try connecting directly from the command line using the MCP remote client, for example: npx mcp-remote http://localhost:8787/sse. If authentication files accumulate in your home directory, you can clear them with rm -rf ~/.mcp-auth.
Tool that returns the Authorization header you configured in the MCP Inspector to verify that authentication works end-to-end.