Thanks to visit codestin.com
Credit goes to github.com

Skip to content

jsulmont/cl-mcp-server

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CL-MCP-Server

Model Context Protocol server for Common Lisp code evaluation

Enable Claude and other AI agents to evaluate Common Lisp code in a persistent, stateful REPL session over the Model Context Protocol (MCP).

License: MIT


What is This?

CL-MCP-Server is an MCP server implementation that provides Claude with the ability to:

  • Evaluate Common Lisp expressions in a live REPL environment
  • Maintain persistent state across evaluations (functions, variables, loaded systems)
  • Capture rich output (return values, stdout, stderr, warnings, backtraces)
  • Handle errors gracefully using Common Lisp's condition system
  • Support incremental development with stateful session management

Unlike one-shot code execution, CL-MCP-Server provides a full REPL experience where definitions accumulate and state persists, enabling interactive exploratory programming through Claude.

Value Proposition

For Claude Users

  • Persistent REPL: Define functions once, use them repeatedly in the same session
  • Rich Error Reporting: Get detailed backtraces and condition information when things go wrong
  • Stream Separation: Clearly distinguish between return values, printed output, and warnings
  • Safe Execution: Server never crashes—all user code errors are caught and reported

For Developers

  • Standard Protocol: Uses MCP and JSON-RPC 2.0 for interoperability
  • Formally Specified: Complete Canon specification in canon/ directory
  • Well-Tested: Comprehensive test suite covering protocol, evaluation, and error handling
  • Extensible: Clean architecture supports adding new tools and capabilities

For AI Agents

  • Formal Contracts: Machine-readable specifications in canon/features/
  • Predictable Behavior: Documented invariants and properties
  • JSON Schema: Structured request/response formats
  • Standard Transport: stdio-based communication

Quick Start

Prerequisites

Installation

  1. Clone the repository:
git clone https://github.com/quasi/cl-mcp-server.git
cd cl-mcp-server
  1. Load dependencies (Quicklisp will install them automatically):
sbcl --load cl-mcp-server.asd \
     --eval "(ql:quickload :cl-mcp-server)" \
     --quit
  1. Configure Claude Code:
claude mcp add --scope user --transport stdio lisp -- sbcl --script /path/to/cl-mcp-server/run-server.lisp
  1. Configure Claude Desktop to use the server (optionally):
{
  "mcpServers": {
    "lisp": {
      "command": "sbcl",
      "args": [
        "--load", "/path/to/cl-mcp-server/run-server.lisp"
      ]
    }
  }
}

Usage Example

User: Please evaluate (+ 1 2 3)
Claude: => 6

User: Define a function to calculate factorial
Claude: (evaluating)
        (defun factorial (n)
          (if (<= n 1) 1 (* n (factorial (- n 1)))))
        => FACTORIAL

User: What is 10 factorial?
Claude: (evaluating) (factorial 10)
        => 3628800

See the Quickstart Guide for a complete walkthrough.

Documentation

For Users

For Contributors

For External Agents

Features

  • MCP Protocol: Standards-compliant JSON-RPC 2.0 over stdio
  • Persistent Session: State persists across all evaluations
  • Rich Output: Separates return values, stdout, stderr, and warnings
  • Error Handling: Captures and reports conditions with backtraces
  • Multiple Values: Full support for Common Lisp's multiple return values
  • Safety: Server isolation prevents user code from crashing the server
  • Stream Capture: All output streams are captured during evaluation

Architecture

┌──────────────────────────────────────┐
│         MCP Client (Claude)          │
└──────────────┬───────────────────────┘
               │ JSON-RPC over stdio
               │
┌──────────────▼───────────────────────┐
│         CL-MCP-Server                 │
│  ┌────────────────────────────────┐   │
│  │  Protocol Layer (JSON-RPC)     │   │
│  └──────────────┬─────────────────┘   │
│                 │                     │
│  ┌──────────────▼─────────────────┐  │
│  │  Tool Layer (evaluate-lisp)     │  │
│  └──────────────┬──────────────────┘  │
│                 │                     │
│  ┌──────────────▼─────────────────┐  │
│  │  Evaluator (with error capture) │  │
│  └──────────────┬──────────────────┘  │
│                 │                     │
│  ┌──────────────▼─────────────────┐  │
│  │  Session (persistent state)     │  │
│  └─────────────────────────────────┘  │
└───────────────────────────────────────┘

See Architecture Explanation for details.

Testing

Run the full test suite:

sbcl --load cl-mcp-server.asd \
     --eval "(ql:quickload :cl-mcp-server/tests)" \
     --eval "(asdf:test-system :cl-mcp-server)"

Project Status

Version: 0.1.0

Status: Working. Alpa (human testing required). proof-of-concept. The core functionality is working and tested, but the API may change.

Contributing

Contributions are welcome! Please:

  1. Read AGENT.md for contributor guidelines
  2. Review canon/ for formal specifications
  3. Check open issues for tasks
  4. Submit pull requests with tests

License

MIT License

Authors

Changelog

Version 0.1.0 (2026-01-22)

Initial Release

  • MCP protocol implementation (JSON-RPC 2.0 over stdio)
  • evaluate-lisp tool with persistent session
  • Error handling with condition capture and backtraces
  • Output stream separation (values, stdout, stderr, warnings)
  • Multiple return values support
  • Comprehensive test suite (95%+ coverage)
  • Canon specification for formal verification
  • User documentation and tutorials

Ready to get started?Quickstart Guide

Questions?Documentation

Want to contribute?AGENT.md

About

MCP Server for Common Lisp

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Common Lisp 100.0%