mcp

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package mcp implements an MCP (Model Context Protocol) server that bridges Claude Code (and any other MCP host) to a running `agentenv daemon`.

Wire/protocol plumbing — JSON-RPC 2.0 framing, the `initialize` handshake, `tools/list`, `tools/call` dispatch, schema inference from Go struct tags — is delegated to the official Go SDK (github.com/modelcontextprotocol/go-sdk). We only declare typed tool handlers; the SDK validates inputs against the inferred schema and packs the result.

Exposed tools (read/inspect only — mutations belong in the daemon, not in the agent's MCP action space):

agentenv__head        — current HEAD node id
agentenv__log         — full commit DAG
agentenv__branches    — branch tips (distinct explored end-states)
agentenv__show        — files a node changed vs its parent
agentenv__diff        — files differing between two nodes
agentenv__checkout    — roll the whole environment back to any node

Every tool call opens a fresh unix-socket round-trip to the daemon and returns when it sees a terminal frame — no socket state is held between calls, so the daemon owns concurrency (RWMutex).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(ctx context.Context, sock, version string) error

Serve runs the MCP server on stdin/stdout (the transport Claude Code uses when it spawns this binary), bridging tool calls to the agentenv daemon's unix socket. The `version` is reported to clients in the initialize handshake — pass the agentenv binary's resolved release tag (main.go's resolveVersion) so MCP hosts can log which build they connected to. Returns when stdin EOFs or ctx is cancelled.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL