AKADATA LIMITED

AKAMAN source: json.h

AKAMAN json.h — JSON parsing and protocol data handling.

AKAMAN logo

AKAMAN

A small Linux C utility that retrieves the compact documentation fragment an AI agent needs from the host where it is running.

Download AKAMAN v0.1.0 source →

mcp.h

stdio MCP protocol handling and tool responses. This is the released v0.1.0 source, shown in full so you can read it before downloading the archive.

A complete MCP server written in C

Most MCP servers are written in Node.js/TypeScript, Python, or Go. A correct, dependency-free MCP server implemented in C is genuinely uncommon — and this is one. It speaks JSON-RPC 2.0 over standard input and output (and optionally over HTTP), exposes a single tool, and returns structured JSON that any MCP client can consume.

Because the protocol handling is small and self-contained, it is directly reusable. Take this code, build it, and replace the man tool with your own: the handshake, message framing, and tool-discovery logic stay the same. Any MCP-aware agent — Codex, OpenCode, Claude Desktop, or your own client — can then talk to your server over the standard MCP protocol without any change to the agent.

The practical suggestion: read the listing below, run make against it, and build your own MCP server on top of what you see. AKAMAN is proof that a useful MCP server does not need a heavy runtime — just a correct implementation of the protocol.

Download source26 lines
#ifndef AKAMAN_MCP_H#define AKAMAN_MCP_H#include <stddef.h>#include "core.h"#define MCP_MAX_HEADER_BYTES 16384u#define MCP_MAX_REQUEST_BYTES (64u * 1024u)#define MCP_MAX_QUERY_BYTES AKAMAN_MAX_QUERY_BYTES/* Static tools/list result: keep description + schema as small as possible. * This is the entire MCP surface: one tool, three fields. */#define AKAMAN_TOOLS_LIST_JSON                                                              \	"{\"tools\":[{\"name\":\"man\",\"description\":\"Get minimal local man-page context " \	"for command syntax.\",\"inputSchema\":{\"type\":\"object\",\"properties\":{"           \	"\"query\":{\"type\":\"string\"},\"section\":{\"type\":\"string\"},"                   \	"\"source\":{\"type\":\"string\",\"enum\":[\"man\",\"doc\",\"headers\"]}},"            \	"\"required\":[\"query\"]}}]}"int conf_load(const char *path, char *key, size_t keysz);int run_stdio(void);int run_http(const char *addr, const char *api_key);int run_bench(void);#endif

Back to AKAMAN source layout