ivannafigueroa/remote-mcp-server
If you are the rightful owner of remote-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
A production-ready remote MCP server deployed on Cloudflare Workers, featuring a greeting tool and web search functionality.
Remote 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 git@github.com: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:5173
in your browser - Configure the connection:
- Set Transport Type to
SSE
- Enter
http://localhost:8787/sse
as 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