Skip to main content
Glama

pi-clojure-mcp

Persistent, project-aware Clojure development inside Pi.

Connect Pi to an existing nREPL or explicitly start a managed one. Let your coding agent inspect live namespaces, run project tests, make focused edits, and verify behavior in the same running application.

                                                .+++######+++.
    ##################                        +################+.
    ##################                      +++++++##++++########+
    ##################                       .+++    +++++..+######.
    ######      ######                    .+###+ .++. +++++++ +#####.
    ######      ######                   .####+ +++++..+++++++ +####+
    ######      ######            <->    +####..++++++ +++++++..#####
    ############      ######             +####..+++++.. ++++++. #####
    ############      ######             +####+ ++++ ++..+++++ +####+
    ############      ######              +####+ .+..+++. +++ +###++
    ######            ######              .+####++. .++++     ..
    ######            ######                +######+++++++++++++++
    ######            ######                 .++###############+.
                                                .++++####++++.

             pi.dev                                Clojure

Uses upstream ClojureMCP for evaluation, adding:

  • nREPL management — attach to existing REPLs or explicitly start one, with clear readiness, ownership and lifecycle controls.

  • Agent steering — the repl-driven-development skill encourages discovery and exploration over batch-then-test workflows.

  • REPL feedback — highlighted forms, recorded request timing, expandable output and readable runtime-identity cards.

NOTE

AI disclosure: Scope was set by me. Development was done by OpenAI’s gpt-6.1-sol. Upstream libraries are all credited in NOTICE.

Why this exists

Pi provides MCP tools; ClojureMCP provides Clojure evaluation. Using them together raises practical questions: What is connected? Is it ready? Who owns it? What happens if I reload?

This package makes those answers visible and gives the agent explicit lifecycle controls. Connecting starts the MCP integration server, which runs on the JVM; starting an application REPL is a separate, opt-in action.

Choose your path

Related MCP server: pi-agent-mcp

Quick start

With the prerequisites ready:

  1. Install a released version:

    pi install npm:pi-clojure-mcp@0.2.0

    For unpublished source, use a local checkout.

  2. Start Pi in your Clojure project:

    cd /path/to/your/clojure-project
    pi
  3. Check /clj for help and /mcp for the pi_clojure server and its five tools. Trust the project when appropriate.

  4. Ask the agent to attach to your existing nREPL using its verified port, or explicitly start a fresh managed REPL for this project. Have it report readiness, application cwd and ownership.

  5. Give it a concrete question about your application. Inspect a relevant value or function, make a focused change, and verify the affected behavior.

Keep valuable state across Pi reloads by using an external REPL. See lifetime choices before choosing managed startup or reloading an existing session.

Choose your REPL lifetime

Choose

When

Survives Pi/MCP reload or exit?

Who stops it?

External nREPL

You run the project's REPL independently; state should outlive Pi

Yes, independently of Pi

You / project tooling; Pi only detaches

Managed REPL

You want ClojureMCP to start a fresh application REPL

No

ClojureMCP

Explicit managed stop/replacement requires state-loss acknowledgment. Pi/MCP shutdown can also end that JVM: reload, exit and crashes have no universal confirmation step, and the heap is not replayed. See state and safety contracts.

Common actions

Goal

Action

Check what is connected and ready

runtime_status

Use an existing project REPL

clojure_repl → attach with its verified port

Start a fresh application REPL

clojure_repl → start; it refuses to replace a live target

Work in another REPL while keeping the current one

clojure_eval with an explicit port on every related call

Switch from a managed REPL to another server

After approving state loss, clojure_repl → attach with confirm_state_loss: true

An eval's explicit port addresses that server without changing which target the management tools control. Follow the multi-project workflow when keeping more than one runtime.

The Pi workflow

Illustrative session, with an external project REPL already selected; the identity values below are examples:

You: Check pi_clojure's runtime status. Don't start or stop an application REPL.

Agent: External nREPL is ready at 127.0.0.1:7888.
       PID: 12345
       cwd: /work/my-app
       namespace (last reported): my-app.core

You: Inspect the function handling checkout totals, reproduce the problem,
     make the smallest fix, and run its project test in the same runtime.

Eval calls show requested Clojure code alongside received output; runtime calls show identity and ownership snapshots. Use Pi's native expansion (Ctrl+E by default, or click where supported) for all received text and the original status JSON. Failed requests keep their received error output visible. These feedback cards also work in HTML exports; model-facing results stay unchanged.

The repl-driven-development skill guides focused experiments, state-aware reloads and durable regression checks. Pi advertises it for on-demand use; /skill:repl-driven-development loads it explicitly.

Tool

Use it to

runtime_status

Confirm readiness, application identity, ownership and last-reported namespace

clojure_repl

Explicitly start, attach to, detach from or stop a REPL

clojure_eval

Inspect live values, namespaces and source; evaluate code and project tests

list_nrepl_ports

Find existing local nREPL servers

paren_repair

Repair unbalanced Clojure delimiters

Full tool names start with mcp__pi_clojure__. Evaluation, discovery and delimiter repair come from upstream ClojureMCP; use the live tool schemas for arguments. Call runtime_status for an updated readiness check: the footer is last-checked information, and the namespace field is last evaluation-reported.

Prerequisites

To use the package:

  • Pi with native MCP and tool-renderer support, plus its supported Node runtime; tested with Pi 1.3.0.

  • Clojure CLI.

  • JDK 17 or later, the pinned upstream's minimum.

  • Git and network access for initial dependency resolution.

Documentation

MIT license; upstream dependency licenses are described in NOTICE.

Related MCP Connectors

Related MCP Servers

  • A
    license
    C
    quality
    B
    maintenance
    Enables MCP hosts to delegate coding tasks to Pi CLI as a programmable sub-agent with session tracking and process management.
    7
    4
    MIT
  • F
    license
    Not graded
    quality
    B
    maintenance
    Enables MCP hosts like Claude Code and Codex to spawn, manage, and interact with persistent, reusable Pi coding-agent sessions, supporting task dispatch, status checks, and session lifecycle control.
    3 npm
    -
  • A
    license
    A
    quality
    B
    maintenance
    Delegates coding tasks to your locally installed pi CLI, inheriting providers, models, and extensions, with persistent sessions and cancellable calls.
    6
    5 npm
    MIT
  • A
    license
    C
    quality
    B
    maintenance
    Enables delegating coding tasks to the Pi CLI through MCP with named sessions, synchronous or asynchronous execution, and a read-only transcript window on Windows.
    2
    MIT