Sandbox
@achetronic/mcp-forge

Go MCP server template with OAuth and JWT

MCP Forge gives you a starting point for building an MCP server in Go. It wires in OAuth RFC 8414 and RFC 9728 support, several JWT validation paths, and example transports for HTTP and stdio.

97 starsβ€’33 forksβ€’Goβ€’Updated 7mo ago
Who it's for

Builders who want to ship an MCP server with auth, transport, and deployment pieces already scaffolded.

What it delivers

You can start from a working MCP server template instead of assembling auth, transport, and deployment from scratch.

What it does

OAuth endpoints

Provides configurable `.well-known/oauth-protected-resource` and `.well-known/oauth-authorization-server` endpoints.

JWT validation options

Supports JWT checks through an external proxy such as Istio or local validation with JWKS and CEL claim rules.

HTTP and stdio transport

Includes configs for running the server over HTTP or as a local stdio process for desktop clients.

Production scaffolding

Ships with a Dockerfile, Helm chart, GitHub Actions workflow, and example configs.

Tool extension point

Points builders to `internal/tools` as the main place to add MCP tools and their logic.

How to get it

  1. 1Execute the following before configuring the client
    make build
  2. 2Execute the following before configuring the client
    npm i mcp-remote && \
    make run

README

MCP Forge

GitHub go.mod Go version (subdirectory of monorepo) GitHub

YouTube Channel Subscribers GitHub followers X (formerly Twitter) Follow

A production-ready MCP (Model Context Protocol) server template (oauth authorization included) built in Go that works with major AI providers.

Motivation

The MCP specification is relatively new and lacks comprehensive documentation for building complete servers in Go. This template provides a fully compliant MCP server that integrates seamlessly with remote providers like Claude Web, and OpenAI, but with local providers like Claude Desktop too.

Features

  • πŸ” OAuth RFC 8414 and RFC 9728 compliant

    • Support for .well-known/oauth-protected-resource and .well-known/oauth-authorization-server endpoints
    • Both endpoints are configurable
  • πŸ›‘οΈ Several JWT validation methods

    • Delegated to external systems like Istio
    • Locally validated based on JWKS URI and CEL expressions for claims
  • πŸ“‹ Access logs can exclude or redact fields

  • πŸš€ Production-ready: Included full examples, Dockerfile, Helm Chart and GitHub Actions for CI

  • ⚑ Super easy to extend: Production vitamins added to a good juice: mcp-go

Deployment

Production πŸš€

Deploy to Kubernetes using the Helm chart located in the chart/ directory.


Our recommendations for remote servers in production:

  • Use a consistent hashring HTTP proxy in front of your MCP server when using MCP Sessions

  • Use an HTTP proxy that performs JWT validation in front of the MCP instead of using the included middleware:

    • Protect your MCP exactly in the same way our middleware does, but with a super tested and scalable proxy instead
    • Improve your development experience as you don't have to do anything, just develop your MCP tools
  • Use an OIDP that:

    • Cover Oauth Dynamic Client Registration
    • Is able to custom your JWT claims.

πŸ‘‰ Keycloak covers everything you need in the Oauth2 side

πŸ‘‰ Istio covers all you need to validate the JWT in front of your MCP

πŸ‘‰ Hashrouter uses a configurable and truly consistent hashring to route the traffic, so your sessions are safe with it. It has been tested under heavy load in production scenarios

How to develop your MCP

Prerequisites

  • Go 1.24+

Modify the code and run

Obviously, you can modify the entire codebase as this is a template, but:

  • Most times, you will only need to code inside internal/tools directory to add your MCP Tools and their logic
  • Sometimes, you will need to add your MCP Resources. For that, it's recommended:
    • To clone internal/tools directory into internal/resources and rename the structures there
    • To add the missing logic in cmd/main.go for invoking your code

Run: make run

Note: Default YAML config executing the previous command start the server as an HTTP server. To start it as Stdio mode, just modify the Makefile to use other YAML provided in examples.

Configuration Examples

πŸ”— Remote Clients (Claude Web, OpenAI)

Remote clients like Claude Web have different requirements than local ones. This project is fully ready for dealing with Claude Web with zero effort in your side.

In general, if you follow our recommendations on production, all the remote clients are covered 😊

[!NOTE]
Hey! look at the configuration here

πŸ’» Local Clients (Claude Desktop, Cursor, VSCode)

Local clients configuration is commonly based in a JSON file with a specific standard structure. For example, Claude Desktop can be configured by modifying the settings file called claude_desktop_config.json with the following sections:

Stdio Mode

If you want to use stdio as transport layer, it's recommended to compile your Go binary and then configure the client as follows. This is recommended in local development as it is easy to work with.

Execute the following before configuring the client:

make build

[!IMPORTANT] When using Stdio transport, there is no protection between your client and the server, as they are both running locally

// file: claude_desktop_config.json

{
  "mcpServers": {
    "stdio": {
      "command": "/home/example/mcp-forge/bin/mcp-forge-linux-amd64",
      "args": [
        "--config",
        "/home/example/mcp-forge/docs/config-stdio.yaml"
      ]
    }
  }
}
HTTP Mode

It is possible to launch your MCP server using HTTP transport. As most of local clients doesn't support connecting to remote servers natively, we use a package (mcp-remote) to act as an intermediate between the expected stdio, and the remote server, which is launched locally too.

This is ideal to work on all the features that will be deployed in production, as everything related to how remote clients will behave later is available, so everything can be truly tested

Execute the following before configuring the client:

npm i mcp-remote && \
make run
// file: claude_desktop_config.json

{
 "mcpServers": {
   "local-proxy-remote": {
     "command": "npx",
     "args": [
       "mcp-remote",
       "http://localhost:8080/mcp",
       "--transport",
       "http-only",
       "--header",
       "Authorization: Bearer ${JWT}",
       "--header",
       "X-Validated-Jwt: ${JWT}"
     ],
     "env": {
       "JWT": "eyJhbGciOiJSUzI1NiIsImtpZCI6..."
     }
   }
 }
}

🌐 Documentation

Do you feel for reading about this topic? I gave you the advice, then don't complain:

πŸ‘‰ MCP Authorization Requirements

πŸ‘‰ RFC 9728

πŸ‘‰ MCP Go Documentation

πŸ‘‰ mcp-remote package

🀝 Contributing

All contributions are welcome! Whether you're reporting bugs, suggesting features, or submitting code β€” thank you! Here’s how to get involved:

β–Έ Open an issue to report bugs or request features

β–Έ Submit a pull request to contribute improvements

πŸ“„ License

MCP Forge is licensed under the Apache 2.0 License.

Files in the repo

Repository payloadβ€’13 top-level entries
  • .github
  • api
  • chart
  • cmd
  • docs
  • internal
  • .gitignore
  • Dockerfile
  • go.mod
  • go.sum
  • LICENSE
  • Makefile
  • README.md

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More templates

CopilotKit/
OpenBot

Open-source AI coworkers that each get a computer of their own: a browser, files and tools, with every action decided before it happens and recorded after. Bring any AG-UI agent.

4.6k
Donchitos/
Claude-Code-Game-Studios

Turn Claude Code into a full game dev studio β€” 49 AI agents, 72 workflow skills, and a complete coordination system mirroring real studio hierarchy.

25k

A self-organizing Obsidian vault that gives AI coding agents persistent memory. Claude Code, Codex CLI, Gemini CLI.

4.6k
idavidov13/
agentic-playwright

Production-grade Playwright + TypeScript Scaffold for Agentic Testing. Harness for all major AI coding agents baked in.

163
gavishap/
omnia-vault

Omnia Vault - the all-in-one project brain: an Obsidian LLM wiki, Graphify code graphs, a living plan that triages new videos against itself, and a Claude Code ⇄ Codex relay. Everything your project knows, in one clonable vault.

60

🎬 TαΊ‘o video "so sΓ‘nh kiαΊΏn thα»©c" ngαΊ―n tα»± Δ‘α»™ng β€” HyperFrames + AI voice, 1 template nhiều chα»§ đề.

169