mcp_oauth_server_web
This project implements a Streamable HTTP MCP Server with browser-based OAuth for GitHub.
Implementing Streamable HTTP MCP Server with Browser-based OAuth
Overview
The purpose of this project is to support MCP Client requested authorization through the MCP Server. This requires implementing a custom OAuthProvider for GitHub.
As such, this project provides:
- An StreamableHTTP Server
- Browser-based client authorization using GitHub's OAuth
- Handling authorized client requests
High-level Execution Flow
The flow proceeds as follows:
- The client sends POST request to /mcp endpoint.
- The server verifies the access token included in the Authorization header. If it's expired (or not recognized), server returns an error. If the access token is valid, the server proceeds to the next step.
- If the client request contains a valid sessionId, the server uses an existing transport connection. If not, it creates a transport connection with a new sessionId. The server uses the transport connection to handle the request.
Authorization
The server receives client requests for authorization through the /authorize
and /token
endpoints. These are supported through a class that implements the OAuthServerProvider.
For requests to the /authorize
endpoint, the server auth provider:
- Generates the PKCE verifier and challenge
- Redirects to the GitHub OAuth endpoint (GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET env variables must be set)
- As part of the callback,
- uses the code returned in callback to fetche its access token from GitHub
- stores this access token along with the clientId
- generates a new auth code and returns this to the client
When the client hits the /token
endpoint with this auth code, the server provides the client it's own access token.
How to use
- Clone this repository
- Install the dependencies
npm install
- Go to your Developer Settings on GitHub (under Settings) and create an OAuth app. Note the Client ID and Client Secret.
- Set the GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET environment variables in your local dev environment.
- Start the MCP Server
npx tsx server/index_streamable.ts
Related MCP Servers
View all browser_automation servers →Fetch
by modelcontextprotocol
A Model Context Protocol server that provides web content fetching capabilities, enabling LLMs to retrieve and process content from web pages.
markdownify-mcp
by zcaceres
Markdownify is a Model Context Protocol (MCP) server that converts various file types and web content to Markdown format.
mcp-playwright
by executeautomation
A Model Context Protocol server that provides browser automation capabilities using Playwright.
web-eval-agent
by Operative-Sh
operative.sh's MCP Server is a tool for autonomous debugging of web applications directly from your code editor.
cursor-talk-to-figma-mcp
by sonnylazuardi
This project implements a Model Context Protocol (MCP) integration between Cursor AI and Figma, allowing Cursor to communicate with Figma for reading designs and modifying them programmatically.
ai-agent-marketplace-index-mcp
by AI-Agent-Hub
MCP Server for AI Agent Marketplace Index from DeepNLP, allowing AI assistants to search available AI agents by keywords or categories.
playwright-mcp
by microsoft
Playwright MCP is a Model Context Protocol server that provides browser automation capabilities using Playwright, enabling LLMs to interact with web pages through structured accessibility snapshots.