About remote-mcp-server
A remote MCP server example deployed on Cloudflare Workers for users building custom tools for AI assistants such as Cursor and Claude Desktop. It combines OAuth authentication with greeting and real-time web search tools, and includes local development and deployment guidance.
Key features
- 01Remote deployment on Cloudflare Workers
- 02OAuth authentication
- 03Personalized greeting tool
- 04Real-time web search
- 05MCP Inspector support
Use cases
- 01Have an AI assistant greet a named person
- 02Search the web for current information through an AI assistant
- 03Deploy an MCP server on Cloudflare Workers
MCP support
The server exposes greeting and web search tools to MCP clients and accepts connections through an SSE endpoint.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMERemote MCP Server with Web Search on Cloudflare
A production-ready remote MCP (Model Context Protocol) server deployed on Cloudflare Workers that implements a greeting tool and web search functionality. This server demonstrates how to build and deploy custom tools that can be used by AI assistants like Cursor and Claude Desktop.
Overview
This project serves as a reference implementation for:
- Building custom MCP servers
- Implementing OAuth authentication
- Deploying MCP servers to Cloudflare Workers
- Connecting AI assistants to custom tools
- Integrating web search capabilities
Features
- 🚀 Remote MCP server deployed on Cloudflare Workers
- 🔐 OAuth authentication for secure access
- 👋 Simple greeting tool for testing MCP functionality
- 🔍 Web search tool for real-time information retrieval
- 🤖 Compatible with Cursor and Claude Desktop
- 📊 Built-in MCP Inspector support
- 📦 Easy local development setup
- 🛠️ Production-ready deployment configuration
Prerequisites
- Node.js 18 or later
- pnpm package manager
- Cloudflare account (for deployment)
- Git
- API key for web search service (optional)
Local Development
- Clone the repository:
# Using HTTPS
git clone https://github.com/cloudflare/ai.git
# Or using SSH
git clone [email protected]:cloudflare/ai.git
- Install dependencies:
cd ai
pnpm install
- Configure environment variables (optional):
# Create a .env file
cp .env.example .env
# Add your web search API key if needed
WEB_SEARCH_API_KEY=your_api_key_here
- Start the development server:
npx nx dev remote-mcp-server
The server will be available at http://localhost:8787/
Integration Guide
Connecting to Cursor
- Open Cursor and navigate to Settings > AI Settings
- In the MCP Configuration section, add:
{
"mcpServers": {
"greeting": {
"command": "npx",
"args": [
"mcp-remote",
"http://localhost:8787/sse"
]
},
"webSearch": {
"command": "npx",
"args": [
"mcp-remote",
"http://localhost:8787/sse"
]
}
}
}
- Restart Cursor
- When prompted, log in with any email and password (mock authentication for testing)
- Test the tools by:
- Asking Cursor to greet someone
- Requesting web search results for a query
Connecting to Claude Desktop
- Open Claude Desktop and go to Settings > Developer > Edit Config
- Add the following configuration:
{
"mcpServers": {
"greeting": {
"command": "npx",
"args": [
"mcp-remote",
"http://localhost:8787/sse"
]
},
"webSearch": {
"command": "npx",
"args": [
"mcp-remote",
"http://localhost:8787/sse"
]
}
}
}
- Restart Claude Desktop
- Log in with any email and password
- Test the tools by:
- Asking Claude to greet someone
- Requesting web search results for a query
Testing with MCP Inspector
- Start the inspector:
npx @modelcontextprotocol/inspector
- Open
http://localhost:5173in your browser - Configure the connection:
- Set Transport Type to
SSE - Enter
http://localhost:8787/sseas the MCP server URL - Click "Connect"
- Set Transport Type to
- Log in with any email and password
- Test both tools:
- Use the greeting tool to send a greeting
- Use the web search tool to search for information
Available Tools
Greeting Tool
- Simple tool that generates personalized greetings
- Usage: Ask the AI to greet someone by name
- Example: "Please greet John"
Web Search Tool
- Performs real-time web searches
- Returns relevant search results
- Usage: Ask the AI to search for information
- Example: "Search for the latest news about AI"
Deployment
Deploying to Cloudflare
- Create a KV namespace:
npx wrangler kv namespace create OAUTH_KV
- Add the KV namespace ID to
wrangler.jsonc - Configure environment variables in Cloudflare:
- Go to Workers > Your Worker > Settings > Variables
- Add your web search API key if needed
- Deploy to Cloudflare:
npm run deploy
Connecting to the Deployed Server
Update your configuration in Cursor or Claude Desktop to use your worker's URL:
{
"mcpServers": {
"greeting": {
"command": "npx",
"args": [
"mcp-remote",
"https://your-worker-name.your-account.workers.dev/sse"
]
},
"webSearch": {
"command": "npx",
"args": [
"mcp-remote",
"https://your-worker-name.your-account.workers.dev/sse"
]
}
}
}
Troubleshooting
Common Issues
-
Connection Issues
- Verify the server is running locally
- Check if the port 8787 is available
- Ensure your firewall isn't blocking the connection
-
Authentication Problems
- Clear the auth files:
rm -rf ~/.mcp-auth- Restart the application
- Try logging in again
-
Tool Not Working
- Verify the configuration is correct
- Check the browser console for errors
- Review server logs for any issues
-
Web Search Issues
- Verify your API key is correctly configured
- Check if you've reached API rate limits
- Ensure your search query is properly formatted
Debugging
- Test the connection directly:
npx mcp-remote http://localhost:8787/sse
- Check server logs:
npx wrangler tail
- Monitor web search requests:
npx wrangler tail --format=pretty
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
If you encounter any issues or have questions:
- Open an issue on GitHub
- Check the Cloudflare Workers documentation
- Review the MCP specification
- Consult the Web Search API documentation
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.