ADR-0007: An MCP server for AI coding assistants¶
- Status: Accepted
- Date: 2026-10-24
Context¶
AI coding assistants (Claude Code, Cursor, Copilot, Windsurf, Codex) start dev servers
for their users and hit "port already in use" like everyone else. Without help they
guess: run lsof, parse it, kill -9 whatever they find. The Model Context Protocol
(MCP) lets a program offer them typed tools instead.
Decision¶
portcheck mcpserves MCP on stdin/stdout, with the official Go SDK (github.com/modelcontextprotocol/go-sdk).- Five tools, mirroring commands:
list_ports,check_port,find_free_port,wait_for_portandstop_process. Like the browser host (ADR-0005), each runs the command in-process with--jsonand returns its schema v1 output with the exit code explained, so assistants see what the CLI prints. Inputs are validated into a fixed set of arguments;--allow-systemis never passed. - Safety:
stop_processis annotated destructive (assistants ask the user first) and keepskill's guards. The assistant is portcheck's parent process, so it can't be stopped.
Consequences¶
- The SDK adds dependencies (JSON schema, OAuth for HTTP transports we don't use); govulncheck covers them.
- New tools must stay thin wrappers over commands, so the CLI remains the single source of behaviour.