mcp
40ANTS-MCP is a framework for building Model Context Protocol servers in Common Lisp
claude mcp add --transport stdio 40ants-mcp ros -Q -- $0 \ --env SBCL_HOME="path to SBCL home (if using SBCL)" \ --env ROSSEARCH_PATH="path to Roswell or ASDF setup (optional)"
How to use
40ants-mcp is a Lisp-based framework for building MCP (Model Context Protocol) servers and clients. It provides a complete MCP implementation with an API for defining tools, handling JSON-RPC requests, and streaming content via supported transports. The library is designed to work with Common Lisp ecosystems and OpenRPC, enabling you to define tools that return content items (commonly text-content) and expose them through an MCP server. Use it to create AI-assisted assistants, chat tools, or service endpoints that can be consumed by MCP clients or AI agents.
To use it, install the library via your preferred Common Lisp environment (e.g., Quicklisp or Ultralisp) and load the MCP framework. You then define an API for your tools, implement individual tools with input parameters and results, and start the server so clients can send JSON-RPC requests. The examples show how to define a set of tools, register them under an API, and run the server, either as a long-running process or via a Roswell script for production deployments.
How to install
Prerequisites:
- A Common Lisp environment (SBCL recommended).
- Quicklisp or Ultralisp for easy package management.
- Roswell for scripting and running Lisp quickly (optional but recommended for production scripts).
Installation steps:
-
Install Quicklisp (if not already installed):
- Download and install from https://www.quicklisp.org/bundle/quicklisp.lisp
- In the Lisp REPL, load and install the system:
(ql:quickload :40ants-mcp)
-
Alternatively, install via Ultralisp for quicker access to bleeding-edge versions:
- Add Ultralisp dist and install:
(ql-dist:install-dist "http://dist.ultralisp.org/" :prompt nil) (ql:quickload :40ants-mcp)
-
If you prefer script-based execution, install Roswell and build/run a Roswell script that loads 40ants-mcp and starts your server:
- Install Roswell from https://www.roswell.org/
- Create a ROS script that quickloads the library and starts the MCP server, for example:
(ql:quickload '(:40ants-mcp)) (defun main (&rest argv) ;; Start the MCP server with your tool definition here (40ants-mcp/server/definition:start-server my-tools))
-
Run your server script as a background service or via a Roswell invocation, depending on your deployment needs.
Additional notes
Notes and tips:
- This MCP framework is designed for Common Lisp environments and OpenRPC integration. Ensure you have a compatible Lisp implementation (SBCL is common) and that your package manager (Quicklisp/Ultralisp) can resolve 40ants-mcp dependencies.
- When designing tools, return content items as a list, typically using text-content, but you can use other content types defined in the library (e.g., structured content) per the MCP specification.
- If running over HTTP, you’ll typically deploy an HTTP transport (provided by 40ants-mcp) that handles JSON-RPC messages. For STDIO-based workflows, you can leverage the STDIO transport as well.
- Keep an eye on the project roadmap for MCP specification alignment, resource serving, prompts templating, and client-side protocol development.
- If you encounter issues with dependencies, ensure you load all required libraries listed in the ASDF system and that your environment variables for CL paths and libraries are correctly set.