MCP Directory

How to add Clojure MCP to Claude Desktop

REPL-driven Clojure development for AI assistants: live nREPL eval plus structure-aware, paren-safe code editing. Paste the config into ~/Library/Application Support/Claude/claude_desktop_config.json and restart Claude Desktop.

Last updated June 14, 2026 ยท 764โ˜… ยท stdio ยท no auth

Claude Desktop config for Clojure MCP

clojure -Ttools install-latest :lib io.github.bhauman/clojure-mcp :as mcp
{
  "mcpServers": {
    "clojure-mcp": {
      "command": "/opt/homebrew/bin/bash",
      "args": [
        "-c",
        "clojure -Tmcp start :not-cwd true :port 7888"
      ]
    }
  }
}

Setup steps

  1. 1Open Claude Desktop โ†’ Settings โ†’ Developer โ†’ Edit Config (this opens ~/Library/Application Support/Claude/claude_desktop_config.json).
  2. 2Paste the Clojure MCP config below under the top-level "mcpServers" key.
  3. 3Fill in any placeholder secrets (API keys, paths) in the snippet.
  4. 4Save the file, then fully quit and reopen Claude Desktop.
  5. 5Open a chat and confirm Clojure MCP's tools appear under the ๐Ÿ”Œ tools menu.

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)

What Clojure MCP can do in Claude Desktop

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.

Security

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 + Claude Desktop FAQ

Where is the Claude Desktop config file?

Claude Desktop reads MCP servers from ~/Library/Application Support/Claude/claude_desktop_config.json. Paste the Clojure MCP config there under the "mcpServers" key and restart the client.

Is Clojure MCP safe to use with Claude Desktop?

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.

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.

View repo Full Clojure MCP page