This example demonstrates running a fastmcpp MCP server and Copilot SDK client in the same process.
┌─────────────────────────────────────────────────────────┐
│ Single Process │
│ │
│ ┌──────────────────┐ SSE ┌───────────────┐ │
│ │ fastmcpp Server │◄──────────────►│ Copilot SDK │ │
│ │ (background │ localhost │ Client │ │
│ │ thread) │ │ │ │
│ │ │ │ │ │
│ │ Tools: │ │ Connects as │ │
│ │ - secret_vault │ │ remote MCP │ │
│ │ - calculator │ │ server │ │
│ │ - system_info │ │ │ │
│ └──────────────────┘ └───────────────┘ │
└─────────────────────────────────────────────────────────┘
- fastmcpp SSE server runs as a background thread on
localhost:18080 - Copilot SDK connects to it as a remote MCP server
- Single process - no child processes spawned
- Communication uses localhost HTTP (SSE transport)
This example requires the COPILOT_WITH_FASTMCPP CMake option:
cmake -B build -DCOPILOT_WITH_FASTMCPP=ON
cmake --build buildThe build system will:
- First try
find_package(fastmcpp)for a local installation - If not found, automatically fetch fastmcpp from GitHub via FetchContent
./build/examples/mcp/inprocess/mcp_inprocessThe example starts an interactive REPL. Try these prompts:
Look up the INTEROP_TEST secretCalculate 42 * 17 using the calculatorGet system info from the MCP server
Type quit to exit.
| Tool | Description |
|---|---|
secret_vault_lookup |
Look up secrets (API_TOKEN, DATABASE_URL, ENCRYPTION_KEY, INTEROP_TEST) |
logged_calculator |
Perform add/multiply operations with logging |
get_system_info |
Get MCP server information |
This pattern is useful when you want to:
- Expose native C++ functionality to Copilot via MCP tools
- Run everything in a single process without external dependencies
- Single binary deployment with embedded MCP capabilities