Skip to content

About mcp

mcp serves a Go application's operations to AI assistants over the Model Context Protocol. It publishes them progressively by default, runs a Cobra CLI's commands as supervised subprocesses, and mounts into an HTTP service under the toolkit's own lifecycle. This page is the short version of why, where and how; the long versions are under Explanation.

Why it exists

Every tool built on go-tool-base used to serve MCP through ophis, a bridge of the first generation: every command became one tool, and a client fetched the whole catalogue, schemas included, before it had asked for anything. A tool with eighty commands shipped eighty schemas into every conversation, most of them never used, and the cost grew with the tool.

mcp replaces that with an operation model the application owns, published through three discovery tools whatever the catalogue's size, so a schema enters the conversation only when it is about to be used. Its Cobra binding keeps ophis's isolation, one child process per call, and adds what a run needs to be trusted: one execution slot, a deadline, an output budget, and cleanup of everything the command started. The same model mounts into an HTTP service, so a service exposes chosen operations under the authentication and lifecycle it already has rather than running a second server, and binds a gRPC service's unary methods so each MCP call runs through the service's own interceptors and authorisation predicate; Keryx Studio is the service consumer the design was written for.

Where it runs

Anywhere Go 1.27.1 or later builds. A CLI serves over stdio or Streamable HTTP with one mounted command; a service mounts one handler. Subprocess execution and descendant cleanup are designed for Linux, macOS and Windows, and proven on Linux; the native macOS and Windows runs are wired in CI and not yet executed, which the development reference records honestly rather than claiming.

How it fits together

Five packages with a strict dependency direction. The root owns the operation model and imports no protocol SDK, CLI framework, HTTP, gRPC or lifecycle package, and a test keeps it so. server is the adapter over the official Go SDK, cobra turns a command tree into operations, grpc turns a gRPC service's methods into operations, and cli composes the first two into the mcp command a tool mounts. A framework such as go-tool-base applies its own conventions on top through the seams those packages offer. Package boundaries has the picture, and the security model says what the design assumes about the model, the client and the network.

Who is behind it

mcp is built and maintained by Matt Cockayne as part of the phpboyscout estate, alongside go-tool-base and the toolkit modules it composes. It is MIT licensed. The library is published on pkg.go.dev, its design lives in the specifications and reports on the project wiki, the source and issues are on GitLab, and the branding page has the mark and the palette if you need them.