Code Reference

July 3, 2026 ยท View on GitHub

This document is the source-level map of cl-tron-mcp: what each subsystem does, where the main entry points live, and which files you usually need to read or modify for a given kind of change.

System at a Glance

Tron is an MCP server that sits between an MCP client and a live Lisp session:

  1. The MCP client starts Tron through start-mcp.sh.
  2. Tron serves MCP over stdio or HTTP and exposes tools, resources, prompts, and approval flow.
  3. Tron connects to Swank and uses that connection to evaluate code, inspect objects, read debugger state, invoke restarts, and hot-reload definitions inside the target Lisp session.

The canonical ASDF definitions live in cl-tron-mcp.asd.

Repository Layout

PathPurpose
src/core/Server lifecycle, configuration, metrics, errors, request tracing
src/protocol/JSON-RPC request parsing and MCP method handlers
src/transport/stdio, HTTP/Hunchentoot, and WebSocket transport entry points
src/tools/Tool registry plus MCP-facing tool definitions
src/swank/Swank client protocol, RPC, event handling, process management
src/unified/Unified repl_* abstraction layered on top of Swank
src/debugger/Debugger-oriented helpers such as frames, restarts, and breakpoints
src/inspector/Object, package, class, and function inspection
src/hot-reload/Local fallback compilation/reload helpers
src/profiler/Profiling start/stop/report behavior
src/tracer/Function tracing
src/monitor/Health and runtime statistics
src/logging/log4cl integration and stdout/stderr safety
src/xref/Cross-reference utilities such as who_calls
src/security/Approval requests, whitelist handling, audit logging
src/resources/MCP resources/list and resources/read support
src/prompts/MCP prompts/list and prompts/get support
tests/Rove unit/integration coverage for protocol, tools, startup, and Swank
docs/User docs, developer docs, tool reference, architecture docs
examples/MCP client configuration examples and example clients
scripts/Helper scripts for demos and MCP debugging

Runtime Entry Points

Starting and Stopping the MCP Server

Protocol Dispatch

Tool Registration

Tool Surface

The current registry contains 91 tools.

CategoryFileCountNotes
Inspectorsrc/tools/inspector-tools.lisp5Runtime object and symbol inspection
Debuggersrc/tools/debugger-tools.lisp7Frames, restarts, breakpoints, frame stepping
REPLsrc/tools/repl-tools.lisp1Legacy direct REPL entrypoint
Hot reloadsrc/tools/hot-reload-tools.lisp2Local compile/load fallback and ASDF reload
Profilersrc/tools/profiler-tools.lisp3Start, stop, report
Tracersrc/tools/tracer-tools.lisp3Add/remove/list traces
Threadssrc/tools/thread-tools.lisp3Thread inspection and backtrace
Monitorsrc/tools/monitor-tools.lisp4Health, runtime stats, GC, system info
Loggingsrc/tools/logging-tools.lisp5log4cl control and message emission
XRefsrc/tools/xref-tools.lisp5who_* and callee inspection
Securitysrc/tools/security-tools.lisp5Approval whitelist management
Swanksrc/tools/swank-tools.lisp21Raw Swank-oriented workflow
Managed processessrc/tools/process-tools.lisp4Launch/list/status/kill SBCL+Swank children
Unified REPLsrc/tools/unified-tools.lisp24Preferred repl_* workflow for agents

Use docs/tools/index.md for the human-readable catalog of every tool page.

Subsystem Guide

Swank Integration

Read these first if the change touches connection state, debugger behavior, evaluation, or REPL tools:

Debugger Flow

If you need stack frames, restarts, breakpoints, or stepping:

Hot Reload

Approval and Security

HTTP / stdio Transport

Scripts and Operational Files

FilePurpose
start-mcp.shPrimary entrypoint for users and MCP clients
run-mcp.shOptional wrapper that enters devenv before starting Tron
create_configs.shGenerate MCP client config files
scripts/debug-mcp-stdio.shCapture stdio startup output for debugging
scripts/run-http-server.lispHelper for HTTP-centric workflows
devenv.nixOptional Nix/devenv development shell

Test Layout

FileFocus
tests/core-test.lispcore helpers and version/config behavior
tests/protocol-test.lispMCP protocol handler behavior
tests/security-test.lispapproval flow and whitelist logic
tests/transport-test.lisptransport startup/response behavior
tests/swank-test.lispSwank client behavior without full live workflow
tests/swank-integration-test.lisplive Swank integration
tests/mcp-e2e-test.lisptop-to-bottom MCP protocol coverage
tests/hot-reload-test.lispcompile/load and reload behavior
tests/process-manager-test.lispmanaged Swank subprocess lifecycle

Run the full suite with:

(asdf:test-system :cl-tron-mcp)

Common Change Recipes

Add a New Tool

  1. Implement the behavior in the relevant subsystem under src/<area>/.
  2. Register the MCP-facing tool in src/tools/<category>-tools.lisp.
  3. Ensure the symbol is exported from the package file for that subsystem.
  4. Add or extend tests in tests/.
  5. Add a tool reference page in docs/tools/.

Change Startup Behavior

  1. Update start-mcp.sh if the change affects CLI behavior or process startup.
  2. Update src/core/server.lisp if the change affects transport orchestration.
  3. Update docs/starting-the-mcp.md and README.md.

Change Debugger / Hot Reload Behavior

  1. Trace the relevant Swank RPC path in src/swank/.
  2. Update the MCP wrapper in src/tools/.
  3. Add regression tests in tests/swank-integration-test.lisp, tests/mcp-e2e-test.lisp, or tests/hot-reload-test.lisp as appropriate.

Known Boundaries and Caveats

  • The most reliable workflow is still one long-running SBCL session with Swank; Tron is a client of that session, not a replacement for it.
  • repl_* tools are the higher-level API; swank_* tools expose lower-level Swank behavior.
  • The local hot-reload fallback is useful for startup and non-connected scenarios, but the richest debugger and restart workflows require a live Swank connection.
  • run-mcp.sh is a convenience wrapper for Nix/devenv users, not the canonical install path for ordinary Quicklisp users.