Get the FREE Ultimate OpenClaw Setup Guide →

EmbedMCP

Provides easy-to-use kits that allow you to quickly create MCP servers Any embedded devices

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio aaronwander-embedmcp docker run -i aarwander/embedmcp:latest

How to use

EmbedMCP is a lightweight C library that exposes your existing C functions as AI-accessible tools through the Model Context Protocol (MCP). It lets you register business logic functions and expose them via multiple transports (notably HTTP and STDIO) so clients like AI assistants can discover, invoke, and receive structured results. The library handles parameter validation, memory management, and JSON processing, making it easier to integrate legacy C code into modern AI workflows. You’ll typically create a server instance, register one or more tools with metadata and wrappers, and start a transport (for example an HTTP server or a STDIO-based interface) to listen for MCP requests.

To use EmbedMCP effectively, you can leverage the two registration methods described in the project: Strict Parameter Access for robust validation and Simple Functions for quick wrappers. The example in the README shows how to generate a wrapper for a function, register it with a name and description, and specify input and return types. The server supports array inputs, nested inputs via schema when needed, and automatic memory cleanup after each request. When running, you can start a streamable HTTP server for multiple concurrent clients or a STDIO server for CLI-based or desktop integrations. This makes it suitable for embedding in applications, testing with CLI tools, or exposing services to chat-based AI agents.

Operationally, you’ll typically build the C project to generate the mcp_server binary, then run it with a chosen transport (e.g., ./mcp_server --transport http --port 8080 or ./mcp_server --transport stdio). Tools can be exposed through a simple function wrapper macro or through manual wrappers for complex inputs, including arrays and nested objects. The server will handle parameter extraction, type validation, and cleanup, returning results in a structured JSON format that MCP clients can consume.

How to install

Prerequisites:

  • A C compiler and make (e.g., gcc/clang and GNU Make)
  • Git
  • Basic build tools (cmake or configure scripts as provided by the project)

Install steps:

  1. Clone the repository git clone https://github.com/AaronWander/EmbedMCP.git cd EmbedMCP

  2. Build the library and example server make

    or follow any project-specific build steps, e.g., mkdir build && cd build && cmake .. && make

  3. Run the server

    Example using the built binary with HTTP transport

    ./bin/mcp_server --transport http --port 8080

  4. (Optional) Run STDIO transport for local CLI/AI tooling ./bin/mcp_server --transport stdio --quiet

Prerequisites for development:

  • Include the embed_mcp header files in your project
  • Link against the EmbedMCP library during compilation
  • Ensure you register your tools before starting the server

Notes:

  • If you are integrating into an existing project, copy the embed_mcp/ folder into your source tree and include the header at your usage point.
  • Use the provided macros for quick function wrappers or write manual wrappers for advanced use cases.

Additional notes

Tips and common issues:

  • Memory management is largely automatic, but any string you return must be allocated with malloc so the server can free it.
  • There are two registration approaches: a simple macro-based wrapper for quick exposure and a more flexible manual wrapper for complex inputs or custom validation.
  • The server supports multiple transports, including streamable HTTP and STDIO, making it versatile for both web-based integrations and local tooling.
  • When dealing with arrays or nested inputs, make sure to correctly specify parameter descriptions and types to enable proper validation and memory handling.
  • If you encounter transport binding issues, verify port availability and ensure you are passing the correct --transport option (http or stdio) along with any needed network flags.
  • For debugging, running with --quiet in STDIO mode can help keep protocol tooling output clean while developing tooling around MCP.

Related MCP Servers

Sponsor this space

Reach thousands of developers