Why MCP
Konstera agents reach back to the kernel over the Model Context Protocol (MCP). This is unusual — most agent platforms use a bespoke RPC — and it was a deliberate choice. Here's what we got for it.
The alternatives we rejected#
| A: bespoke gRPC | B: REST + OpenAPI | C: MCP chosen | |
|---|---|---|---|
| Clients | One generated client per language | Anything that speaks HTTP | Any language with an MCP client library |
| Calling a method | Generated stubs; custom auth | Every call is a hand-crafted request | The kernel exposes its services as MCP tools |
| Streaming (LLM completions) | Custom streaming | Clunky | Native, via MCP's SSE/streamable transport |
| Discovery (what tools exist?) | — | Read the OpenAPI doc out-of-band | Built-in tools/list |
| Familiar to agent authors | Nothing they can inspect or tool without us publishing SDKs for their language | Generic HTTP | The same protocol they already use for Claude Desktop, Cursor's agent mode, OpenAI's Agents SDK |
Option A: bespoke gRPC. One generated client per language, custom auth, custom streaming. Fine engineering; nothing an agent author can inspect or tool without us publishing SDKs for their language.
Option B: REST + OpenAPI. Agent authors can call anything that speaks HTTP. But every method call becomes a hand-crafted request; streaming (for LLM completions) is clunky; discovery (what tools exist?) requires reading the OpenAPI doc out-of-band.
Option C: MCP. Agent authors use the same protocol they already use for Claude Desktop, Cursor's agent mode, OpenAI's Agents SDK. The kernel exposes its services as MCP tools. Any language with an MCP client library can author Konstera agents.
What MCP gives us#
Not a new protocol to learn — one you probably already know.
tools/list enumerates kernel services at runtime.
LLM responses stream over the protocol's own transport.
Scoping, metering and audit happen kernel-side, once.
Thin SDK per language — or none at all.
A protocol that's already everywhere#
MCP ships in Claude Desktop, Cursor, Windsurf, Codex, Claude Code, OpenAI's Responses API, and increasingly third-party agent frameworks. Konstera's agent-to-kernel interface is not a new protocol you have to learn — it's one you probably already know.
Concretely: a user writing a Konstera agent in Cursor can expose the kernel
callback as an MCP server to Cursor's chat panel too, letting the LLM inside
Cursor call the same log_info / llm_complete / vector_query tools your
agent calls at runtime. Same debugging surface, same mental model.
Discoverability#
MCP has tools/list built in. An agent can enumerate what kernel services
are available at runtime without hardcoding a list — important for forward
compatibility as the kernel grows services (M7, M10, M13, …).
Streaming for free#
MCP's SSE/streamable transport handles streaming LLM responses natively. We don't maintain a bespoke chunked-transfer encoding; we lean on the protocol.
Audit + metering at the choke point#
Every kernel-side side effect (log, LLM call, state write, credential fetch) goes through a tool invocation. The kernel scopes each by caller instance (ADR-M8 multi-tenancy), meters cost (per-tenant, per-model), writes audit rows. The agent SDK is a thin wrapper — the heavy lifting is kernel-side on a protocol boundary we fully control.
If the agent SDK had direct Python/.NET/TS bindings into the kernel, each language's binding would have to re-implement the metering + scoping. With MCP, there's one choke point.
Language neutrality#
The MCP protocol has clients in Python, TypeScript, .NET, Go, Rust, Java, and others. Konstera's SDK is a thin wrapper per language, so adding support for a new language is weeks not months.
More importantly: an agent author can write a Konstera agent in a language
Konstera hasn't shipped an SDK for yet — any MCP-speaking server + a
Dockerfile + a manifest is enough. We've seen this pattern used for
konstera agent in Go even though we don't publish Konstera.Sdk.Go.
- An MCP-speaking server
- A Dockerfile
- A manifest
What MCP doesn't give us#
Not a free lunch:
| Trade-off | What it means | How it's handled |
|---|---|---|
| Overhead | MCP's JSON-RPC framing is heavier than a direct function call. | For latency-sensitive hot paths, the kernel may inline certain services (ADR-005 explored this; we chose consistency over 100µs savings). |
| Binary data | MCP tool results are JSON — binary (images, PDFs, model weights) has to go through base64. | For small blobs (≤25 MB) this is fine; for larger streams, use ctx.artifact.*, which handles the encoding internally. |
| Debugging | MCP transport over streamable HTTP is harder to debug than plain gRPC in a Wireshark view. | The kernel exposes an MCP inspector endpoint for local dev that renders calls in a readable form. |