MCP Github OAuth

by conshus

Not rated
GitHub

About

An MCP server with built-in GitHub OAuth support, deployable on Cloudflare Workers.

Details

Author
conshus
Categories
Developer Tools, Security, Cloud Service, Infrastructure

Setup

Install MCP Github OAuth in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/conshus/mcp-github-oauth

Follow the installation instructions in the repository README, then restart your MCP client.

Model Context Protocol (MCP) Server + Github OAuth

This is aModel Context Protocol (MCP)server that supports remote MCP connections, with Github OAuth built-in.

You can deploy it to your own Cloudflare account, and after you create your own Github OAuth client app, you'll have a fully functional remote MCP server that you can build off. Users will be able to connect to your MCP server by signing in with their GitHub account.

You can use this as a reference example for how to integrate other OAuth providers with an MCP server deployed to Cloudflare, using theworkers-oauth-providerlibrary.

The MCP server (powered byCloudflare Workers):

- Acts as OAuthServerto your MCP clients
- Acts as OAuthClientto yourrealOAuth server (in this case, GitHub)

Clone the repo directly & install dependencies:npm install.

Alternatively, you can use the command line below to get the remote MCP Server created on your local machine:

npm create cloudflare@latest -- my-mcp-server --template=cloudflare/ai/demos/remote-mcp-github-oauth

- For the Homepage URL, specifyhttps://mcp-github-oauth.<your-subdomain>.workers.dev
- For the Authorization callback URL, specifyhttps://mcp-github-oauth.<your-subdomain>.workers.dev/callback
- Note your Client ID and generate a Client secret.
- Set secrets via Wrangler

- Create the KV namespace:wrangler kv:namespace create "OAUTH_KV"
- Update the Wrangler file with the KV ID

Deploy the MCP server to make it available on your workers.dev domainwrangler deploy

Test the remote server usingInspector:

npx @modelcontextprotocol/inspector@latest

Enterhttps://mcp-github-oauth.<your-subdomain>.workers.dev/sseand hit connect. Once you go through the authentication flow, you'll see the Tools working:

You now have a remote MCP server deployed!

This MCP server uses GitHub OAuth for authentication. All authenticated GitHub users can access basic tools like "add" and "userInfoOctokit".

The "generateImage" tool is restricted to specific GitHub users listed in theALLOWED_USERNAMESconfiguration:

// Add GitHub usernames for image generation access const ALLOWED_USERNAMES = new Set([ 'yourusername', 'teammate1' ]);

Access the remote MCP server from Claude Desktop

Open Claude Desktop and navigate to Settings -> Developer -> Edit Config. This opens the configuration file that controls which MCP servers Claude can access.

Replace the content with the following configuration. Once you restart Claude Desktop, a browser window will open showing your OAuth login page. Complete the authentication flow to grant Claude access to your MCP server. After you grant access, the tools will become available for you to use.

{ "mcpServers": { "math": { "command": "npx", "args": [ "mcp-remote", "https://mcp-github-oauth.<your-subdomain>.workers.dev/sse" ] } } }

Once the Tools (under 🔨) show up in the interface, you can ask Claude to use them. For example: "Could you use the math tool to add 23 and 19?". Claude should invoke the tool and show the result generated by the MCP server.

If you'd like to iterate and test your MCP server, you can do so in local development. This will require you to create another OAuth App on GitHub:

- For the Homepage URL, specifyhttp://localhost:8788
- For the Authorization callback URL, specifyhttp://localhost:8788/callback
- Note your Client ID and generate a Client secret.
- Create a.dev.varsfile in your project root with:

GITHUB_CLIENT_ID=your_development_github_client_id GITHUB_CLIENT_SECRET=your_development_github_client_secret

Run the server locally to make it available athttp://localhost:8788wrangler dev

To test the local server, enterhttp://localhost:8788/sseinto Inspector and hit connect. Once you follow the prompts, you'll be able to "List Tools".

When using Claude to connect to your remote MCP server, you may see some error messages. This is because Claude Desktop doesn't yet support remote MCP servers, so it sometimes gets confused. To verify whether the MCP server is connected, hover over the 🔨 icon in the bottom right corner of Claude's interface. You should see your tools available there.

To connect Cursor with your MCP server, chooseType: "Command" and in theCommandfield, combine the command and args fields into one (e.g.npx mcp-remote https://<your-worker-name>.<your-subdomain>.workers.dev/sse).

Note that while Cursor supports HTTP+SSE servers, it doesn't support authentication, so you still need to usemcp-remote(and to use a STDIO server, not an HTTP one).

You can connect your MCP server to other MCP clients like Windsurf by opening the client's configuration file, adding the same JSON that was used for the Claude setup, and restarting the MCP client.

The OAuth Provider library serves as a complete OAuth 2.1 server implementation for Cloudflare Workers. It handles the complexities of the OAuth flow, including token issuance, validation, and management. In this project, it plays the dual role of:

- Authenticating MCP clients that connect to your server
- Managing the connection to GitHub's OAuth services
- Securely storing tokens and authentication state in KV storage

Durable MCP extends the base MCP functionality with Cloudflare's Durable Objects, providing:

- Persistent state management for your MCP server
- Secure storage of authentication context between requests
- Access to authenticated user information viathis.props
- Support for conditional tool availability based on user identity

The MCP Remote library enables your server to expose tools that can be invoked by MCP clients like the Inspector. It:

- Defines the protocol for communication between clients and your server
- Provides a structured way to define tools
- Handles serialization and deserialization of requests and responses
- Maintains the Server-Sent Events (SSE) connection between clients and your server

This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.

An MCP server with built-in GitHub OAuth support, designed for deployment on Cloudflare Workers.

An MCP server deployable on Cloudflare Workers with OAuth login support.

A production-ready MCP server on Cloudflare Workers with GitHub OAuth and Fantasy Premier League integration.

A self-hostable MCP server for Cloudflare Workers with OAuth login support, using Cloudflare KV for storage.

An MCP server designed to run on Cloudflare Workers, featuring OAuth login support.

A remote MCP server that runs on Cloudflare Workers and supports OAuth login.

A remote MCP server running on Cloudflare Workers with OAuth login support.

A remote MCP server deployable on Cloudflare Workers with OAuth login support, using Cloudflare KV for data storage.

A remote MCP server deployable on Cloudflare Workers with OAuth login support, using Cloudflare KV for data storage.

A remote MCP server deployable on Cloudflare Workers with OAuth login support, using Cloudflare KV for data storage.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.