{"id":40931112,"url":"https://github.com/0xeb/fastmcpp","last_synced_at":"2026-01-22T04:10:02.026Z","repository":{"id":325705240,"uuid":"1096240400","full_name":"0xeb/fastmcpp","owner":"0xeb","description":"C++ port of the fastmcp Python library","archived":false,"fork":false,"pushed_at":"2026-01-19T06:03:21.000Z","size":525,"stargazers_count":91,"open_issues_count":0,"forks_count":6,"subscribers_count":4,"default_branch":"main","last_synced_at":"2026-01-19T12:35:46.289Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/0xeb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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":"NOTICE","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-14T06:12:51.000Z","updated_at":"2026-01-19T06:03:24.000Z","dependencies_parsed_at":"2026-01-19T05:27:54.514Z","dependency_job_id":"a0a2b043-17ae-43e6-98aa-bf5a6fe3c96c","html_url":"https://github.com/0xeb/fastmcpp","commit_stats":null,"previous_names":["0xeb/fastmcpp"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/0xeb/fastmcpp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xeb%2Ffastmcpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xeb%2Ffastmcpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xeb%2Ffastmcpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xeb%2Ffastmcpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xeb","download_url":"https://codeload.github.com/0xeb/fastmcpp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xeb%2Ffastmcpp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28653790,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T01:17:37.254Z","status":"online","status_checked_at":"2026-01-22T02:00:07.137Z","response_time":144,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2026-01-22T04:10:01.049Z","updated_at":"2026-01-22T04:10:02.007Z","avatar_url":"https://github.com/0xeb.png","language":"C++","funding_links":[],"categories":["Artificial Intelligence"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003cimg src=\"logo.jpg\" width=\"550\" alt=\"fastmcpp logo\"\u003e\n\n**High-performance C++ implementation of the Model Context Protocol (MCP)**\n\n[![CI](https://github.com/0xeb/fastmcpp/actions/workflows/ci.yml/badge.svg)](https://github.com/0xeb/fastmcpp/actions/workflows/ci.yml)\n[![License](https://img.shields.io/github/license/0xeb/fastmcpp.svg)](https://github.com/0xeb/fastmcpp/blob/main/LICENSE)\n\n\u003c/div\u003e\n\n---\n\nfastmcpp is a C++ port of the Python [fastmcp](https://github.com/jlowin/fastmcp) library, providing native performance for MCP servers and clients with support for tools, resources, prompts, and multiple transport layers (STDIO, HTTP/SSE, WebSocket).\n\n**Status:** Beta – core MCP features track the Python `fastmcp` reference.\n\n**Current version:** 2.14.1\n\n## Features\n\n- Core MCP protocol implementation (JSON‑RPC).\n- Multiple transports: STDIO, HTTP (SSE), Streamable HTTP, WebSocket.\n- Streamable HTTP transport (MCP spec 2025-03-26) with session management.\n- Tool management and invocation.\n- Resources and prompts support.\n- Resource templates with URI pattern matching.\n- JSON Schema validation.\n- FastMCP high-level application class.\n- ProxyApp for backend server proxying.\n- ServerSession for bidirectional communication, sampling, and server-initiated notifications.\n- Built-in middleware: Logging, Timing, Caching, RateLimiting, ErrorHandling.\n- Tool transforms for input/output processing.\n- Integration with MCP‑compatible CLI tools.\n- Cross‑platform: Windows, Linux, macOS.\n\n## Requirements\n\n- C++17 or later compiler.\n- CMake 3.20 or higher.\n- `nlohmann/json` (fetched automatically).\n\nOptional:\n\n- libcurl (for HTTP POST streaming; can be fetched when `FASTMCPP_FETCH_CURL=ON`).\n- cpp‑httplib (HTTP server, fetched automatically).\n- easywsclient (WebSocket client, fetched automatically).\n\n## Building\n\n### Basic build\n\n```bash\ngit clone https://github.com/0xeb/fastmcpp.git\ncd fastmcpp\n\ncmake -B build -S . -DCMAKE_BUILD_TYPE=Release\ncmake --build build --config Release -j\n```\n\n### Recommended configuration options\n\n```bash\ncmake -B build -S . \\\n  -DCMAKE_BUILD_TYPE=Release \\\n  -DFASTMCPP_ENABLE_POST_STREAMING=ON \\\n  -DFASTMCPP_FETCH_CURL=ON \\\n  -DFASTMCPP_ENABLE_STREAMING_TESTS=ON \\\n  -DFASTMCPP_ENABLE_WS_STREAMING_TESTS=ON\n```\n\nKey options:\n\n| Option                           | Default | Description                                      |\n|----------------------------------|---------|--------------------------------------------------|\n| `CMAKE_BUILD_TYPE`              | Debug   | Build configuration (Debug/Release/RelWithDebInfo) |\n| `FASTMCPP_ENABLE_POST_STREAMING` | OFF     | Enable HTTP POST streaming (requires libcurl)   |\n| `FASTMCPP_FETCH_CURL`           | OFF     | Fetch and build curl (via FetchContent) if not found |\n| `FASTMCPP_ENABLE_STREAMING_TESTS` | OFF   | Enable SSE streaming tests                      |\n| `FASTMCPP_ENABLE_WS_STREAMING_TESTS` | OFF | Enable WebSocket streaming tests                |\n\n### Platform notes\n\n**Windows (Visual Studio):**\n\n```bash\ncmake -B build -S . -G \"Visual Studio 17 2022\"\ncmake --build build --config Release\n```\n\n**Linux/macOS:**\n\n```bash\ncmake -B build -S . -DCMAKE_BUILD_TYPE=Release\ncmake --build build -j\"$(nproc)\"\n```\n\n## Testing\n\n```bash\n# Run all tests\nctest --test-dir build -C Release --output-on-failure\n\n# Parallel\nctest --test-dir build -C Release -j4 --output-on-failure\n\n# Run a specific test\nctest --test-dir build -C Release -R fastmcp_smoke --output-on-failure\n\n# List tests\nctest --test-dir build -C Release -N\n```\n\n## Basic Usage\n\n### STDIO MCP server\n\n```cpp\n#include \u003cfastmcpp/tools/manager.hpp\u003e\n#include \u003cfastmcpp/mcp/handler.hpp\u003e\n#include \u003cfastmcpp/server/stdio_server.hpp\u003e\n\nint main() {\n    fastmcpp::tools::ToolManager tm;\n    // register tools on tm...\n\n    auto handler = fastmcpp::mcp::make_mcp_handler(\n        \"myserver\", \"1.0.0\", tm\n    );\n\n    fastmcpp::server::StdioServerWrapper server(handler);\n    server.run();  // blocking\n    return 0;\n}\n```\n\n### HTTP server\n\n```cpp\n#include \u003cfastmcpp/server/server.hpp\u003e\n#include \u003cfastmcpp/server/http_server.hpp\u003e\n\nint main() {\n    auto srv = std::make_shared\u003cfastmcpp::server::Server\u003e();\n    srv-\u003eregister_get(\"/health\", [](const nlohmann::json\u0026) {\n        return nlohmann::json{{\"status\", \"ok\"}};\n    });\n\n    fastmcpp::server::HttpServerWrapper http(srv, \"127.0.0.1\", 8080);\n    http.start();  // non‑blocking\n\n    std::this_thread::sleep_for(std::chrono::hours(1));\n    http.stop();\n    return 0;\n}\n```\n\n### HTTP client\n\n```cpp\n#include \u003cfastmcpp/client/client.hpp\u003e\n#include \u003cfastmcpp/client/transports.hpp\u003e\n\nint main() {\n    auto transport = std::make_shared\u003cfastmcpp::client::HttpTransport\u003e(\n        \"http://localhost:8080\"\n    );\n\n    fastmcpp::client::Client client(transport);\n    auto response = client.call(\"tool/invoke\", {\n        {\"name\", \"calculator\"},\n        {\"input\", {{\"operation\", \"add\"}, {\"a\", 5}, {\"b\", 3}}}\n    });\n\n    std::cout \u003c\u003c response.dump() \u003c\u003c std::endl;\n    return 0;\n}\n```\n\n### Streamable HTTP server (MCP spec 2025-03-26)\n\n```cpp\n#include \u003cfastmcpp/tools/manager.hpp\u003e\n#include \u003cfastmcpp/mcp/handler.hpp\u003e\n#include \u003cfastmcpp/server/streamable_http_server.hpp\u003e\n\nint main() {\n    fastmcpp::tools::ToolManager tm;\n    // register tools on tm...\n\n    auto handler = fastmcpp::mcp::make_mcp_handler(\n        \"myserver\", \"1.0.0\", tm\n    );\n\n    // Streamable HTTP server on /mcp endpoint\n    fastmcpp::server::StreamableHttpServerWrapper server(\n        handler, \"127.0.0.1\", 8080, \"/mcp\"\n    );\n    server.start();  // non-blocking\n\n    std::this_thread::sleep_for(std::chrono::hours(1));\n    server.stop();\n    return 0;\n}\n```\n\n### Streamable HTTP client\n\n```cpp\n#include \u003cfastmcpp/client/transports.hpp\u003e\n\nint main() {\n    fastmcpp::client::StreamableHttpTransport transport(\n        \"http://localhost:8080\", \"/mcp\"\n    );\n\n    // Send initialize request\n    auto init_response = transport.request(\"mcp\", {\n        {\"jsonrpc\", \"2.0\"},\n        {\"id\", 1},\n        {\"method\", \"initialize\"},\n        {\"params\", {\n            {\"protocolVersion\", \"2024-11-05\"},\n            {\"capabilities\", {}},\n            {\"clientInfo\", {{\"name\", \"client\"}, {\"version\", \"1.0\"}}}\n        }}\n    });\n\n    // Session ID is automatically managed via Mcp-Session-Id header\n    std::cout \u003c\u003c \"Session: \" \u003c\u003c transport.session_id() \u003c\u003c std::endl;\n    return 0;\n}\n```\n\n## Examples\n\nSee the `examples/` directory for complete programs, including:\n\n- `stdio_server.cpp` – STDIO MCP server.\n- `server_quickstart.cpp` – HTTP server with routes.\n- `client_quickstart.cpp` – HTTP client usage.\n- `tool_example.cpp` – tool registration and invocation.\n- `middleware_example.cpp` – request/response middleware.\n\n## Project Structure\n\n```text\nfastmcpp/\n  include/fastmcpp/   # Public headers (client, server, tools, etc.)\n  src/                # Implementation\n  tests/              # Test suite (GoogleTest)\n  examples/           # Example programs\n  CMakeLists.txt      # Build configuration\n  LICENSE             # Apache 2.0 license\n  NOTICE              # Attribution notices\n  README.md           # This file\n```\n\n## Projects Using This Library\n\n| Project | Description |\n|---------|-------------|\n| [copilot-sdk-cpp](https://github.com/0xeb/copilot-sdk-cpp) | C++ SDK for GitHub Copilot CLI |\n| [claude-agent-sdk-cpp](https://github.com/0xeb/claude-agent-sdk-cpp) | C++ SDK for Claude Code CLI with MCP support |\n\nWant to add your project? Open a PR!\n\n## Contributing\n\nContributions are welcome. Please:\n\n1. Ensure all tests pass.\n2. Follow the existing code style.\n3. Add tests for new features.\n4. Update documentation as needed.\n\n## Author\n\nElias Bachaalany ([@0xeb](https://github.com/0xeb))\n\nPair-programmed with Claude Code and Codex.\n\n## License\n\nCopyright 2025 Elias Bachaalany\n\nLicensed under the Apache License 2.0. See `LICENSE` and `NOTICE` for details.\n\nThis is a C++ port of [fastmcp](https://github.com/jlowin/fastmcp) by Jeremiah Lowin. The Python library is the canonical implementation; fastmcpp aims to match its behavior for core features.\n\n## Support\n\nFor issues and questions, use the GitHub issue tracker: \u003chttps://github.com/0xeb/fastmcpp/issues\u003e.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xeb%2Ffastmcpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xeb%2Ffastmcpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xeb%2Ffastmcpp/lists"}