Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

nrepl-mcp-server

MCP.Pizza Chef: JohanCodinha

The nrepl-mcp-server is an MCP server that connects to a running Clojure nREPL instance, enabling real-time evaluation of Clojure code, inspection of namespaces, and retrieval of connection status. It supports listing project namespaces, inspecting public vars with metadata, and integrates seamlessly with MCP clients like Claude Desktop and CLine in VSCode, facilitating advanced Clojure development workflows.

Use This MCP server To

Evaluate Clojure code dynamically within an MCP client Inspect and list namespaces in a Clojure project Retrieve and monitor nREPL connection and session status Explore public vars and their metadata in namespaces Integrate Clojure REPL capabilities into AI-assisted coding tools

README

nREPL MCP Server

A Model Context Protocol (MCP) server designed for MCP clients, such as Claude Desktop or CLine in VSCode. This server can be used with any LLM when used with CLine. This server enables interaction with a running Clojure nREPL instance, allowing evaluation of Clojure code, namespace inspection, and other utilities via MCP.


Features

  • Connect to a running nREPL server by specifying host and port.
  • Evaluate Clojure code in a given namespace or the current one.
  • List project namespaces using tools.namespace.
  • Retrieve nREPL connection status, including host, port, and session details.
  • Inspect public vars in any Clojure namespace, displaying metadata such as docstrings and values.

Installation & Setup

Installing in CLine (VSCode) or Claude Desktop

To use this server with CLine or Claude Desktop, follow these steps:

  1. Open CLine in VSCode or Claude Desktop.
  2. Navigate to the MCP Settings.
  3. Add a new MCP server with the following configuration:
    {
      "mcpServers": {
        "nrepl-mcp-server": {
          "command": "npx",
          "args": [
            "nrepl-mcp-server"
          ],
          "disabled": false,
          "autoApprove": []
        }
      }
    }
  4. Save and restart the client to apply changes.

This will allow the client to communicate with the nREPL MCP server via standard input/output.

Install via npx

To quickly run the server without cloning the repository:

npx nrepl-mcp-server

Manual Installation

  1. Clone the repository

  2. Install dependencies

    npm install
  3. Build the project (transpiles TypeScript to JavaScript)

    npm run build
  4. Run the server

    • Production Mode: Runs from compiled output.
      npm start
    • Development Mode: Uses ts-node for live changes.
      npm run dev

This starts the server, listening on STDIO for MCP requests. Mcp client will start the server for you.


Actions

Connecting to nREPL

Allows establishing a connection to an nREPL server by specifying a host and port.

Evaluating Clojure Code

Executes arbitrary Clojure expressions in either the default namespace or a specified namespace.

Retrieving Namespace Information

Lists all namespaces in the current project directory using tools.namespace.

Inspecting Public Vars

Fetches metadata and current values for all public vars in a specified namespace.

Fetching nREPL Connection Status

Provides details on the current nREPL connection, including host, port, session ID, and last error (if any).


Resources

nrepl://status

Provides information about the current nREPL connection, including:

  • Host and port
  • Connection status
  • Active session ID

nrepl://namespaces

Lists all namespaces detected in the project directory.


Contributing

Contributions are welcome! If you have feature suggestions or bug reports, please open an issue or pull request.

License

This project is licensed under the MIT License. Feel free to modify and distribute according to its terms.

nrepl-mcp-server FAQ

How do I connect the nrepl-mcp-server to my running nREPL instance?
Specify the host and port of your running nREPL server in the MCP client configuration to establish a connection.
Can I evaluate Clojure code in any namespace using this server?
Yes, you can evaluate code in a specified namespace or the current one via the MCP client interface.
What metadata can I retrieve about public vars?
You can access docstrings, values, and other metadata for public vars in any inspected namespace.
Which MCP clients are compatible with nrepl-mcp-server?
It works with MCP clients like Claude Desktop and CLine in VSCode, supporting any LLM when used with CLine.
Is it possible to list all namespaces in a project?
Yes, the server uses tools.namespace to list all project namespaces accessible via the nREPL.
How does the server handle connection status reporting?
It provides detailed nREPL connection status including host, port, and session information.
What programming language is supported by this MCP server?
This server specifically supports Clojure through its nREPL interface.
Can this server be used with multiple LLM providers?
Yes, it is provider-agnostic and can be used with OpenAI, Claude, Gemini, and others via MCP clients.