40ants-lisp-dev-mcp - MCP which gives LLM tools for working with running Lisp image.

40ANTS-LISP-DEV-MCP ASDF System Details

Installation

You can install this library from Quicklisp, but you want to receive updates quickly, then install it from Ultralisp.org:

(ql-dist:install-dist "http://dist.ultralisp.org/"
                      :prompt nil)

then:

ros install 40ants/lisp-dev-mcp

Usage

Running in stdio mode

Here is an example config to add lisp-dev-mcp to Qwen:

{
  "mcpServers": {
    "lisp-dev": {
      "command": "lisp-dev-mcp",
      "args": []
    }
  },
  "$version": 2
}

If you want to debug MCP server, then you might start it will logging output and a SLYNK port opened:

{
  "mcpServers": {
    "lisp-dev": {
      "command": "lisp-dev-mcp",
      "args": ["--log", "mcp.log", "--verbose"],
      "env": {
        "SLYNK_PORT": "9991"
      }
    }
  },
  "$version": 2
}

Running in HTTP streaming mode

With OpenCode

Let the server pick a free port and record it into opencode.json automatically. Start the lisp process:

qlot exec roswell/lisp-dev-mcp.ros --port auto --update-config

or, from the REPL:

(ql:quickload :40ants-lisp-dev-mcp)

(40ants-lisp-dev-mcp/core:start-server :port :auto :update-config t)

The server reuses the port already recorded in opencode.json when it is still free, otherwise it chooses a new one and writes http://localhost:<port>/mcp into the mcp.lisp-dev-mcp.url key. The resulting config is picked up by OpenCode without any manual editing:

{
    "$schema": "https://opencode.ai/config.json",
    "mcp": {
        "lisp-dev-mcp": {
            "type": "remote",
            "url": "http://localhost:<port>/mcp"
        }
    }
}

With a fixed port (other IDEs)

For clients that use a different config format, or when you prefer a fixed port, pass an explicit port number. Start the lisp process:

qlot exec roswell/lisp-dev-mcp.ros --port 7890

or in the REPL:

(ql:quickload :40ants-lisp-dev-mcp)

(40ants-lisp-dev-mcp/core:start-server :port 7890)

then configure your IDE:

{
  "mcpServers": {
    "lisp-dev": {
      "url": "http://localhost:7890/mcp"
    }
  },
  "$version": 2
}

API

40ANTS-LISP-DEV-MCP/CORE

Functions

function
port &key (config \*opencode-config-pathname\*)

Resolves PORT into a concrete TCP port number and returns it as the first value.

As the second value returns T when the resolved port differs from the one recorded in the Opencode config.

PORT can be: - an INTEGER, used as-is after checking it is free; - the :AUTO keyword (or the string "auto"), in which case a free port is selected automatically, reusing the port from the Opencode config when it is still available.

function
&key (config \*opencode-config-pathname\*)

Returns the port recorded in the Opencode config, or NIL.

function
&key port (in-thread t) update-config (opencode-config \*opencode-config-pathname\*)

Starts the MCP server.

PORT controls the transport and the port: - NIL (the default) uses the stdio transport; - an INTEGER uses the Streaming HTTP transport on that TCP port; - :AUTO selects a free TCP port automatically, reusing the port from the Opencode config when it is still available.

IN-THREAD controls whether the server runs in a background thread (the default) or blocks the caller.

When UPDATE-CONFIG is true and a port was selected (or reused), the chosen port is written into the Opencode config file pointed to by OPENCODE-CONFIG (which defaults to *opencode-config-pathname*).

Returns the server thread when IN-THREAD is true, otherwise blocks.

function
port &key (config \*opencode-config-pathname\*)

Writes the given PORT into the Opencode config file, creating a default config when the file does not exist yet.

Variables

Pathname of the Opencode config file which is updated when start-server is called with :UPDATE-CONFIG T.

You can rebind this special variable or pass an explicit :OPENCODE-CONFIG argument to start-server, choose-port, get-port-from-assistant-config and update-port-in-config.