---
title: internal/mcp
description: Go API reference for the mcp package.
---
# mcp
```go
import "github.com/jbcom/radioactive-ralph/internal/mcp"
```
Package mcp wraps modelcontextprotocol/go\-sdk to expose Ralph's plan\-DAG and variant\-pool surface as MCP tools. Claude Code talks to the binary through this server over stdio; the binary remains the durable product surface and MCP is the structured control plane.
## Index
- [type Options](<#Options>)
- [type Server](<#Server>)
- [func New\(o Options\) \(\*Server, error\)](<#New>)
- [func \(s \*Server\) MCPServer\(\) \*mcpsdk.Server](<#Server.MCPServer>)
- [func \(s \*Server\) ServeStdio\(ctx context.Context\) error](<#Server.ServeStdio>)
## type [Options]()
Options configures Server creation.
```go
type Options struct {
// Store is the plandag handle backing every plan.* tool.
Store *plandag.Store
// Pool is the variantpool handle backing every variant.* tool.
Pool *variantpool.Pool
// SessionID is the plandag session this server runs under. Both
// the plandag CRUD tools and the variantpool tools are scoped
// to this session.
SessionID string
// ServerInfo identifies us in the MCP handshake.
ServerInfo *mcpsdk.Implementation
}
```
## type [Server]()
Server bundles the registered MCP server with its options.
```go
type Server struct {
// contains filtered or unexported fields
}
```
### func [New]()
```go
func New(o Options) (*Server, error)
```
New builds an MCP server with every Ralph tool registered.
### func \(\*Server\) [MCPServer]()
```go
func (s *Server) MCPServer() *mcpsdk.Server
```
MCPServer returns the underlying SDK server. Useful for tests that drive the server via in\-memory transports.
### func \(\*Server\) [ServeStdio]()
```go
func (s *Server) ServeStdio(ctx context.Context) error
```
ServeStdio runs the MCP server over the stdio transport. Blocks until the client closes the connection or ctx is canceled.
Used by the portable mode CLI \(\`radioactive\_ralph serve \-\-mcp\`\). One process = one MCP session; the spawning Claude session owns the lifetime.
Generated by [gomarkdoc]()