gopher MCP server
Commit Oct 30, 2026Lets developers build MCP servers and clients in C++, with C API bindings for Python, TypeScript, Go, Rust, Java, and C#.
Also known as GopherSecurity/gopher-mcp
- Stars
- 155
- Tools
- ā
- Downloads, 30 days
- ā
- Latest version
- ā
- Last commit
- Oct 30, 2026
- License
- Apache-2.0
What is gopher MCP?
gopher lets developers build MCP servers and clients in C++, with C API bindings for Python, TypeScript, Go, Rust, Java, and C#.
Summary generated from the project's README
About gopher MCP server
Building high-performance AI-powered applications using the Model Context Protocol is possible through this C++ SDK. It provides a production-ready implementation for developers working on embedded systems, IoT devices, game engines, or low-latency backend services. The SDK supports multiple transport methods including stdio, WebSocket, TCP, and HTTP with SSE, allowing for flexible connectivity between AI models and external data sources.
Developers can integrate this technology into various environments using a stable C API that provides bindings for Python, TypeScript, Go, Rust, Java, C#, and Ruby. The architecture features a modular filter chain for request processing and includes enterprise-grade reliability tools like circuit breakers, rate limiting, and connection pooling. It is designed for high-performance scenarios requiring zero-copy buffers and lock-free operations to maintain speed while managing complex AI tool interactions.
What you can do with it
- 1Implement low-latency AI servicesBuild backend services that require high-speed communication with AI models using zero-copy buffers.
- 2Deploy AI on edge devicesRun Model Context Protocol implementations on resource-constrained hardware like IoT devices.
- 3Manage reliable AI connectionsProtect your AI infrastructure from overload using built-in rate limiting and circuit breakers.
Written from the project's README. Every use case is checked against a quote from it.
Automated checks
Ran Nov 14, 2026Full report āNot verified yet. A server needs a score of 80, no serious finding, and enough data for us to check. How checks work Ā· What to fix for more points
- Source repository linked and reachablegophersecurity/gopher-mcp is public and reachablegithub.com/gophersecurity/gopher-mcp āPass
- Package names this repository as its sourceNot checked
- Build provenance (Sigstore attestation)Not checked
- Open source license (OSI)Apache-2.0spdx.org/licenses/Apache-2.0.html āPass
- Commit or release in the last yearLast commit or release 2026-10-30github.com/gophersecurity/gopher-mcp āPass
- OpenSSF ScorecardNot checked
- Package name not close to a popular packageNot checked
- No critical advisory in the package or its dependenciesNot checked
- No hidden instructions to the model0 tool descriptions and the README read; no override phrases, credential paths or hidden charactersPass
- Destructive tools are labelledNot checked
- Remote endpoint answers the MCP handshakeNot checked
README
View on GitHubMCP C++ SDK - Model Context Protocol Implementation for C++
The most comprehensive C++ implementation of the Model Context Protocol (MCP) for building AI-powered applications. Production-ready SDK with enterprise features including multi-transport support, connection pooling, and multi-language bindings via C API (Python, TypeScript, Go, Rust, Java, C#, Ruby and more).
ā Please give a star if you find this useful!
Table of Contents
- Architecture Overview
- Cross-Language Support
- What is MCP?
- Features
- Quick Start
- Examples
- Installation
- Documentation
- Comparison with Other C++ MCP SDKs
- FAQ
- Adopters
- Contributing
- License
Architecture Overview
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā Application Layer ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā MCP Server ā MCP Client ā Custom Applications ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā Cross-Language Binding Layer ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā Python ā TypeScript ā Go ā Rust ā Java ā C# ā Ruby ā Swift ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā C API (FFI Layer) ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā libgopher_mcp_c: Opaque Handles ā RAII Guards ā Type Safety ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā Protocol Layer ā
ā āāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāā āāāāāāāāāāāāāā ā
ā ā JSON-RPC ā ā Requests ā ā Responses ā ā Notify ā ā
ā ā Codec ā ā Dispatch ā ā Routing ā ā Stream ā ā
ā āāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāā āāāāāāāāāāāāāā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā Filter Chain Layer ā
ā āāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāā āāāāāāāāāāāāāā ā
ā ā HTTP / SSE ā ā Routing ā ā Rate Limiter ā ā Auth ā ā
ā ā Codecs ā ā & CORS ā ā Circuit Brk ā ā Metrics ā ā
ā āāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāā āāāāāāāāāāāāāā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā Transport Layer ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā Stdio ā HTTP(S)+SSE ā Streamable HTTP ā WebSocket ā TCP ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā Network Layer ā
ā āāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāā ā
ā ā Connection ā ā Listener ā ā Socket ā ā
ā ā Management ā ā & Accept ā ā Interface ā ā
ā āāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā Event Loop & Dispatcher ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā Libevent ā Timer Management ā I/O Events ā Buffer ā Result ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Design Principles
- Thread-Safe Dispatcher Model - All I/O in dispatcher threads, no complex synchronization
- Filter Chain Architecture - Modular, composable request processing
- Production Patterns - Connection pooling, circuit breaker, graceful shutdown
Cross-Language Support
Use MCP C++ SDK from any programming language via the stable C API (libgopher_mcp_c):
| Language | Binding Type | Features |
|---|---|---|
| Python | ctypes/cffi | Async support, type hints |
| TypeScript/Node.js | N-API | High performance, native async |
| Go | CGO | Goroutine-safe wrappers |
| Rust | FFI | Safe wrappers, ownership guarantees |
| Java | JNI | Automatic resource management |
| C#/.NET | P/Invoke | Async/await support |
| Ruby | Native extension | GC integration |
# Installation paths
Headers: /usr/local/include/gopher-mcp/mcp/c_api/
Library: /usr/local/lib/libgopher_mcp_c.{so,dylib,dll}
What is MCP?
Model Context Protocol (MCP) is an open protocol that enables AI models (like Claude, GPT, etc.) to securely interact with external tools, data sources, and services. MCP provides a standardized way for:
- AI assistants to access files, databases, and APIs
- Developers to expose tools and resources to AI models
- Applications to integrate AI capabilities with enterprise systems
This MCP C++ SDK implements the official MCP specification in high-performance C++, suitable for:
- Embedded systems and IoT devices
- High-frequency trading and real-time applications
- Game engines and graphics applications
- Native desktop and mobile applications
- Backend services requiring low latency
Features
| Category | Features |
|---|---|
| Protocol | Full MCP 2025-06-18, 2025-11-25 and 2026-07-28 specifications, JSON-RPC 2.0, resources, tools, prompts |
| Transports | stdio, HTTP+SSE, HTTPS+SSE, WebSocket, TCP |
| Performance | Zero-copy buffers, lock-free operations, connection pooling |
| Reliability | Circuit breaker, rate limiting, retry with backoff, graceful shutdown |
| Security | TLS/SSL, authentication middleware, request validation |
| Observability | Structured logging, metrics, health endpoints |
| Cross-Language | C API for Python, Node.js, Go, Rust, Java, C#, Ruby bindings |
Quick Start
Build and Install
# Show all available commands
make help
# Build
make
# Install (auto-prompts for sudo if needed)
make install
# Run tests
make test
Create an MCP Server
#include "mcp/server/mcp_server.h"
int main() {
mcp::server::McpServerConfig config;
config.server_name = "my-mcp-server";
auto server = mcp::server::createMcpServer(config);
// Register a tool
mcp::Tool calculator;
calculator.name = "add";
calculator.description = "Add two numbers";
server->registerTool(calculator, [](const std::string& name,
const mcp::optional<mcp::Metadata>& arguments,
mcp::server::SessionContext& ctx) {
mcp::CallToolResult result;
auto args = arguments.value();
auto a_it = args.find("a");
auto b_it = args.find("b");
double a = mcp::holds_alternative<double>(a_it->second)
? mcp::get<double>(a_it->second) : 0.0;
double b = mcp::holds_alternative<double>(b_it->second)
? mcp::get<double>(b_it->second) : 0.0;
result.content.push_back(mcp::TextContent{"Result: " + std::to_string(a + b)});
return result;
});
server->listen("http://0.0.0.0:3000");
server->run();
}
Create an MCP Client
#include "mcp/client/mcp_client.h"
int main() {
mcp::client::McpClientConfig config;
config.client_name = "my-mcp-client";
auto client = mcp::client::createMcpClient(config);
client->connect("http://localhost:3000");
// Initialize protocol
auto init = client->initializeProtocol().get();
// Call a tool
auto args = mcp::make<mcp::Metadata>()
.add("a", 10.0)
.add("b", 5.0)
.build();
auto result = client->callTool("add", mcp::make_optional(args)).get();
}
Examples
See examples/mcp/README.md for complete working examples:
# Terminal 1: Start server
./build/examples/mcp/mcp_example_server --verbose
# Terminal 2: Run client with demo
./build/examples/mcp/mcp_example_client --demo --verbose
The example server includes:
- Resource registration and subscriptions
- Tool execution (calculator, database query, system info)
- Prompt templates
- Session management
- HTTP/SSE endpoints
Installation
Prerequisites
- C++14 compiler (GCC 8+, Clang 10+, MSVC 2019+)
- CMake 3.10+
- libevent 2.1+
- OpenSSL 1.1+ (optional, for TLS)
Build Options
# Debug build
make debug
# Release build
make release
# Static libraries only
cmake -B build -DBUILD_SHARED_LIBS=OFF
# Without C API
cmake -B build -DBUILD_C_API=OFF
# Custom install prefix
cmake -B build -DCMAKE_INSTALL_PREFIX=~/.local
Windows (Cygwin + MinGW)
Building on Windows requires Cygwin with MinGW-w64 toolchain:
Prerequisites
Install Cygwin with these packages:
make,cmake- Build toolsmingw64-x86_64-gcc-g++- MinGW C++ compilermingw64-x86_64-libevent- Event librarymingw64-x86_64-openssl- SSL/TLS library
Build Commands
# From Cygwin bash shell
./build-mingw.sh # Release build (default)
./build-mingw.sh debug # Debug build
./build-mingw.sh release # Release build
./build-mingw.sh clean # Clean build directory
Output
- Build directory:
build-mingw/ - Executable:
build-mingw/examples/mcp/mcp_example_server.exe
Documentation
MCP C++ Documentation
- Examples Guide - Working server and client examples
MCP CPP Core Components
- MCP Protocol in C++ - Model Context Protocol implementation details
- Tasks - Long-running tool calls as tasks, on the server and the client
- Filter Chain - Processing pipeline architecture
- Transport Layer - Transport implementations
- Network Layer - Connection management and socket abstraction
Design Documents
- Event Loop Design - Event-driven architecture and dispatcher design
- Filter Usage Guide - Comprehensive guide for using and creating filters
- CTAD Alternatives - Class Template Argument Deduction alternatives for C++14
- MCP Serialization Coverage - JSON serialization implementation details
Comparison with Other C++ MCP SDKs
Several C++ implementations of the Model Context Protocol exist. They serve different needs ā this table is meant to help you pick the right one:
| gopher-mcp (this SDK) | hkr04/cpp-mcp | Neumann-Labs/mcp-cpp | |
|---|---|---|---|
| Focus | Production / enterprise deployments | Lightweight, minimal footprint | Modern C++20 framework |
| MCP spec version | 2025-06-18, 2025-11-25, 2026-07-28 | 2025-03-26 | 2025-11-25 (in progress) |
| C++ standard | C++14 / 17 / 20 | C++17 | C++20 |
| Transports | stdio, HTTP+SSE, HTTPS, Streamable HTTP, WebSocket, TCP | stdio, HTTP+SSE | stdio, HTTP |
| Client + server | Yes | Yes | Yes |
| TLS | Yes | Yes (build flag) | ā |
| Event model | Event-driven dispatcher (libevent), thread-safe by design | ā | ā |
| Resilience | Connection pooling, circuit breaker, rate limiting, backpressure | ā | ā |
| Observability | Metrics, tracing hooks, structured logging | ā | ā |
| Language bindings | Python, TypeScript, Go, Rust, Java, C#, Ruby via stable C API | C++ only | C++ only |
| License | Apache-2.0 | MIT | MIT |
If you need a small dependency for a quick stdio tool, a lightweight SDK like
cpp-mcp is a fine choice. If you need an MCP C++ SDK for production ā
long-lived connections, multiple transports, observability, or calling the
SDK from other languages ā that is what gopher-mcp is built for.
FAQ
What is the Model Context Protocol?
MCP is an open protocol by Anthropic that standardizes how AI models interact with external tools and data. It defines JSON-RPC methods for resources (data), tools (actions), and prompts (templates).
Why use C++ for MCP?
C++ provides maximum performance and portability. This SDK is ideal for embedded systems, real-time applications, game engines, and any environment where Python/Node.js overhead is unacceptable.
Does this work with Claude, GPT, and other AI models?
Yes. MCP is model-agnostic. Any AI system that supports MCP can use servers built with this SDK.
How do I integrate with my Python/Node.js application?
Use the C API bindings. The SDK provides a stable C interface that can be called from any language with FFI support.
Is this production-ready?
Yes. The SDK includes connection pooling, circuit breakers, rate limiting, TLS support, and comprehensive error handling suitable for enterprise deployments.
What transports are supported?
- stdio - Standard input/output (CLI tools)
- HTTP+SSE - HTTP with Server-Sent Events (web applications)
- HTTPS+SSE - Secure HTTP+SSE
- WebSocket - Bidirectional real-time
- TCP - Raw TCP sockets
How does this compare to cpp-mcp and other C++ MCP libraries?
See the comparison table. In short: gopher-mcp targets production use ā more transports (Streamable HTTP, WebSocket, TCP), connection pooling, circuit breakers, observability, and multi-language bindings ā while lighter SDKs optimize for minimal footprint.
How do I contribute?
See CONTRIBUTING.md for guidelines. Issues and pull requests welcome!
Adopters
Using this MCP C++ SDK in your product or project? We'd love to list you here ā open a pull request or issue to add yourself.
- Gopher Security - MCP-native AI security platform
Keywords & Search Terms
MCP C++, MCP CPP, Model Context Protocol C++, MCP SDK, C++ MCP, CPP MCP, Model Context Protocol CPP, MCP implementation, AI model integration C++, LLM integration C++, MCP server C++, MCP client C++, Model Context Protocol SDK, C++ AI SDK, Enterprise MCP, Production MCP C++
Contributing
Contributions are welcome! Please read our contributing guidelines before submitting pull requests.
License
Apache License 2.0 - see LICENSE for details.
Related Projects
gopher MCP questions
What transports does gopher-mcp support?
It supports stdio, HTTP+SSE, HTTPS+SSE, Streamable HTTP, WebSocket, and TCP transports.
Can I use this C++ MCP SDK from Python or Go?
Yes. The SDK exposes a stable C API (libgopher_mcp_c) with bindings for Python, TypeScript, Go, Rust, Java, C#, and Ruby.
What are the build prerequisites for gopher-mcp?
You need a C++14 compiler (GCC 8+, Clang 10+, or MSVC 2019+), CMake 3.10+, libevent 2.1+, and optionally OpenSSL 1.1+ for TLS.
Does gopher-mcp include security and observability features?
Yes, it provides TLS/SSL, authentication middleware, request validation, structured logging, metrics, and health endpoints.
How do I build and install gopher-mcp?
Run make to build, make install to install, and make test to run the tests.