### Start CL-MCP-Server Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/quickstart.md This command starts the CL-MCP-Server, initializing the MCP protocol handler and setting up stdio transport. It can be run directly or via SBCL with specific evaluation commands. ```bash ./run-server.lisp ``` ```bash sbcl --load cl-mcp-server.asd \ --eval "(ql:quickload :cl-mcp-server)" \ --eval "(cl-mcp-server:start)" ``` -------------------------------- ### Setup and Load CL-MCP-Server System (Common Lisp) Source: https://github.com/quasi/cl-mcp-server/blob/main/AGENT.md Commands to set up the development environment by ensuring Quicklisp is installed and then loading the cl-mcp-server system using ASDF. This is a prerequisite for running or testing the server. ```bash # Ensure Quicklisp is installed sbcl --load ~/quicklisp/setup.lisp # Load the system sbcl --load cl-mcp-server.asd --eval "(ql:quickload :cl-mcp-server)" ``` -------------------------------- ### Load CL-MCP-Server System with SBCL Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/quickstart.md This command loads the CL-MCP-Server system using SBCL, which handles dependency loading and compilation. It requires SBCL and Quicklisp to be installed and configured. ```bash sbcl --load cl-mcp-server.asd \ --eval "(ql:quickload :cl-mcp-server)" ``` -------------------------------- ### Clone CL-MCP-Server Repository Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/quickstart.md This command clones the CL-MCP-Server repository into your projects directory and navigates into it. Ensure you have git installed and replace `` with the actual URL of the repository. ```bash cd ~/projects git clone cl-mcp-server cd cl-mcp-server ``` -------------------------------- ### Starting CL-MCP-Server Source: https://context7.com/quasi/cl-mcp-server/llms.txt Provides instructions for starting the CL-MCP-Server using different methods, including direct execution, explicit SBCL invocation, and dependency loading for development. ```bash # Start server directly ./run-server.lisp ``` ```bash # Or with sbcl explicitly sbcl --load cl-mcp-server.asd \ --eval "(ql:quickload :cl-mcp-server)" \ --eval "(cl-mcp-server:start)" ``` ```bash # Load dependencies only (for development) sbcl --load cl-mcp-server.asd \ --eval "(ql:quickload :cl-mcp-server)" ``` -------------------------------- ### Create Launcher Script for CL-MCP-Server (Lisp) Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/plans/2026-01-22-05-mcp-server-integration.md Creates a shell script `run-server.lisp` that acts as a launcher for the CL-MCP-Server. It loads Quicklisp, loads the `cl-mcp-server` library, and then starts the server using the `cl-mcp-server:start` function. ```lisp #!/usr/bin/env sbcl --script ;;; run-server.lisp ;;; ABOUTME: Launcher script for CL-MCP-Server ;;; Load Quicklisp #-quicklisp (let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp" (user-homedir-pathname)))) (when (probe-file quicklisp-init) (load quicklisp-init))) ;;; Load the server (ql:quickload :cl-mcp-server :silent t) ;;; Run (cl-mcp-server:start) ``` -------------------------------- ### Troubleshoot SBCL Not Found Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/quickstart.md This bash command helps diagnose if SBCL is installed and accessible in your system's PATH. If the command does not return a path, SBCL is likely not installed or not configured correctly. ```bash which sbcl ``` -------------------------------- ### Install Quicklisp Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/how-to/troubleshooting.md Steps to install Quicklisp, a library manager for Common Lisp. This is necessary for managing and loading CL-MCP-Server dependencies. ```bash curl -O https://beta.quicklisp.org/quicklisp.lisp sbcl --load quicklisp.lisp --eval "(quicklisp-quickstart:install)" --quit ``` -------------------------------- ### Install Specific Quicklisp Distribution Version Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/how-to/load-quicklisp-systems.md Explains how to install a specific version of the Quicklisp distribution by providing a URL to a distinfo.txt file. This allows for precise control over the library versions available in the session. ```common-lisp ;; See available dist versions (ql-dist:available-versions (ql-dist:dist "quicklisp")) ;; Install a specific dist version (ql-dist:install-dist "http://beta.quicklisp.org/dist/quicklisp/2023-10-21/distinfo.txt" :replace t) ``` -------------------------------- ### Context Manifest Example (YAML) Source: https://github.com/quasi/cl-mcp-server/blob/main/canon/README-CANON.md An example of a `.context.yaml` file demonstrating how to specify essential files for understanding a feature and targeted paths for working on specific contracts. ```yaml # To understand mcp-protocol feature: essential: - core/foundation/vocabulary.md # Read these first - feature.yaml - contracts/initialization.md # To work on initialization contract specifically: per_contract: initialization: - contracts/initialization.md - scenarios/initialization-handshake.md ``` -------------------------------- ### Start CL-MCP-Server with Custom Initial Package Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/reference/configuration.md Demonstrates how to start CL-MCP-Server with a specific initial package using a runtime option. This allows the server to begin execution in a desired Common Lisp package. ```lisp (cl-mcp-server:start :initial-package :my-package) ``` -------------------------------- ### Server Startup and Configuration Source: https://context7.com/quasi/cl-mcp-server/llms.txt Instructions on how to start the CL-MCP-Server and configure AI clients like Claude Code or Claude Desktop to use it. ```APIDOC ## Server Startup and Configuration This section provides instructions for starting the CL-MCP-Server and configuring AI clients to connect to it. ### Starting the Server **Method 1: Start server directly** ```bash ./run-server.lisp ``` **Method 2: Start with sbcl explicitly** ```bash sbcl --load cl-mcp-server.asd \ --eval "(ql:quickload :cl-mcp-server)" \ --eval "(cl-mcp-server:start)" ``` **Method 3: Load dependencies only (for development)** ```bash sbcl --load cl-mcp-server.asd \ --eval "(ql:quickload :cl-mcp-server)" ``` ### Configuring AI Clients **1. Configure Claude Code CLI** ```bash claude mcp add --scope user --transport stdio lisp -- sbcl --script /path/to/cl-mcp-server/run-server.lisp ``` **2. Configure Claude Desktop (`~/.claude/mcp_config.json`)** ```json { "mcpServers": { "lisp": { "command": "sbcl", "args": [ "--load", "/path/to/cl-mcp-server/run-server.lisp" ] } } } ``` **Note:** Replace `/path/to/cl-mcp-server/` with the actual path to your CL-MCP-Server installation. ``` -------------------------------- ### Initialize Response Example (JSON) Source: https://github.com/quasi/cl-mcp-server/blob/main/canon/features/mcp-protocol/contracts/initialization.md An example of a server's 'initialize' response, conforming to the specified JSON schema. This shows the expected output after a successful initialization request. ```json { "jsonrpc": "2.0", "id": 1, "result": { "protocolVersion": "2025-03-26", "capabilities": { "tools": {} }, "serverInfo": { "name": "cl-mcp-server", "version": "0.1.0" } } } ``` -------------------------------- ### Install CL-MCP-Server with SBCL and Quicklisp Source: https://github.com/quasi/cl-mcp-server/blob/main/README.md This snippet shows how to clone the CL-MCP-Server repository and install its dependencies using SBCL and Quicklisp. It ensures that SBCL is available and Quicklisp is used to manage project-specific libraries. ```bash git clone https://github.com/quasi/cl-mcp-server.git cd cl-mcp-server sbcl --load cl-mcp-server.asd \ --eval "(ql:quickload :cl-mcp-server)" \ --quit ``` -------------------------------- ### Manually Install Dependencies (Bash) Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/reference/configuration.md This command manually installs a list of specified Common Lisp libraries using Quicklisp. It's useful for ensuring specific dependencies are present or for troubleshooting missing library errors. ```bash sbcl --eval "(ql:quickload '(:yason :alexandria :bordeaux-threads :trivial-backtrace))" --quit ``` -------------------------------- ### Complete CL-MCP-Server Session Example Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/reference/mcp-protocol.md Illustrates a typical interaction with the CL-MCP-Server, including initialization, listing tools, and executing a tool call. This example shows the request-response flow for various operations. ```text → {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}} ← {"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-03-26","capabilities":{"tools":{}},"serverInfo":{"name":"cl-mcp-server","version":"0.1.0"}}} → {"jsonrpc":"2.0","method":"notifications/initialized"} → {"jsonrpc":"2.0","id":2,"method":"tools/list"} ← {"jsonrpc":"2.0","id":2,"result":{"tools":[{"name":"evaluate-lisp","description":"...","inputSchema":{...}}]}} → {"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"evaluate-lisp","arguments":{"code":"(+ 1 2)"}}} ← {"jsonrpc":"2.0","id":3,"result":{"content":[{"type":"text","text":"=> 3"}],"isError":false}} ``` -------------------------------- ### Initialize Request Example (JSON) Source: https://github.com/quasi/cl-mcp-server/blob/main/canon/features/mcp-protocol/contracts/initialization.md An example of a client's 'initialize' request, adhering to the defined JSON schema. This demonstrates the expected format for initiating the handshake. ```json { "jsonrpc": "2.0", "id": 1, "method": "initialize", "params": { "protocolVersion": "2025-03-26", "capabilities": {}, "clientInfo": { "name": "claude-code", "version": "1.0.0" } } } ``` -------------------------------- ### Use Function Example - JSON Source: https://github.com/quasi/cl-mcp-server/blob/main/canon/features/session-management/INDEX.md An example JSON request to call the previously defined 'factorial' function with an argument. This showcases state persistence, as the function definition is available from a prior evaluation. ```json { "code": "(factorial 5)" } ``` -------------------------------- ### Check Quicklisp Installation (Bash) Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/reference/configuration.md This command checks if Quicklisp is installed and functional by attempting to load the 'yason' library. If successful, it indicates that Quicklisp is set up correctly and can manage Common Lisp libraries. ```bash sbcl --eval "(ql:quickload :yason)" --quit ``` -------------------------------- ### Define a Lisp Function Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/quickstart.md This Lisp code defines a function named 'greet' that takes one argument, 'name', and returns a formatted string. The function definition itself is evaluated. ```lisp (defun greet (name) (format nil "Hello, ~A!" name)) ``` -------------------------------- ### Tools List Example Request (JSON) Source: https://github.com/quasi/cl-mcp-server/blob/main/canon/features/mcp-protocol/contracts/tools-list.md An example of a JSON RPC request to the 'tools/list' method. This demonstrates the expected structure for querying the server's available tools. ```json { "jsonrpc": "2.0", "id": 2, "method": "tools/list" } ``` -------------------------------- ### Run CL-MCP-Server (Common Lisp) Source: https://github.com/quasi/cl-mcp-server/blob/main/AGENT.md Instructions to start the CL-MCP-Server, which facilitates communication between Claude and a Common Lisp instance. It can be started directly using SBCL or via a launcher script. ```bash # Start the MCP server sbcl --load cl-mcp-server.asd \ --eval "(ql:quickload :cl-mcp-server)" \ --eval "(cl-mcp-server:start)" # Or use the launcher script ./run-server.lisp ``` -------------------------------- ### Basic Lisp Arithmetic Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/quickstart.md This Lisp code snippet demonstrates a basic arithmetic operation, multiplying 7 by 6. The result is evaluated and displayed. ```lisp (* 7 6) ``` -------------------------------- ### Interactive Code Evaluation Example (Common Lisp) Source: https://github.com/quasi/cl-mcp-server/blob/main/AGENT.md An example session demonstrating interactive development in Common Lisp using the CL-MCP-Server. It shows defining, testing, and refining a function directly in the REPL. ```lisp ;; 1. Load system (ql:quickload :cl-mcp-server) ;; 2. Develop a helper function interactively (defun format-result (value) (format nil "=> ~S" value)) ;; 3. Test it (format-result 42) ;; => "=> 42" ;; 4. Refine it (defun format-result (value) (format nil "=> ~A" value)) ; Changed ~S to ~A ;; 5. Test again (format-result "hello") ;; => "=> hello" ;; 6. Now write to file (only after it works) ``` -------------------------------- ### Factorial Calculation Example in Common Lisp Source: https://github.com/quasi/cl-mcp-server/blob/main/README.md This example demonstrates calling a previously defined function (factorial) in Common Lisp via CL-MCP-Server. It shows how the server evaluates the function call and returns the computed result. ```lisp (factorial 10) => 3628800 ``` -------------------------------- ### Tools List Example Response (JSON) Source: https://github.com/quasi/cl-mcp-server/blob/main/canon/features/mcp-protocol/contracts/tools-list.md An example of a JSON RPC response from the 'tools/list' method. It includes a 'result' object containing an array of available tools, each detailed with its name, description, and input schema. ```json { "jsonrpc": "2.0", "id": 2, "result": { "tools": [ { "name": "evaluate-lisp", "description": "Evaluate Common Lisp code in a persistent REPL session. Definitions and variables persist across calls.", "inputSchema": { "type": "object", "required": ["code"], "properties": { "code": { "type": "string", "description": "Common Lisp expression(s) to evaluate" }, "package": { "type": "string", "description": "Package context for evaluation (default: CL-USER)" } } } }, { "name": "list-definitions", "description": "List functions, variables, and other definitions in the current session.", "inputSchema": { "type": "object", "properties": { "type": { "type": "string", "enum": ["all", "functions", "variables", "macros", "classes"], "description": "Filter by definition type (default: all)" } } } }, { "name": "reset-session", "description": "Clear all session state including definitions and variables. Start fresh.", "inputSchema": { "type": "object", "properties": {} } }, { "name": "load-system", "description": "Load an ASDF system using Quicklisp. The system becomes available for subsequent evaluations.", "inputSchema": { "type": "object", "required": ["system"], "properties": { "system": { "type": "string", "description": "ASDF system name to load" } } } } ] } } ``` -------------------------------- ### Common Lisp Function Definition Example Source: https://github.com/quasi/cl-mcp-server/blob/main/README.md This example shows a Common Lisp function definition for calculating factorial. It demonstrates how CL-MCP-Server can handle function definitions and subsequent evaluations within a persistent REPL session. ```lisp (defun factorial (n) (if (<= n 1) 1 (* n (factorial (- n 1))))) => FACTORIAL ``` -------------------------------- ### Evaluate Lisp Package Context Examples (JSON) Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/reference/evaluate-lisp.md Illustrates how to specify the package context for Common Lisp code evaluation using the 'evaluate-lisp' tool. Examples show switching packages and defining functions within a specific package. ```json {"code": "(in-package :my-package)", "package": "CL-USER"} ``` ```json {"code": "(defun foo () ...)", "package": "MY-PACKAGE"} ``` -------------------------------- ### Install SBCL on Fedora (Bash) Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/reference/configuration.md This command installs the SBCL Common Lisp implementation on Fedora Linux. It utilizes the `dnf` package manager for installation. ```bash dnf install sbcl ``` -------------------------------- ### Install SBCL on Arch Linux (Bash) Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/reference/configuration.md This command installs the SBCL Common Lisp implementation on Arch Linux. It uses the `pacman` package manager for installation. ```bash pacman -S sbcl ``` -------------------------------- ### Install SBCL on Debian/Ubuntu (Bash) Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/reference/configuration.md This command installs the SBCL Common Lisp implementation on Debian-based Linux distributions like Ubuntu. It uses the `apt-get` package manager to download and install SBCL. ```bash apt-get install sbcl ``` -------------------------------- ### Use a Defined Lisp Function Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/quickstart.md This Lisp code snippet calls the previously defined 'greet' function with the argument "World". The function's return value is then displayed, demonstrating function persistence within the session. ```lisp (greet "World") ``` -------------------------------- ### Check SBCL Installation (Bash) Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/reference/configuration.md This command verifies the SBCL installation by printing its version number. It's a basic troubleshooting step to ensure SBCL is correctly installed and accessible in the system's PATH. ```bash sbcl --version ``` -------------------------------- ### Default CL-MCP-Server Startup Script Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/reference/configuration.md A basic startup script for CL-MCP-Server using SBCL. It loads Quicklisp, loads the CL-MCP-Server system, and starts the server. This script is intended to be executed directly or via an MCP client. ```lisp #!/usr/bin/env sbcl --script ;;; Load Quicklisp (load "~/quicklisp/setup.lisp") ;;; Load system (ql:quickload :cl-mcp-server :silent t) ;;; Start server (cl-mcp-server:start) ``` -------------------------------- ### Start cl-mcp-server in Development Mode (Lisp) Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/reference/configuration.md This snippet shows how to load and start the cl-mcp-server system in development mode, allowing for direct execution of source files without compilation. It uses ASDF to load the system and then calls the start function. ```lisp (asdf:load-system :cl-mcp-server :force t) (cl-mcp-server:start) ``` -------------------------------- ### Test cl-mcp-server with Sample JSON-RPC Requests Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/plans/2026-01-22-05-mcp-server-integration.md Demonstrates how to test the cl-mcp-server by starting the server and then sending sample JSON-RPC requests to it. This involves running the server in one terminal and sending requests from another. It tests initialization, notifications, and Lisp code evaluation. ```bash # Start server (in one terminal) sbcl --load run-server.lisp # Send test messages (in another terminal) echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}} {"jsonrpc":"2.0","method":"notifications/initialized"} {"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"evaluate-lisp","arguments":{"code":"(defun hello () \"Hello, MCP!\")"}}} {"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"evaluate-lisp","arguments":{"code":"(hello)"}}}' | sbcl --load run-server.lisp ``` -------------------------------- ### Evaluate Basic Lisp Expression Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/tutorials/01-first-session.md This snippet demonstrates the most basic interaction with the CL-MCP-Server by evaluating a simple arithmetic expression in Lisp. It verifies the server connection and its ability to return results. ```common-lisp (+ 1 1) ``` -------------------------------- ### Tools Call Contract Example Request (JSON) Source: https://github.com/quasi/cl-mcp-server/blob/main/canon/features/mcp-protocol/contracts/tools-call.md An example of a JSON-RPC request to call the 'evaluate-lisp' tool with specific arguments. ```json { "jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": { "name": "evaluate-lisp", "arguments": { "code": "(+ 1 2 3)" } } } ``` -------------------------------- ### Tools Call Contract Success Response Example (JSON) Source: https://github.com/quasi/cl-mcp-server/blob/main/canon/features/mcp-protocol/contracts/tools-call.md Example of a successful JSON-RPC response containing the evaluation result of a tool. ```json { "jsonrpc": "2.0", "id": 3, "result": { "content": [ { "type": "text", "text": "=> 6" } ], "isError": false } } ``` -------------------------------- ### Load and Use a Library Immediately Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/how-to/load-quicklisp-systems.md Shows how to load a Quicklisp library and immediately use its functions within a `progn` block. This is useful for quick, one-off operations. ```common-lisp ;; Load and immediately use (progn (ql:quickload :str) (str:concat "Hello" " " "World")) ;; => "Hello World" ``` -------------------------------- ### Tools Call Contract Protocol Error Example (JSON) Source: https://github.com/quasi/cl-mcp-server/blob/main/canon/features/mcp-protocol/contracts/tools-call.md Example JSON-RPC error response for protocol-level issues, such as an unknown tool name. ```json { "jsonrpc": "2.0", "id": 7, "error": { "code": -32602, "message": "Unknown tool: invalid-tool-name" } } ``` -------------------------------- ### Tools Call Contract Multi-Value Results Example (JSON) Source: https://github.com/quasi/cl-mcp-server/blob/main/canon/features/mcp-protocol/contracts/tools-call.md Example JSON-RPC response demonstrating multiple values returned from a tool evaluation. ```json { "jsonrpc": "2.0", "id": 4, "result": { "content": [ { "type": "text", "text": "=> 3\n=> 1" } ], "isError": false } } ``` -------------------------------- ### Custom Quicklisp Location in Startup Script Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/reference/configuration.md Demonstrates how to specify a custom path for Quicklisp within the CL-MCP-Server startup script. This is useful when Quicklisp is not installed in the default user home directory. ```lisp (load "/custom/path/to/quicklisp/setup.lisp") ``` -------------------------------- ### Load System Directly with ASDF Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/how-to/load-quicklisp-systems.md Demonstrates loading a Common Lisp system directly using `asdf:load-system`. This method is typically used for systems that are already present locally and does not involve downloading from the internet. ```common-lisp ;; Load via ASDF (for local systems) (asdf:load-system :my-local-system) ``` -------------------------------- ### Install SBCL Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/how-to/troubleshooting.md Instructions for installing the Steel Bank Common Lisp (SBCL) implementation on different operating systems. SBCL is a prerequisite for running CL-MCP-Server. ```bash # macOS brew install sbcl # Ubuntu/Debian apt-get install sbcl # Windows: Download from http://www.sbcl.org/ ``` -------------------------------- ### Start CL-MCP-Server with SBCL Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/reference/mcp-protocol.md Command to start the CL-MCP-Server using SBCL. This command loads the necessary Lisp system and begins listening for JSON-RPC messages on stdin. ```bash sbcl --load run-server.lisp ``` -------------------------------- ### Tools Call Contract Response with Output Example (JSON) Source: https://github.com/quasi/cl-mcp-server/blob/main/canon/features/mcp-protocol/contracts/tools-call.md Example JSON-RPC response showing tool output (stdout/stderr) alongside the evaluation result. ```json { "jsonrpc": "2.0", "id": 5, "result": { "content": [ { "type": "text", "text": "[stdout]\nHello, World!\n\n[stderr]\nWarning: deprecated function\n\n=> NIL" } ], "isError": false } } ``` -------------------------------- ### Interactive Development Setup (Common Lisp) Source: https://github.com/quasi/cl-mcp-server/blob/main/AGENT.md Steps to load the CL-MCP-Server system into a running SBCL REPL for interactive development. This allows for immediate testing and iteration of code. ```lisp sbcl * (ql:quickload :cl-mcp-server) * (in-package :cl-mcp-server) ``` -------------------------------- ### JSON-RPC Request Message Example Source: https://github.com/quasi/cl-mcp-server/blob/main/canon/features/mcp-protocol/contracts/transport.md Example of a JSON-RPC request message. Requests must include a unique 'id' and a 'method' to be invoked on the server, and they expect a corresponding response. ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/list" } ``` -------------------------------- ### Configure Claude Code for CL-MCP-Server Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/quickstart.md This JSON configuration snippet shows how to add the CL-MCP-Server to your Claude Code settings, specifying the command to launch the server. The exact location of the configuration file varies by platform. ```json { "mcpServers": { "lisp": { "command": "/path/to/cl-mcp-server/run-server.lisp" } } } ``` -------------------------------- ### Scenario-Based Testing Example Source: https://github.com/quasi/cl-mcp-server/blob/main/AGENT.md Demonstrates scenario-based testing using a specific evaluation scenario. It shows how to create a request, handle a tool call, and assert the expected result and error status. ```lisp ;; From canon/features/code-evaluator/scenarios/basic-evaluation.md (test arithmetic-expression (let ((request (make-request :code "(+ 1 2 3)"))) (let ((response (handle-tools-call request))) (is (equal "=> 6" (extract-result-text response))) (is (not (response-is-error-p response)))))) ``` -------------------------------- ### Define Function Example - JSON Source: https://github.com/quasi/cl-mcp-server/blob/main/canon/features/session-management/INDEX.md An example JSON request to define a function named 'factorial' within the session. This demonstrates how code definitions are sent for evaluation. ```json { "code": "(defun factorial (n) (if (<= n 1) 1 (* n (factorial (1- n)))))" } ``` -------------------------------- ### Tools Call Contract Tool Execution Error Example (JSON) Source: https://github.com/quasi/cl-mcp-server/blob/main/canon/features/mcp-protocol/contracts/tools-call.md Example JSON-RPC response indicating a tool execution error, including error details and backtrace. ```json { "jsonrpc": "2.0", "id": 6, "result": { "content": [ { "type": "text", "text": "[ERROR] UNDEFINED-FUNCTION\nThe function NONEXISTENT-FUNCTION is undefined.\n\n[Backtrace]\n0: (NONEXISTENT-FUNCTION)\n1: (EVAL (NONEXISTENT-FUNCTION))\n..." } ], "isError": true } } ``` -------------------------------- ### Search for Quicklisp Systems Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/how-to/load-quicklisp-systems.md Provides Common Lisp code snippets for searching available Quicklisp systems. `ql:system-apropos` searches for systems matching a pattern, while `ql:system-list` lists all available systems. ```common-lisp ;; Search for systems matching a pattern (returns many results) (ql:system-apropos "json") ;; List all available systems (very long output) (length (ql:system-list)) ``` -------------------------------- ### JSON-RPC Success Response Message Example Source: https://github.com/quasi/cl-mcp-server/blob/main/canon/features/mcp-protocol/contracts/transport.md Example of a successful JSON-RPC response message. Successful responses include the original 'id' and a 'result' field containing the outcome of the request. ```json { "jsonrpc": "2.0", "id": 1, "result": {...} } ``` -------------------------------- ### Load ASDF System (load-system) Source: https://context7.com/quasi/cl-mcp-server/llms.txt Demonstrates how to load an ASDF system by its name using the load-system tool. The system must be accessible via Quicklisp or the ASDF registry. Examples show both successful loading and failure due to a non-existent system. ```json { "jsonrpc": "2.0", "id": 20, "method": "tools/call", "params": { "name": "load-system", "arguments": { "system-name": "alexandria" } } } { "jsonrpc": "2.0", "id": 20, "result": { "content": [{"type": "text", "text": "System alexandria loaded successfully."}], "isError": false } } { "jsonrpc": "2.0", "id": 20, "result": { "content": [{"type": "text", "text": "Error loading system nonexistent-system: Component \"nonexistent-system\" not found"}], "isError": false } } ``` -------------------------------- ### Load System and Handle Errors (Lisp) Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/plans/2026-01-22-05-mcp-server-integration.md Loads a specified system using Quicklisp and handles potential errors during the loading process. It returns a success message or an error message with type and details. ```lisp (handler-case (progn (ql:quickload system-name :silent t) (values (format nil "Loaded: ~a" system-name) nil)) (error (c) (values (format nil "[ERROR] ~a~%~a" (type-of c) (princ-to-string c)) t)))) ``` -------------------------------- ### JSON-RPC Error Response Message Example Source: https://github.com/quasi/cl-mcp-server/blob/main/canon/features/mcp-protocol/contracts/transport.md Example of an error JSON-RPC response message. Error responses contain the original 'id' and an 'error' object detailing the error code and message. ```json { "jsonrpc": "2.0", "id": 1, "error": { "code": -32600, "message": "Invalid Request" } } ``` -------------------------------- ### Test Temperature Formatting Source: https://github.com/quasi/cl-mcp-server/blob/main/docs/tutorials/01-first-session.md This snippet tests the `format-temp` function by applying it to both a direct numerical value and the result of a temperature conversion. It verifies that the output strings are correctly formatted with one decimal place and the appropriate unit. ```common-lisp (format-temp 25.5 "C") ``` ```common-lisp (format-temp (c-to-f 25) "F") ```