LSLABSCO SUMMARY
Parentheses stop being the thing that breaks the edit.
Text-based editing tools fail on Clojure in a specific and repetitive way. Repairing delimiters before evaluation and editing at the level of forms is the fix — and the REPL connection means the change gets tried, not just written.
What it is
An MCP server that connects an LLM client to a Clojure project through nREPL, plus editing tools that understand Clojure's structure instead of treating it as text. Parinfer, cljfmt and clj-rewrite do the work under the hood.
What you get
- Code evaluation:
clojure_evalruns in the current namespace, with an optionalportfor multi-REPL workflows, andlist_nrepl_portsdiscovers running nREPL servers on the machine - Clojure-aware editing:
clojure_editfor structure-aware changes to forms including defmethod, andclojure_edit_replace_sexpfor modifying expressions inside a function - General editing that repairs itself:
file_editruns parinfer repair after the edit when needed, andfile_writewrites complete files with safety checks - Read-only exploration:
LSfor a recursive tree,read_filewith a collapsed view showing only function signatures for large Clojure files,grepandglob_files bashfor running tests, git commands and file operations on the host- Agent tools that need their own API keys:
dispatch_agentlaunches read-only agents for multi-step exploration, andarchitecthandles technical planning - Experimental additions:
scratch_padas a persistent structured workspace, andcode_critiquefor iterative review
Requirements
Clojure and Java — JDK 17 or later. Ripgrep is optional but highly recommended for grep and glob_files performance. Install with clojure -Ttools install-latest :lib io.github.bhauman/clojure-mcp :as mcp, which makes clojure -Tmcp start available from any directory. An nREPL must be running in your project for the evaluation tools to connect to. How much of the toolchain you use depends on your client: with a CLI assistant that already has good file editing and shell tools, keep those and use this mainly for REPL integration and Clojure-aware edits; with a desktop chat app, use the full set. The agent tools require LLM API keys of their own.
Setup effort
One command — clojure -Ttools install-latest :lib io.github.bhauman/clojure-mcp :as mcp
USE CASES
Working the way you already work in Clojure
The assistant evaluates in your running REPL, in the current namespace, so it develops against live state rather than writing code it has never run.
Editing a function without breaking the file
Structure-aware edits operate on forms, and text edits get a parinfer repair pass afterwards, so an unbalanced paren does not become the next problem.
Reading a large namespace without filling the context
The collapsed view shows function signatures only, and you expand the ones that matter.
Adding Clojure sense to a CLI assistant
Keep the assistant's own file and shell tools and take the REPL integration and Clojure-aware edits from here, rather than replacing a toolchain that already works.
Exploring before changing anything
Dispatch a read-only agent for the multi-step search, then bring the finding back rather than doing the exploration inline.
17 tools
Listed in project docs. Your client may show a different list.
read_filegrepglob_filesclojure_evallist_nrepl_portsbashclojure_editclojure_edit_replace_sexpfile_editfile_writedispatch_agentarchitectscratch_padcode_critiqueclojure_inspect_projectparen_repairBEFORE YOU INSTALL
What to know first
Tools you get
17 tools named in the project's documentation.
INSTALLATION
Connect your client
Server setup
clojure -Ttools install-latest :lib io.github.bhauman/clojure-mcp :as mcpMCP Clients
Claude Code
claude mcp add clojure-mcp -- clojure -Tmcp start :config-profile :cli-assistCodex
codex mcp add clojure-mcp -- clojure -Tmcp start :config-profile :cli-assistGemini CLI
gemini mcp add clojure-mcp clojure -Tmcp start :config-profile :cli-assistClaude Desktop
Add an :nrepl alias to your project's deps.edn that starts nREPL on port 7888: {:aliases {:nrepl {:extra-deps {nrepl/nrepl {:mvn/version "1.3.1"}} :main-opts ["-m" "nrepl.cmdline" "--port" "7888"]}}}
cd <YOUR_PATH_TO_PROJECT>
clojure -M:nreplLeave it running until it prints nREPL server started on port 7888 (with Leiningen, lein repl :headless :port 7888 instead). Then add this to claude_desktop_config.json and restart Claude Desktop:
{
"mcpServers": {
"clojure-mcp": {
"command": "/opt/homebrew/bin/bash",
"args": [
"-c",
"clojure -Tmcp start :not-cwd true :port 7888"
]
}
}
}/opt/homebrew/bin/bash is a sample; yours is the path that which bash (or which zsh) prints. :not-cwd true makes ClojureMCP find your project through the nREPL on 7888; to switch projects, stop that REPL and start one on 7888 in the other project.