{"id":42708822,"url":"https://github.com/gophersecurity/gopher-mcp","last_synced_at":"2026-02-06T10:26:20.046Z","repository":{"id":312035818,"uuid":"1030687975","full_name":"GopherSecurity/gopher-mcp","owner":"GopherSecurity","description":"MCP C++ SDK - Model Context Protocol implementation in CPP with enterprise-grade security, visibility and connectivity.","archived":false,"fork":false,"pushed_at":"2026-01-28T16:25:11.000Z","size":12300,"stargazers_count":67,"open_issues_count":57,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-01-28T19:37:32.434Z","etag":null,"topics":["ai","ai-tools","async","cplusplus","cpp","cross-platform","event-driven","json-rpc","llm","llm-tools","mcp","mcp-client","mcp-sdk","mcp-server","model-context-protocol","protocol","sdk","tool-calling"],"latest_commit_sha":null,"homepage":"https://gopher.security","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GopherSecurity.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-02T05:34:36.000Z","updated_at":"2026-01-28T02:31:28.000Z","dependencies_parsed_at":"2025-08-28T12:00:31.166Z","dependency_job_id":"acb173e8-726f-4f0e-94ce-b683b7f9cd1c","html_url":"https://github.com/GopherSecurity/gopher-mcp","commit_stats":null,"previous_names":["gophersecurity/gopher-mcp"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/GopherSecurity/gopher-mcp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GopherSecurity%2Fgopher-mcp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GopherSecurity%2Fgopher-mcp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GopherSecurity%2Fgopher-mcp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GopherSecurity%2Fgopher-mcp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GopherSecurity","download_url":"https://codeload.github.com/GopherSecurity/gopher-mcp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GopherSecurity%2Fgopher-mcp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28880017,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T10:31:27.438Z","status":"ssl_error","status_checked_at":"2026-01-29T10:31:01.017Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","ai-tools","async","cplusplus","cpp","cross-platform","event-driven","json-rpc","llm","llm-tools","mcp","mcp-client","mcp-sdk","mcp-server","model-context-protocol","protocol","sdk","tool-calling"],"created_at":"2026-01-29T15:03:02.307Z","updated_at":"2026-01-29T15:03:06.169Z","avatar_url":"https://github.com/GopherSecurity.png","language":"C++","readme":"# MCP C++ SDK - Model Context Protocol Implementation for C++\n\n[![C++14](https://img.shields.io/badge/C%2B%2B-14%2F17%2F20-blue.svg)](https://isocpp.org/)\n[![MCP](https://img.shields.io/badge/MCP-2025--06--18-green.svg)](https://modelcontextprotocol.io/)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)\n[![Platform](https://img.shields.io/badge/Platform-Linux%20%7C%20macOS%20%7C%20Windows-lightgrey.svg)]()\n[![Multi-Language](https://img.shields.io/badge/Multi--Language-Python%20%7C%20Go%20%7C%20Rust%20%7C%20Java%20%7C%20C%23%20and%20more-orange.svg)]()\n\n**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)**.\n\n⭐ **Please give a star if you find this useful!**\n\n## Table of Contents\n\n- [Architecture](#architecture)\n- [Cross-Language Support](#cross-language-support)\n- [What is MCP?](#what-is-mcp)\n- [Features](#features)\n- [Quick Start](#quick-start)\n- [Examples](#examples)\n- [Installation](#installation)\n- [Documentation](#documentation)\n- [FAQ](#faq)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Architecture\n\n```\n┌─────────────────────────────────────────────────────────────┐\n│                     Application Layer                       │\n│         MCP Server / Client / Custom Applications           │\n├─────────────────────────────────────────────────────────────┤\n│              Cross-Language Binding Layer                   │\n│      Python │ TypeScript │ Go │ Rust │ Java │ C# │ Ruby     │\n├─────────────────────────────────────────────────────────────┤\n│                    C API (FFI Layer)                        │\n│       libgopher_mcp_c: Opaque Handles │ Memory Safety       │\n│        RAII Guards │ Type Safety │ Error Handling           │\n├─────────────────────────────────────────────────────────────┤\n│                      Protocol Layer                         │\n│           MCP JSON-RPC Protocol Implementation              │\n│          Request/Response/Notification Handling             │\n├─────────────────────────────────────────────────────────────┤\n│                    Filter Chain Layer                       │\n│      HTTP Codec │ SSE Codec │ Routing │ Rate Limiting       │\n│      Circuit Breaker │ Metrics │ Backpressure │ Auth        │\n├─────────────────────────────────────────────────────────────┤\n│                    Transport Layer                          │\n│      Stdio │ HTTP(s)+SSE │ WebSocket │ TCP │ Redis │ P2P    │\n├─────────────────────────────────────────────────────────────┤\n│                     Network Layer                           │\n│      Connection Management │ Listener │ Socket Interface    │\n├─────────────────────────────────────────────────────────────┤\n│                  Event Loop \u0026 Dispatcher                    │\n│      Libevent Integration │ Timer Management │ I/O Events   │\n└─────────────────────────────────────────────────────────────┘\n```\n\n### Design Principles\n\n1. **Thread-Safe Dispatcher Model** - All I/O in dispatcher threads, no complex synchronization\n2. **Filter Chain Architecture** - Modular, composable request processing\n3. **Production Patterns** - Connection pooling, circuit breaker, graceful shutdown\n\n## Cross-Language Support\n\n**Use MCP C++ SDK from any programming language** via the stable C API (`libgopher_mcp_c`):\n\n| Language | Binding Type | Features |\n|----------|--------------|----------|\n| **Python** | ctypes/cffi | Async support, type hints |\n| **TypeScript/Node.js** | N-API | High performance, native async |\n| **Go** | CGO | Goroutine-safe wrappers |\n| **Rust** | FFI | Safe wrappers, ownership guarantees |\n| **Java** | JNI | Automatic resource management |\n| **C#/.NET** | P/Invoke | Async/await support |\n| **Ruby** | Native extension | GC integration |\n\n```bash\n# Installation paths\nHeaders: /usr/local/include/gopher-mcp/mcp/c_api/\nLibrary: /usr/local/lib/libgopher_mcp_c.{so,dylib,dll}\n```\n\n## What is MCP?\n\n**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:\n\n- **AI assistants** to access files, databases, and APIs\n- **Developers** to expose tools and resources to AI models\n- **Applications** to integrate AI capabilities with enterprise systems\n\nThis MCP C++ SDK implements the [official MCP specification](https://modelcontextprotocol.io/) in high-performance C++, suitable for:\n\n- Embedded systems and IoT devices\n- High-frequency trading and real-time applications\n- Game engines and graphics applications\n- Native desktop and mobile applications\n- Backend services requiring low latency\n\n## Features\n\n| Category | Features |\n|----------|----------|\n| **Protocol** | Full MCP 2025-06-18 specification, JSON-RPC 2.0, resources, tools, prompts |\n| **Transports** | stdio, HTTP+SSE, HTTPS+SSE, WebSocket, TCP |\n| **Performance** | Zero-copy buffers, lock-free operations, connection pooling |\n| **Reliability** | Circuit breaker, rate limiting, retry with backoff, graceful shutdown |\n| **Security** | TLS/SSL, authentication middleware, request validation |\n| **Observability** | Structured logging, metrics, health endpoints |\n| **Cross-Language** | C API for Python, Node.js, Go, Rust, Java, C#, Ruby bindings |\n\n## Quick Start\n\n### Build and Install\n\n```bash\n# Show all available commands\nmake help\n\n# Build\nmake\n\n# Install (auto-prompts for sudo if needed)\nmake install\n\n# Run tests\nmake test\n```\n\n### Create an MCP Server\n\n```cpp\n#include \"mcp/server/mcp_server.h\"\n\nint main() {\n    mcp::server::McpServerConfig config;\n    config.server_name = \"my-mcp-server\";\n\n    auto server = mcp::server::createMcpServer(config);\n\n    // Register a tool\n    mcp::Tool calculator;\n    calculator.name = \"add\";\n    calculator.description = \"Add two numbers\";\n\n    server-\u003eregisterTool(calculator, [](const std::string\u0026 name,\n                                         const mcp::optional\u003cmcp::Metadata\u003e\u0026 arguments,\n                                         mcp::server::SessionContext\u0026 ctx) {\n        mcp::CallToolResult result;\n        auto args = arguments.value();\n        auto a_it = args.find(\"a\");\n        auto b_it = args.find(\"b\");\n\n        double a = mcp::holds_alternative\u003cdouble\u003e(a_it-\u003esecond)\n                       ? mcp::get\u003cdouble\u003e(a_it-\u003esecond) : 0.0;\n        double b = mcp::holds_alternative\u003cdouble\u003e(b_it-\u003esecond)\n                       ? mcp::get\u003cdouble\u003e(b_it-\u003esecond) : 0.0;\n\n        result.content.push_back(mcp::TextContent{\"Result: \" + std::to_string(a + b)});\n        return result;\n    });\n\n    server-\u003elisten(\"http://0.0.0.0:3000\");\n    server-\u003erun();\n}\n```\n\n### Create an MCP Client\n\n```cpp\n#include \"mcp/client/mcp_client.h\"\n\nint main() {\n    mcp::client::McpClientConfig config;\n    config.client_name = \"my-mcp-client\";\n\n    auto client = mcp::client::createMcpClient(config);\n    client-\u003econnect(\"http://localhost:3000\");\n\n    // Initialize protocol\n    auto init = client-\u003einitializeProtocol().get();\n\n    // Call a tool\n    auto args = mcp::make\u003cmcp::Metadata\u003e()\n                    .add(\"a\", 10.0)\n                    .add(\"b\", 5.0)\n                    .build();\n\n    auto result = client-\u003ecallTool(\"add\", mcp::make_optional(args)).get();\n}\n```\n\n## Examples\n\nSee [examples/mcp/README.md](examples/mcp/README.md) for complete working examples:\n\n```bash\n# Terminal 1: Start server\n./build/examples/mcp/mcp_example_server --verbose\n\n# Terminal 2: Run client with demo\n./build/examples/mcp/mcp_example_client --demo --verbose\n```\n\nThe example server includes:\n- Resource registration and subscriptions\n- Tool execution (calculator, database query, system info)\n- Prompt templates\n- Session management\n- HTTP/SSE endpoints\n\n## Installation\n\n### Prerequisites\n\n- C++14 compiler (GCC 8+, Clang 10+, MSVC 2019+)\n- CMake 3.10+\n- libevent 2.1+\n- OpenSSL 1.1+ (optional, for TLS)\n\n### Build Options\n\n```bash\n# Debug build\nmake debug\n\n# Release build\nmake release\n\n# Static libraries only\ncmake -B build -DBUILD_SHARED_LIBS=OFF\n\n# Without C API\ncmake -B build -DBUILD_C_API=OFF\n\n# Custom install prefix\ncmake -B build -DCMAKE_INSTALL_PREFIX=~/.local\n```\n\n### Windows (Cygwin + MinGW)\n\nBuilding on Windows requires Cygwin with MinGW-w64 toolchain:\n\n#### Prerequisites\nInstall [Cygwin](https://www.cygwin.com/) with these packages:\n- `make`, `cmake` - Build tools\n- `mingw64-x86_64-gcc-g++` - MinGW C++ compiler\n- `mingw64-x86_64-libevent` - Event library\n- `mingw64-x86_64-openssl` - SSL/TLS library\n\n#### Build Commands\n```bash\n# From Cygwin bash shell\n./build-mingw.sh           # Release build (default)\n./build-mingw.sh debug     # Debug build\n./build-mingw.sh release   # Release build\n./build-mingw.sh clean     # Clean build directory\n```\n\n#### Output\n- Build directory: `build-mingw/`\n- Executable: `build-mingw/examples/mcp/mcp_example_server.exe`\n\n## Documentation\n\n### MCP C++ Documentation\n\n- [Examples Guide](examples/mcp/README.md) - Working server and client examples\n\n### MCP CPP Core Components\n\n- [MCP Protocol in C++](docs/mcp_protocol.md) - Model Context Protocol implementation details\n- [Filter Chain](docs/filter_chain.md) - Processing pipeline architecture\n- [Transport Layer](docs/transport_layer.md) - Transport implementations\n- [Network Layer](docs/network_layer.md) - Connection management and socket abstraction\n\n### Design Documents\n\n- [Event Loop Design](docs/event_loop_design.md) - Event-driven architecture and dispatcher design\n- [Filter Usage Guide](docs/filter_usage_guide.md) - Comprehensive guide for using and creating filters\n- [CTAD Alternatives](docs/CTAD_alternatives.md) - Class Template Argument Deduction alternatives for C++14\n- [MCP Serialization Coverage](docs/MCP_serialization_coverage.md) - JSON serialization implementation details\n\n## FAQ\n\n### What is the Model Context Protocol?\n\nMCP 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).\n\n### Why use C++ for MCP?\n\nC++ 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.\n\n### Does this work with Claude, GPT, and other AI models?\n\nYes. MCP is model-agnostic. Any AI system that supports MCP can use servers built with this SDK.\n\n### How do I integrate with my Python/Node.js application?\n\nUse the C API bindings. The SDK provides a stable C interface that can be called from any language with FFI support.\n\n### Is this production-ready?\n\nYes. The SDK includes connection pooling, circuit breakers, rate limiting, TLS support, and comprehensive error handling suitable for enterprise deployments.\n\n### What transports are supported?\n\n- **stdio** - Standard input/output (CLI tools)\n- **HTTP+SSE** - HTTP with Server-Sent Events (web applications)\n- **HTTPS+SSE** - Secure HTTP+SSE\n- **WebSocket** - Bidirectional real-time\n- **TCP** - Raw TCP sockets\n\n### How do I contribute?\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines. Issues and pull requests welcome!\n\n## Keywords \u0026 Search Terms\n\n`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++`\n\n## Contributing\n\nContributions are welcome! Please read our contributing guidelines before submitting pull requests.\n\n## License\n\nApache License 2.0 - see [LICENSE](LICENSE) for details.\n\n## Related Projects\n\n- [Model Context Protocol Specification](https://modelcontextprotocol.io/)\n- [MCP TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk)\n- [MCP Python SDK](https://github.com/modelcontextprotocol/python-sdk)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgophersecurity%2Fgopher-mcp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgophersecurity%2Fgopher-mcp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgophersecurity%2Fgopher-mcp/lists"}