Skip to content

amxv/mcp-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub MCP Server in Go for Vercel

This project is a minimal GitHub-backed Model Context Protocol (MCP) server written in Go and designed for Vercel's Go runtime.

It uses:

  • the official Go MCP SDK for Streamable HTTP transport
  • GitHub's REST API via go-github
  • a stateless MCP endpoint at /mcp, which is the simplest fit for Vercel's serverless model

Why this is the fastest viable approach

If you only need GitHub inside an MCP host, the absolute fastest option is GitHub's hosted remote MCP server:

  • https://api.githubcopilot.com/mcp/

But if you want your own server in Go and want to deploy it on Vercel, the shortest path is:

  1. Use the official MCP Go SDK.
  2. Serve MCP over Streamable HTTP instead of stdio.
  3. Run the handler in stateless mode so it works cleanly on Vercel.
  4. Use a single GitHub token from GITHUB_TOKEN.

Exposed tools

  • github_get_authenticated_user
  • github_list_repositories
  • github_get_repository
  • github_search_repositories
  • github_search_code
  • github_search_commits
  • github_list_organization_repositories
  • github_list_repository_branches
  • github_get_file
  • github_create_issue
  • github_list_issues
  • github_get_issue
  • github_add_issue_comment
  • github_list_pull_requests
  • github_get_pull_request
  • github_create_branch
  • github_upsert_file

That gives you a useful first slice quickly, including repository discovery, code and commit search, metadata lookups, issue and pull request workflows, and repository write operations. The search tools are especially useful for agents that need to find code before fetching specific files, while the write-oriented tools let an MCP client create a working branch and then commit file changes through the same GitHub token. You can add more tools with the same pattern.

Local development

Set your token:

export GITHUB_TOKEN=ghp_your_token_here
export MCP_API_KEY=replace_with_a_long_random_value

Run locally:

go run .

The server listens on http://localhost:3000 by default.

Health check:

curl http://localhost:3000/healthz

Sample authenticated MCP request:

curl -X POST http://localhost:3000/mcp \
  -H "Authorization: Bearer $MCP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

Equivalent query-parameter form:

curl -X POST "http://localhost:3000/mcp?api_key=$MCP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

MCP endpoint

The MCP endpoint is:

POST /mcp

/mcp requires an API key via either:

Authorization: Bearer <MCP_API_KEY>

or:

?api_key=<MCP_API_KEY>

The server will fail to start unless MCP_API_KEY is set.

This server uses stateless Streamable HTTP. That is intentional for Vercel compatibility.

Deploy to Vercel

  1. Push this repo to GitHub.
  2. Import it into Vercel.
  3. Add the environment variables GITHUB_TOKEN and MCP_API_KEY.
  4. Deploy.

The Vercel Go preset is selected in vercel.json, and Vercel will detect the root go.mod and main.go.

Notes

  • Use a fine-grained token if possible.
  • For read-only usage, remove the write tools (github_create_issue, github_add_issue_comment, github_create_branch, github_upsert_file) or use a token without write permissions.
  • Some MCP clients still assume stateful SSE behavior. For a Vercel-hosted Go server, stateless Streamable HTTP is the safer deployment model.
  • This project is licensed under Apache 2.0. See LICENSE.

About

ready to deploy code search mcp on your github

Topics

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages