Deploy a Cloudflare MCP server with GitHub OAuth integration for secure remote connections and tool access.
The Model Context Protocol (MCP) Github OAuth Server is an advanced solution designed to facilitate secure, seamless remote connections and data exchanges between AI applications like Claude Desktop, Continue, Cursor, and more. By leveraging the power of GitHub OAuth, this server allows users to connect via their GitHub accounts, ensuring a robust security framework for both authentication and authorization.
This MCP Github OAuth Server offers essential features that are pivotal for AI application integration:
OAuth 2.1 Implementation: The server integrates Cloudflare Workers with the workers-oauth-provider
library to handle OAuth flows, making it compatible with various OAuth providers including GitHub.
Persistent State Management: Utilizing Durable Objects provided by Cloudflare's Workers infrastructure, this server ensures persistent state management and secure storage of authentication context between requests, enhancing user experience and security.
MCP Server Functionality: This server extends the base MCP protocol to support remote connections with AI applications. It acts as both an OAuth Client (to GitHub) and an OAuth Server to MCP clients, ensuring seamless data flow and tool execution.
Conditional Tool Availability: Based on user identity, certain tools can be restricted or allowed, providing granular control over which features are accessible to specific users.
Real-Time Communication: The implementation of the MCP Remote
library enables real-time communication via Server-Sent Events (SSE), allowing seamless interaction between clients and the server during workflow processes.
The architecture of the MCP Github OAuth Server is designed to handle complex interactions between AI applications, data sources, and user authentication securely. Key components include:
OAuth Provider: A comprehensive library that handles all aspects of the OAuth flow, including token issuance, validation, and management.
Durable MCP: Extends the base MCP functionality by providing persistent state management, secure authentication context storage, access to authenticated user information via this.props
, and conditional tool availability.
MCP Remote: Enables structured communication between clients and servers, defining tools, handling serialization/deserialization, and maintaining SSE connections.
To deploy the MCP Github OAuth Server, follow these steps:
Clone the repository and install dependencies:
git clone [repository-url]
npm install
Deploy it to your Cloudflare account using Wrangler commands:
npm create cloudflare@latest -- my-mcp-server --template=cloudflare/ai/demos/remote-mcp-github-oauth
Set up the necessary secrets and KV namespace in Wrangler:
wrangler secret put GITHUB_CLIENT_ID
wrangler secret put GITHUB_CLIENT_SECRET
wrangler secret put COOKIE_ENCRYPTION_KEY # add any random string here e.g. openssl rand -hex 32
Create a new GitHub OAuth App with the appropriate URLs and save the Client ID and Secret.
Deploy and test using Inspector:
npm install @modelcontextprotocol/inspector@latest
npx @modelcontextprotocol/inspector@latest -e https://mcp-github-oauth.<your-subdomain>.workers.dev/sse
Data Retrieval and Analysis:
A user logs into Claude Desktop, which connects to the MCP Github OAuth Server through GitHub. The server retrieves data from a specific data source, processes it, and sends real-time updates via SSE back to the client for analysis.
Custom Tool Execution:
A model developer uses Continue to define custom tools that perform complex calculations or generate images based on user input. These tools run on the MCP Github OAuth Server, providing results in real-time to the client via MCP Remote.
The compatibility matrix for this server is as follows:
MCP Client | Resources | Tools | Prompts |
---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ |
Continue | ✅ | ✅ | ✅ |
Cursor | ❌ | ✅ | ❌ |
This section outlines the performance and compatibility of the MCP Github OAuth Server with different tools, ensuring that users can connect to various AI applications without encountering issues.
For advanced configuration and security measures:
Restrict Tool Access: Define allowed user names for accessing specific tools.
const ALLOWED_USERNAMES = new Set([
'yourusername',
'teammate1'
]);
Use Custom Secrets: Set secrets via Wrangler to secure the environment.
wrangler secret put GITHUB_CLIENT_ID
wrangler secret put GITHUB_CLIENT_SECRET
How do I integrate my own OAuth provider with this server?
workers-oauth-provider
.Can I use the same server for multiple MCP clients?
What tools are currently supported?
How do I handle tool restrictions during authentication?
ALLOWED_USERNAMES
within the server's configuration file.Are there any known issues with GPU acceleration support?
Developers are welcome to contribute by:
Explore additional resources for working with MCP servers and clients:
graph TD
A[AI Application] -->|MCP Client| B[MCP Protocol]
B --> C[MCP Server]
C --> D[Data Source/Tool]
style A fill:#e1f5fe
style C fill:#f3e5f5
style D fill:#e8f5e8
MCP Client | Resources | Tools | Prompts | Status |
---|---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ | Full Support |
Continue | ✅ | ✅ | ✅ | Full Support |
Cursor | ❌ | ✅ | ❌ | Tools Only |
{
"mcpServers": {
"[server-name]": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-[name]"],
"env": {
"API_KEY": "your-api-key"
}
}
}
}
This comprehensive documentation provides a detailed guide for developers looking to enhance their AI applications through effective MCP integration.
AI Vision MCP Server offers AI-powered visual analysis, screenshots, and report generation for MCP-compatible AI assistants
Analyze search intent with MCP API for SEO insights and keyword categorization
Learn how to use MCProto Ruby gem to create and chain MCP servers for custom solutions
Next-generation MCP server enhances documentation analysis with AI-powered neural processing and multi-language support
Expose Chicago Public Schools data with a local MCP server accessing SQLite and LanceDB databases
Connects n8n workflows to MCP servers for AI tool integration and data access