Skip to content

Conversation

@atharva1051
Copy link

Summary

Adds HTTP server mode enabling multi-tenant deployments where each client provides their own GitHub token via Authorization: Bearer <token> header.

Why

Enterprise scenarios require centralized MCP infrastructure serving multiple authenticated clients concurrently, which stdio mode's single-token-per-process model cannot support.

What changed

  • Added http subcommand with --port flag (default 8080)
  • Implemented RunHTTPServer() using MCP SDK's StreamableHTTPHandler
  • Per-request token extraction from Authorization header
  • HTTPServerConfig struct for HTTP-specific configuration
  • Exposed port 8080 in Dockerfile
  • Comprehensive documentation: VS Code/Claude Desktop configs, Docker deployment, GHES/GHEC support, security considerations

MCP impact

  • No tool or API changes

HTTP mode uses existing tools—only the transport and authentication model changed.

Prompts tested (tool changes only)

N/A

Security / limits

  • Auth / permissions considered

Tokens validated per-request, never stored. Each client's token creates isolated server instance with their permissions. Token scope filtering applied for PAT tokens.

Tool renaming

  • I am not renaming tools as part of this PR

Lint & tests

  • Linted locally with ./script/lint
  • Tested locally with ./script/test

Docs

  • Updated (README / docs / examples)

Added HTTP mode section to README with client configuration examples (VS Code, Claude Desktop), Docker deployment patterns (basic, production with docker-compose), and troubleshooting guide.

Original prompt

Summary of HTTP Mode Changes

This PR adds HTTP server mode to the GitHub MCP Server, allowing it to serve multiple clients concurrently. Here are the key changes:

Core Functionality Added

1. New HTTP Command (main.go)

  • Added http subcommand to start the server in HTTP mode
  • Default port: 8080 (configurable via --port flag)
  • Example: github-mcp-server http --port 8080

2. "Bring Your Own Token" Support (server.go)

  • Clients can provide their own GitHub token via the Authorization: Bearer <token> header
  • Modified getClient() and getGQLClient() to extract tokens from request context
  • Enables multi-tenant deployments with per-user authentication

3. HTTP Server Implementation (server.go)

  • New HTTPServerConfig struct with configuration options
  • New RunHTTPServer() function that:
    • Creates streamable HTTP server with heartbeat (30s intervals)
    • Supports graceful shutdown on SIGTERM/SIGINT
    • Optional logging to file via logrus
    • Extracts tokens from Authorization headers via extractTokenFromAuthHeader()

4. Infrastructure Changes

  • Dockerfile: Added EXPOSE 8080
  • go.mod: Added logrus dependency for HTTP server logging
  • README.md: Comprehensive documentation on HTTP mode usage, Docker deployment, and OAuth flows

Changes Needed to Enable HTTP Mode

To use HTTP mode, you need:

  1. Start with HTTP command: github-mcp-server http --port 8080
  2. Clients: Send requests with Authorization: Bearer <github-token> header for per-user auth
  3. Docker: Expose port 8080 (-p 8080:8080)

This enables enterprise scenarios with centralized MCP infrastructure serving multiple authenticated clients.

add documentation how the header would be added from vscode and other clients too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant