A self-hosted GitHub MCP (Model Context Protocol) server you deploy to your own Vercel project. Connects to Claude.ai as a custom connector — no more pasting tokens in chat.
Claude.ai has MCP connectors for Supabase and Vercel. GitHub doesn't have one for the web interface. This fills that gap.
Your GitHub PAT lives in a Vercel environment variable. The MCP server reads it at runtime. Claude.ai connects to the server as a custom connector. You never paste a token in chat again.
Six tools available to Claude:
| Tool | Description |
|---|---|
git_read |
Read a file or list a directory |
git_push |
Create or update a file with a commit |
git_push_multi |
Commit multiple files atomically |
git_log |
Recent commit history |
git_list_branches |
List all branches |
git_create_branch |
Create a branch from any ref |
In your existing Next.js project on Vercel:
npm install mcp-handler @octokit/rest zodCopy src/app/api/mcp/[transport]/route.ts from this repo into your project at the same path.
Edit the committer object in git_push and git_push_multi to use your git identity:
committer: {
name: "your-github-username",
email: "your-username@users.noreply.github.com",
},If your app has auth middleware or a proxy that protects routes, add /api/mcp to the public/unauthenticated paths. The MCP transport handles its own connection model — it doesn't need your app's auth.
Example for a Next.js middleware:
// In your middleware or proxy config
const publicPaths = ["/api/mcp"];In your Vercel project settings → Environment Variables:
- Key:
GITHUB_PAT - Value: Your fine-grained GitHub PAT with repo access
- Environments: Production, Preview, Development
The PAT never touches your code.
Push the code. Vercel deploys.
Settings → Connectors → Add custom connector:
https://yourdomain.com/api/mcp/mcp
The double /mcp is intentional — first segment is the route path, second is the MCP transport endpoint.
Done. Claude can now read, write, branch, and view history across all repos your PAT has access to.
When you need to rotate the PAT:
- Create a new PAT on GitHub
- Update the
GITHUB_PATenv var in Vercel - Redeploy (or wait for next deploy)
No code changes. No chat exposure. No ceremony.
This pattern should also work with Supabase Edge Functions (Deno runtime) using the same mcp-handler package, though this hasn't been tested. The core approach is identical — read credentials from environment variables, expose tools via MCP, deploy to your existing infrastructure.
The server uses mcp-handler to bridge the MCP protocol to a Next.js API route, and @octokit/rest for GitHub API calls. Each tool is a thin wrapper: validate input with Zod, call Octokit, return the result.
The server is stateless. It reads GITHUB_PAT from process.env on every request. It costs nothing beyond your existing Vercel hosting.
This isn't just a GitHub connector — it's a pattern. Any service with an API and an SDK can become an MCP server in under 100 lines:
- Install
mcp-handler+ the service's SDK - Create the catch-all route at
api/mcp/[transport]/route.ts - Define tools with Zod schemas that delegate to the SDK
- Store the credential as an env var
- Deploy and connect
MIT