MCP Directory

Clojure MCP

REPL-driven Clojure development for AI assistants: live nREPL eval plus structure-aware, paren-safe code editing.

Unverified
stdio (local)
No auth
Clojure

Add to your client

Copy the config for your MCP client and paste it into its config file.

Install / run
clojure -Ttools install-latest :lib io.github.bhauman/clojure-mcp :as mcp

Paste into ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "clojure-mcp": {
      "command": "/opt/homebrew/bin/bash",
      "args": [
        "-c",
        "clojure -Tmcp start :not-cwd true :port 7888"
      ]
    }
  }
}

Step-by-step guides: Add to Claude Desktop · Add to Cursor · Add to Windsurf

Before you start

  • Clojure CLI installed
  • Java JDK 17 or later
  • A running nREPL server in your project (or use :start-nrepl-cmd / :fallback-nrepl to auto-start one)
  • Optional but highly recommended: ripgrep for faster grep and glob_files
  • Optional: GEMINI_API_KEY / OPENAI_API_KEY / ANTHROPIC_API_KEY for the agent tools (dispatch_agent, architect, code_critique)

About Clojure MCP

ClojureMCP turns an LLM client into a REPL-driven Clojure development companion. It connects to a running nREPL in your project, evaluating code with automatic delimiter repair, and edits Clojure source structurally (targeting forms by type and name) using parinfer, cljfmt, and clj-rewrite so it never produces unbalanced parens. It works with Claude Desktop (full toolchain) and CLI assistants like Claude Code, Codex, and Gemini CLI (via the :cli-assist / :cli-assist-full profiles, often alongside clojure-mcp-light). The tool set is highly customizable via config profiles, enable/disable lists, and a project-local .clojure-mcp/config.edn.

Tools & capabilities (15)

LS

Returns a recursive tree view of files and directories for exploring project structure.

read_file

Smart file reader with pattern-based exploration for Clojure files (collapsed signature view, name_pattern / content_pattern matching, defmethod dispatch support); other file types show raw content.

grep

Fast content search across files using regular expressions.

glob_files

Pattern-based file finding by name patterns like *.clj.

clojure_eval

Evaluates Clojure code in the current namespace over the connected nREPL session; supports an optional port parameter for multi-REPL workflows and partitions multiple expressions.

list_nrepl_ports

Discovers running nREPL servers on the machine, identifying shadow-cljs instances so the agent can target the right REPL.

bash

Executes shell commands on the host (configurable to run over nREPL or locally), with session isolation, output truncation (~8500 chars), and path validation. Note: bash does not respect the allowed-directories boundaries.

clojure_edit

Structure-aware editing of Clojure forms: replace, insert_before, or insert_after targeting functions by type and identifier (including defmethod dispatch values) with built-in lint/syntax validation.

clojure_edit_replace_sexp

Modify specific s-expressions within functions.

file_edit

Edit files by replacing text strings, with parinfer repair after the edit if needed.

file_write

Write complete files with safety checks for creating new files or overwriting with validation.

dispatch_agent

Launches an autonomous agent with read-only tools to handle complex, multi-step file exploration and analysis (requires an LLM API key).

architect

Provides technical planning and implementation guidance for system design and architecture decisions (requires an LLM API key).

scratch_pad

Experimental persistent workspace for structured JSON data via set_path / get_path / delete_path; in-memory by default with optional file persistence, used for task tracking, planning, and inter-tool communication.

code_critique

Experimental interactive code review offering iterative improvement suggestions (requires an LLM API key).

When to use it

  • Turn Claude Desktop into a Clojure coding assistant that designs, codes, and validates ideas directly in the REPL
  • Add reliable REPL integration and structural-editing fallback to CLI assistants (Claude Code, Codex, Gemini CLI) for Clojure projects
  • Evaluate and iterate on Clojure/ClojureScript expressions live, with automatic delimiter repair before evaluation
  • Refactor Clojure code safely by targeting forms structurally so parentheses and formatting stay balanced
  • Work across multiple REPLs simultaneously (e.g. a Clojure backend and a shadow-cljs frontend)
  • Maintain project context and continuity across sessions via PROJECT_SUMMARY.md and chat-session summarize/resume prompts

Security notes

File operations are validated against an allow-list of directories configured in .clojure-mcp/config.edn (:allowed-directories); attempts to access files outside them fail. The README warns that the bash tool does NOT respect these boundaries, so use it with care. The optional agent tools (dispatch_agent, architect, code_critique) make external LLM API calls and incur charges when GEMINI_API_KEY / OPENAI_API_KEY / ANTHROPIC_API_KEY are present in the environment.

Clojure MCP FAQ

Do I need API keys to use it?

No. API keys are not required for the core server. They are only needed for the agent tools (dispatch_agent, architect, code_critique); if GEMINI_API_KEY, OPENAI_API_KEY, or ANTHROPIC_API_KEY are set, those tools will make external API calls that incur charges.

How does it connect to my project?

It connects to an nREPL server running in your project. For Claude Desktop, start an nREPL (e.g. on port 7888) and use :not-cwd true so the server introspects the connection to find your project directory; for CLI assistants run it from your project dir, optionally with :start-nrepl-cmd or :fallback-nrepl to auto-start a REPL.

Which Clojure environments are supported?

Clojure and ClojureScript (:clj), Babashka (:bb), Basilisp (:basilisp), and Scittle (:scittle), selectable via :nrepl-env-type (auto-detected by default). shadow-cljs REPLs are also recognized.

How do I control which tools are exposed?

Use config profiles (:config-profile :cli-assist or :cli-assist-full), the :enable-tools / :disable-tools / :add-tools / :remove-tools options, ENABLE_TOOLS / DISABLE_TOOLS env vars, or build a custom MCP server. File access is restricted via :allowed-directories in .clojure-mcp/config.edn.

Alternatives to Clojure MCP

Compare all alternatives →

Microsoft's official browser-automation MCP using Playwright's accessibility tree (no vision model).

Featured
Verified
stdio (local)
No auth
TypeScript
12 tools
Updated 21 days agoRepo

Up-to-date, version-specific library documentation injected into your coding agent.

Verified
stdio (local)
API key
TypeScript
2 tools
Updated 25 days agoRepo

Code intelligence engine that indexes repos into a persistent knowledge graph for AI coding agents.

Unverified
stdio (local)
No auth
C
14 tools
Updated 11 hours agoRepo