# Synapse Mcp

> A modern, lightweight C++23 SDK for the Model Context Protocol (MCP)

- **Type:** MCP server
- **Install:** `agentstack add mcp-ptai-eng-synapse-mcp`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [ptai-eng](https://agentstack.voostack.com/s/ptai-eng)
- **Installs:** 0
- **Category:** [AI & ML](https://agentstack.voostack.com/c/ai-and-ml)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [ptai-eng](https://github.com/ptai-eng)
- **Source:** https://github.com/ptai-eng/synapse-mcp

## Install

```sh
agentstack add mcp-ptai-eng-synapse-mcp
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

Synapse MCP
  A Modern, High-Performance, Header-Only C++20 SDK for Model Context Protocol

  
    
    
    
    
  

---

**Synapse MCP** is a lightweight, ultra-fast, and deeply integrated **C++20 header-only** library designed to help developers build **Model Context Protocol (MCP)** servers and clients with zero friction. Built strictly on modern **C++** paradigms, it leverages `std::expected` and modern standard library features to provide maximum safety without compromising on the bare-metal performance that **C++** developers expect.

##  Why Synapse MCP?

Inspired by the design philosophies of industry standards like [spdlog](https://github.com/gabime/spdlog) and [abseil](https://github.com/abseil/abseil-cpp):

* **Header-only:** Just drop the `include/` folder into your project and you're ready to go. No complex build steps or linking headaches.
* **Modern C++20/23:** Utilizes the latest language features (`std::expected`, `std::variant`, `std::optional`) for expressive, safe, and clean code.
* **Zero Overhead Abstractions:** Designed for latency-critical applications where every CPU cycle counts.
* **Fully Featured MCP Spec:** Supports Tools, Resources, Prompts, and Sampling natively out-of-the-box.
* **Multi-Threaded & Thread-Safe:** Handles incoming JSON-RPC requests asynchronously via `std::thread`, using `std::shared_mutex` to safely protect all state interactions.
* **Dependency Light:** Uses only `nlohmann/json` for robust JSON-RPC 2.0 serialization. 

##  Installation

Since Synapse MCP is header-only, installation is trivial.

### Option 1: CMake FetchContent (Recommended)

Add this to your `CMakeLists.txt`:

```cmake
include(FetchContent)
FetchContent_Declare(
    synapse_mcp
    GIT_REPOSITORY https://github.com/ptai-eng/synapse-mcp.git
    GIT_TAG main
)
FetchContent_MakeAvailable(synapse_mcp)

add_executable(my_server main.cpp)
target_link_libraries(my_server PRIVATE synapse::mcp)
```

### Option 2: Copy-Paste

1. Copy the `include/synapse` directory into your project's include path.
2. Ensure you have `nlohmann/json` available in your project.

##  Quick Start

Building an MCP server in modern **C++** is now just a few lines of code:

```cpp
#include 
#include 

int main() {
    // 1. Initialize the STDIO transport layer
    auto transport = std::make_shared();
    
    // 2. Create the MCP Server instance
    synapse::server mcp_server(transport);
    
    // 3. Register a tool
    mcp_server.register_tool(
        "calculate_hash",
        "Computes a dummy SHA-256 hash for a given input string.",
        R"({
            "type": "object",
            "properties": {
                "input": { "type": "string" }
            },
            "required": ["input"]
        })"_json,
        [](const nlohmann::json& args) -> std::expected {
            std::string input = args["input"];
            return nlohmann::json{{"hash", "dummy-hash-" + input}};
        }
    );
    
    // 4. Start listening for incoming requests
    transport->start();
    
    return 0;
}
```

##  Documentation

Detailed documentation on handling Prompts, Resources, and advanced Transport layers (like SSE or WebSockets) is coming soon in the `docs/` folder.

##  Contributing

We welcome contributions! Whether it's adding new transport layers, improving documentation, or fixing bugs, please feel free to open an issue or submit a Pull Request.

##  License

Synapse MCP is distributed under the MIT License. See `LICENSE` for more information.

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [ptai-eng](https://github.com/ptai-eng)
- **Source:** [ptai-eng/synapse-mcp](https://github.com/ptai-eng/synapse-mcp)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-ptai-eng-synapse-mcp
- Seller: https://agentstack.voostack.com/s/ptai-eng
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
