Clojure MCP 标志

Clojure MCP

社区
bhauman

Clojure MCP

发布者bhauman
代码仓库clojure-mcp
语言Clojure
复刻数
83
星标数
777
可用工具
0
传输类型stdio
分类
许可协议EPL-2.0
链接
  • 将工具接入 AI 工作流

    Clojure MCP 提供 MCP 功能,可供兼容的 AI 客户端和智能体使用。

  • 0 个可用工具

    浏览下方可调用的操作;如果服务器提供了名称和描述,也会一并显示。

  • 可直接复制的配置

    使用安装配置片段,在您首选的 MCP 客户端中配置此服务器。

  • 开源社区热度

    关联的代码仓库有 777 个 Star 和 83 个 Fork。

Clojure MCP: REPL-Driven Development with AI Assistance

ClojureMCP is an MCP server for Clojure!

Table of Contents

What is ClojureMCP?

ClojureMCP is an MCP server that connects an LLM client (like Claude Code or Claude Desktop) to your Clojure project. It provides REPL tools and Clojure-aware editing tools designed to handle Clojure's parentheses and formatting reliably.

Depending on your LLM client, ClojureMCP can either:

  • Provide a complete set of Clojure aware code assistance tools for desktop chat apps like Claude Desktop, or
  • Fill in Clojure-specific gaps for CLI assistants that already have great file editing and shell tools (such as REPL integration + Clojure-aware edits).

How do I use it?

  1. Install ClojureMCP (clojure -Ttools install-latest ...).
  2. Register it as an MCP server in your LLM client.

If you're using a CLI assistant, you'll usually prefer to keep the CLI's native file editing tools and use ClojureMCP mainly for REPL integration (and as an editing fallback).

If you're using a desktop chat app, you'll typically use the full ClojureMCP toolchain.

Main Features

  • Clojure REPL Connection - which repairs delimiters prior to evaluation
  • Clojure Aware editing - Using parinfer, cljfmt, and clj-rewrite
  • Optimized set of tools for Clojure Development

Help and Community Resources

📋 Installation

Prerequisites

  • Clojure
  • Java (JDK 17 or later)
  • Optional but HIGHLY recommended: ripgrep for better grep and glob_files performance

Install ClojureMCP

Install ClojureMCP using the Clojure tools installer:

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

This installs ClojureMCP globally, making clojure -Tmcp start available from any directory.

CLI Assistants

CLI coding assistants (Claude Code, Codex, Gemini CLI) already have great inline-diff editing and shell tools.

Start with clojure-mcp-light - it provides REPL integration and delimiter repair while preserving your CLI's native inline-diff display. This works well for most Clojure development.

Consider adding ClojureMCP with the :cli-assist profile if you want:

  • Structural editing fallback - clojure-mcp-light can repair parens after an edit succeeds, but can't help when the find/replace match string doesn't match the code (happens <5% of the time, but can throw off the LLM). Structural editing targets forms by type and name, avoiding this problem.
  • First-class REPL tool - LLMs tend to use MCP tools more readily than CLI commands, which may lead to more frequent REPL usage.

Adding ClojureMCP to clojure-mcp-light can provide an enhanced Clojure development experience for CLI assistants.

Adding ClojureMCP with :cli-assist

bash
# Claude Code
claude mcp add clojure-mcp -- clojure -Tmcp start :config-profile :cli-assist

# OpenAI Codex
codex mcp add clojure-mcp -- clojure -Tmcp start :config-profile :cli-assist

# Google Gemini CLI
gemini mcp add clojure-mcp clojure -Tmcp start :config-profile :cli-assist

Prefer clojure-mcp's editing/reading tools? If you let the agent drive and care less about the native inline diff, swap :cli-assist for :cli-assist-full. It makes read_file, clojure_edit, clojure_edit_replace_sexp, and paren_repair first-class (instead of fallbacks) and instructs the assistant to do all Clojure-file edits through them — which sidesteps the host editor's "file modified since read" conflict without any permission configuration. (Power users who want a hard guarantee can additionally add Claude Code permissions.deny rules like "Edit(/**/*.clj)" so the native editor can't touch Clojure files at all.)

Check install by starting the server

From your project directory:

bash
clojure -Tmcp start :config-profile :cli-assist

You should see JSON-RPC output like this:

json
{"jsonrpc":"2.0","method":"notifications/tools/list_changed"}
{"jsonrpc":"2.0","method":"notifications/tools/list_changed"}
{"jsonrpc":"2.0","method":"notifications/resources/list_changed"}
{"jsonrpc":"2.0","method":"notifications/prompts/list_changed"}

Claude Desktop

Desktop chat apps (like Claude Desktop) start MCP servers outside your project directory and do not provide built-in coding tools. In this environment, you’ll typically use the full ClojureMCP toolchain and connect it to an nREPL running in your project.

ClojureMCP was initially developed to turn Claude Desktop into a coding assistant similar to Claude Code with tools designed to work effectively with the Clojure programming language.

Start an nREPL in your project

Start an nREPL server from your project directory. If you don't already have an nREPL alias or configuration, see doc/nrepl.md.

Configure Claude Desktop

Pick the shell executable that will most likely pick up your environment config:

If you are using Bash find the explicit bash executable path:

bash
$ which bash
/opt/homebrew/bin/bash

If you are using Z Shell find the explicit zsh executable path:

bash
$ which zsh
/bin/zsh

Now we're going to use this explicit shell path in the command parameter in the Claude Desktop configuration as seen below.

Create or edit ~/Library/Application\ Support/Claude/claude_desktop_config.json:

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

The :not-cwd true flag tells ClojureMCP not to use the current working directory (which for Claude Desktop is not your project). Instead, it introspects the nREPL connection to discover the project's working directory.

This allows a simple working pattern of starting a REPL on 7888, then starting Claude Desktop and allowing it to detect where you are working.

When you want to switch to a different project you would stop the current REPL running on 7888 and start a nREPL server in the project you want to work in on port 7888.

Test the setup

  1. Start nREPL in your target project:

    bash
    cd /path/to/your/project
    clojure -M:nrepl

    Look for: nREPL server started on port 7888...

  2. Restart Claude Desktop (required after configuration changes)

  3. Verify Connection: In Claude Desktop, click the + button in the chat area. You should see "Add from clojure-mcp" in the menu. It's important to note that it may take a few moments for this to show up.

  4. If there was an error please see the Troubleshooting Guide. If it connected, go see the Starting a new conversation in Claude Desktop section.

IMPORTANT: Turn Claude Desktop capabilities off

Code Execution and file creation: off

Code execution and file creation provides tools that compete with ClojureMCP; it's best to turn them off.

Go to settings > Capabilities > Code Execution and file creation and toggle it off.

You may also want to turn Artifacts off as well.

Other Clients besides Claude Desktop

See the Wiki for information on setting up other MCP clients.

Starting a new conversation in Claude Desktop

Once everything is set up I'd suggest starting a new chat in Claude.

The first thing you are going to want to do is initialize context about the Clojure project in the conversation attached to the nREPL.

In Claude Desktop click the + tools and optionally add

  • resource PROJECT_SUMMARY.md - (have the LLM create this) see below
  • resource Clojure Project Info - which introspects the nREPL connected project
  • resource LLM_CODE_STYLE.md - Which is your personal coding style instructions (copy the one in this repo to the root of your project)
  • prompt clojure_repl_system_prompt - instructions on how to code - cribbed a bunch from Claude Code

Then start the chat.

I would start by stating a problem and then chatting with the LLM to interactively design a solution. You can ask Claude to "present a solution for my review".

Iterate on that a bit then have it either:

A. code and validate the idea in the REPL.

Don't underestimate LLMs abilities to use the REPL! Current LLMs are absolutely fantastic at using the Clojure REPL.

B. ask the LLM to make the changes to the source code and then have it validate the code in the REPL after file editing.

C. ask to run the tests. D. ask to commit the changes.

Make a branch and have the LLM commit often so that it doesn't ruin good work by going in a bad direction.

Project Summary Management

This project includes a workflow for maintaining an LLM-friendly PROJECT_SUMMARY.md that helps assistants quickly understand the codebase structure.

How It Works

  1. Creating the Summary: To generate or update the PROJECT_SUMMARY.md file, use the MCP prompt in the + > clojure-mcp menu create-update-project-summary. This prompt will:

    • Analyze the codebase structure
    • Document key files, dependencies, and available tools
    • Generate comprehensive documentation in a format optimized for LLM assistants
  2. Using the Summary: When starting a new conversation with an assistant:

    • The "Project Summary" resource automatically loads PROJECT_SUMMARY.md
    • This gives the assistant immediate context about the project structure
    • The assistant can provide more accurate help without lengthy exploration
  3. Keeping It Updated: At the end of a productive session where new features or components were added:

    • Invoke the create-update-project-summary prompt again
    • The system will update the PROJECT_SUMMARY.md with newly added functionality
    • This ensures the summary stays current with ongoing development

This workflow creates a virtuous cycle where each session builds on the accumulated knowledge of previous sessions, making the assistant increasingly effective as your project evolves.

Chat Session Summarize and Resume

The Clojure MCP server provides a pair of prompts that enable conversation continuity across chat sessions using the scratch_pad tool. By default, data is stored in memory only for the current session. To persist summaries across server restarts, you must enable scratch pad persistence using the configuration options described in the scratch pad section.

How It Works

The system uses two complementary prompts:

  1. chat-session-summarize: Creates a summary of the current conversation

    • Saves a detailed summary to the scratch pad
    • Captures what was done, what's being worked on, and what's next
    • Accepts an optional chat_session_key parameter (defaults to "chat_session_summary")
  2. chat-session-resume: Restores context from a previous conversation

    • Reads the PROJECT_SUMMARY.md file
    • Calls clojure_inspect_project for current project state
    • Retrieves the previous session summary from scratch pad
    • Provides a brief 8-line summary of where things left off
    • Accepts an optional chat_session_key parameter (defaults to "chat_session_summary")

Usage Workflow

Ending a Session:

  1. At the end of a productive conversation, invoke the chat-session-summarize prompt
  2. The assistant will store a comprehensive summary in the scratch pad
  3. This summary persists across sessions thanks to the scratch pad's global state

Starting a New Session:

  1. When continuing work, invoke the chat-session-resume prompt
  2. The assistant will load all relevant context and provide a brief summary
  3. You can then continue where you left off with full context

Advanced Usage with Multiple Sessions

You can maintain multiple parallel conversation contexts by using custom keys:

# For feature development
chat-session-summarize with key "feature-auth-system"

# For bug fixing
chat-session-summarize with key "debug-memory-leak"

# Resume specific context
chat-session-resume with key "feature-auth-system"

This enables switching between different development contexts while maintaining the full state of each conversation thread.

Working with Multiple REPLs

With list_nrepl_ports, the agent can discover both your Clojure and shadow-cljs REPLs simultaneously. The tool identifies which REPLs are shadow-cljs instances, allowing the agent to evaluate on either REPL using clojure_eval with the appropriate port parameter.

LLM API Keys

This is NOT required to use the Clojure MCP server.

IMPORTANT: if you have the following API keys set in your environment, then ClojureMCP will make calls to them when you use the dispatch_agent,architect and code_critique tools. These calls will incur API charges.

There are a few MCP tools provided that are agents unto themselves and they need API keys to function.

To use the agent tools, you'll need API keys from one or more of these providers:

Setting Environment Variables

Option 1: Export in your shell

bash
export ANTHROPIC_API_KEY="your-anthropic-api-key-here"
export OPENAI_API_KEY="your-openai-api-key-here"
export GEMINI_API_KEY="your-gemini-api-key-here"

Option 2: Add to your shell profile (.bashrc, .zshrc, etc.)

bash
# Add these lines to your shell profile
export ANTHROPIC_API_KEY="your-anthropic-api-key-here"
export OPENAI_API_KEY="your-openai-api-key-here"
export GEMINI_API_KEY="your-gemini-api-key-here"

Configuring LLM Keys for Claude Desktop

When setting up Claude Desktop, ensure it can access your environment variables by updating your config.

Personally I source them right in bash command:

json
{
    "mcpServers": {
        "clojure-mcp": {
            "command": "/bin/sh",
            "args": [
                "-c",
                "source ~/.api_credentials.sh && PATH=/your/bin/path:$PATH && clojure -Tmcp start :not-cwd true :port 7888"
            ]
        }
    }
}

Note: The agent tools will work with any available API key. You don't need all three - just set up the ones you have access to. The tools will automatically select from available models. For now the ANTHROPIC API is limited to the dispatch_agent.

🧰 Available Tools

The default tools included in main.clj are organized by category to support different workflows:

Read-Only Tools

Tool NameDescriptionExample Usage
LSReturns a recursive tree view of files and directoriesExploring project structure
read_fileSmart file reader with pattern-based exploration for Clojure filesReading files with collapsed view, pattern matching
grepFast content search using regular expressionsFinding files containing specific patterns
glob_filesPattern-based file findingFinding files by name patterns like *.clj

Code Evaluation

Tool NameDescriptionExample Usage
clojure_evalEvaluates Clojure code in the current namespace; supports optional port parameter for multi-REPL workflowsTesting expressions, connecting to different REPLs
list_nrepl_portsDiscovers running nREPL servers on the machineFinding available REPLs to connect to
bashExecute shell commands on the host systemRunning tests, git commands, file operations

File Editing Tools

Tool NameDescriptionExample Usage
clojure_editStructure-aware editing of Clojure formsReplacing/inserting functions, handling defmethod
clojure_edit_replace_sexpModify expressions within functionsChanging specific s-expressions
file_editEdit files by replacing text stringsparinfer repair after edit if needed
file_writeWrite complete files with safety checksCreating new files, overwriting with validation

Agent Tools (Require API Keys)

Tool NameDescriptionExample Usage
dispatch_agentLaunch agents with read-only tools for complex searchesMulti-step file exploration and analysis
architectTechnical planning and implementation guidanceSystem design, architecture decisions

Experimental Tools

Tool NameDescriptionExample Usage
scratch_padPersistent workspace for structured data storageTask tracking, planning, inter-tool communication with optional file persistence (disabled by default)
code_critiqueInteractive code review and improvement suggestionsIterative code quality improvement

Key Tool Features

Smart File Reading (read_file)

  • Collapsed View: Shows only function signatures for large Clojure files
  • Pattern Matching: Use name_pattern to find functions by name, content_pattern to search content
  • defmethod Support: Handles dispatch values like "area :rectangle" or vector dispatches
  • Multi-language: Clojure files get smart features, other files show raw content

Structure-Aware Editing (clojure_edit)

  • Form-based Operations: Target functions by type and identifier, not text matching
  • Multiple Operations: Replace, insert_before, insert_after
  • Syntax Validation: Built-in linting prevents unbalanced parentheses
  • defmethod Handling: Works with qualified names and dispatch values

Code Evaluation (clojure_eval)

  • REPL Integration: Executes in the connected nREPL session
  • Helper Functions: Built-in namespace and symbol exploration tools
  • Multiple Expressions: Evaluates and partitions multiple expressions

Shell Commands (bash)

  • Configurable Execution: Can run over nREPL or locally based on config
  • Session Isolation: When using nREPL mode, runs in separate session to prevent REPL interference
  • Output Truncation: Consistent 8500 character limit with smart stderr/stdout allocation
  • Path Security: Validates filesystem paths against allowed directories

Agent System (dispatch_agent)

  • Autonomous Search: Handles complex, multi-step exploration tasks
  • Read-only Access: Agents have read only tool access
  • Detailed Results: Returns analysis and findings

Scratch Pad (scratch_pad)

  • Persistent Workspace: Store structured data for planning and inter-tool communication
  • Memory-Only: Data is stored in memory only and lost when session ends (default behavior)
  • Path-Based Operations: Use set_path, get_path, delete_path for precise data manipulation
  • JSON Compatibility: Store any JSON-compatible data (objects, arrays, strings, numbers, booleans)

🔧 Customization

ClojureMCP is designed to be highly customizable. During the alpha phase, creating your own custom MCP server is the primary way to configure the system for your specific needs.

You can customize:

  • Tools - Choose which tools to include, create new ones with multimethods or simple maps
  • Prompts - Add project-specific prompts for your workflows
  • Resources - Expose your documentation, configuration, and project information
  • Tool Selection - Create read-only servers, development servers, or specialized configurations

The customization approach is both easy and empowering - you're essentially building your own personalized AI development companion.

📖 Complete Customization Documentation

For a quick start: Creating Your Own Custom MCP Server - This is where most users should begin.

CLI options

Values passed to clojure -Tmcp start are EDN values.

:port

Optional - The nREPL server port to connect to. When using :start-nrepl-cmd without :port, the port will be automatically discovered from the command output.

:port 7888

:host

Optional - The nREPL server host. Defaults to localhost if not specified.

:host "localhost" or :host "0.0.0.0"

:not-cwd

Optional - If true, don't use the current working directory as the project directory. Requires :port to be specified. The MCP server will introspect the nREPL connection to discover the project's working directory.

This is essential for Claude Desktop and other clients that launch the MCP server outside your project directory. By connecting to an nREPL running in your project, ClojureMCP can determine the correct working directory automatically.

:not-cwd true

:start-nrepl-cmd

Optional - A command to automatically start an nREPL server if one is not already running. Must be specified as a vector of strings. The MCP server will start this process and manage its lifecycle.

When used without :port, the MCP server will automatically parse the port from the command's output. When used with :port, it will use that fixed port instead.

Important: This option requires launching clojure-mcp from your project directory (where your deps.edn or project.clj is located). The nREPL server will be started in the current working directory. This is particularly useful for Claude Code and other command-line LLM clients where you want automatic nREPL startup without manual process management.

Note for Claude Desktop users: Claude Desktop does not start MCP servers from your project directory, so :start-nrepl-cmd will not work unless you also provide :project-dir as a command line argument pointing to your specific project. For example: :project-dir '"/path/to/your/clojure/project"'. This limitation does not affect Claude Code or other CLI-based tools that you run from your project directory.

:start-nrepl-cmd ["lein" "repl" ":headless"] or :start-nrepl-cmd ["clojure" "-M:nrepl"]

:fallback-nrepl

Optional - When true, ClojureMCP will first try to attach to :port. If nothing is listening there (or :port is omitted entirely), it spawns a local nREPL on an ephemeral port and connects to that. The fallback never squats on your configured :port, so a later editor session can still claim it.

This is intended for users who don't always have an editor-managed nREPL running — for example, when launching Claude Desktop without first starting a project REPL, or when working in small projects via Vim. Without this flag, ClojureMCP fails to start if it can't reach :port, which Claude Desktop surfaces as a "Server disconnected" error.

The default command is built from clojure-mcp's own nREPL dependency (so no version is hardcoded) and runs through clojure -Sdeps ... -M -m nrepl.cmdline. The user's ~/.clojure/deps.edn is still merged in by the clojure CLI, so libraries you keep globally available (e.g. Criterium) remain on the spawned REPL's classpath.

The spawned process is cleaned up automatically when the MCP server shuts down.

:fallback-nrepl true

:fallback-nrepl-cmd

Optional - Overrides the default fallback command. Must be a vector of strings. Only used when :fallback-nrepl is true. Do not include an explicit port in the command; the launcher needs to parse the discovered port from the process output.

:fallback-nrepl-cmd ["lein" "repl" ":headless"]

:fallback-nrepl-dir

Optional - Working directory for the spawned fallback REPL. Defaults to :project-dir if set, otherwise to $HOME. Useful when you want the fallback REPL to pick up a project's deps.edn automatically.

:fallback-nrepl-dir "/path/to/scratch"

:config-file

Optional - Specify the location of a configuration file. Must be a path to an existing file.

:config-file "/path/to/config.edn"

:project-dir

Optional - Specify the working directory for your codebase. This overrides the automatic introspection of the project directory from the nREPL connection. Must be a path to an existing directory.

:project-dir "/path/to/your/clojure/project"

:nrepl-env-type

Optional - Specify the type of environment that we are connecting to over the nREPL connection. This overrides automatic detection. Valid options are:

  • :clj for Clojure or ClojureScript
  • :bb for Babashka - Native, fast starting Clojure interpreter for scripting
  • :basilisp for Basilisp - A Clojure-compatible Lisp dialect targeting Python 3.9+
  • :scittle for Scittle - Execute ClojureScript directly from browser script tags

:nrepl-env-type :bb

:shadow-cljs-repl-message

Optional - Controls whether the shadow-cljs REPL mode status message is included in eval results (default: true). When connected to a shadow-cljs nREPL, a status message about CLJS mode is prepended to every eval result. Set to false to disable this message.

:shadow-cljs-repl-message false

:config-profile

Optional - Load a built-in configuration profile that adjusts tool availability and descriptions. Useful for tailoring ClojureMCP to specific use cases.

Available profiles:

  • :cli-assist - Minimal toolset for CLI coding assistants (Claude Code, Codex, Gemini CLI). Disables redundant tools and configures clojure_edit as a fallback for when native Edit fails.
  • :cli-assist-full - Like :cli-assist, but promotes clojure-mcp's read_file, clojure_edit, clojure_edit_replace_sexp, and paren_repair to first-class tools (no "fallback" framing) for an agent-driven workflow. Its instructions steer the assistant to route all Clojure-file edits through the clojure tools, which avoids the host editor's "file modified since read" conflict without any host permission setup.

:config-profile :cli-assist

:enable-tools

Optional - Allowlist of tool keywords. When provided, replaces any :enable-tools value from config. Only the listed tools will be available.

:enable-tools [:clojure_eval :read_file]

:disable-tools

Optional - Blocklist of tool keywords. When provided, replaces any :disable-tools value from config. The listed tools will be disabled.

:disable-tools [:bash :dispatch_agent]

:add-tools

Optional - Force-enable specific tools after config resolution. Removes tools from the disable list, and adds them to the enable list if one is active. This is useful for selectively re-enabling tools that a config profile disables.

:add-tools [:my_custom_agent]

:remove-tools

Optional - Force-disable specific tools after config resolution. Adds tools to the disable list, and removes them from the enable list if one is active. This is useful for selectively disabling tools without replacing the entire config.

:remove-tools [:clojure_eval]

Tool filtering application order

  1. Config loaded (home + project + profile merge)
  2. :enable-tools/:disable-tools from opts replace config values (if provided)
  3. :remove-tools applied (force-disable)
  4. :add-tools applied (force-enable — wins over :remove-tools on overlap)
  5. ENABLE_TOOLS/DISABLE_TOOLS env vars still win over everything

See Component Filtering for details on how enable/disable lists work in config files.

Example Usage

bash
# Basic usage with just port
clojure -Tmcp start :port 7888

# With automatic nREPL server startup and port discovery
# Perfect for CLI assistants - run this from your project directory
clojure -Tmcp start :start-nrepl-cmd '["lein" "repl" ":headless"]'

# For deps.edn projects (from project directory)
clojure -Tmcp start :start-nrepl-cmd '["clojure" "-M:nrepl"]'

# Auto-start with explicit port (uses fixed port, no parsing)
clojure -Tmcp start :port 7888 :start-nrepl-cmd '["clojure" "-M:nrepl"]'

# Attach to port 7888 if available, otherwise spawn a fallback nREPL on
# an ephemeral port. Useful for Claude Desktop when you don't always
# have an editor-managed REPL running.
clojure -Tmcp start :not-cwd true :port 7888 :fallback-nrepl true

# For Claude Desktop: must provide project-dir since it doesn't run from your project
clojure -Tmcp start :start-nrepl-cmd '["lein" "repl" ":headless"]' :project-dir '"/path/to/your/clojure/project"'

# With custom host and project directory
clojure -Tmcp start :port 7888 :host '"0.0.0.0"' :project-dir '"/path/to/project"'

# Using a custom config file
clojure -Tmcp start :port 7888 :config-file '"/path/to/custom-config.edn"'

# Specifying Babashka environment
clojure -Tmcp start :port 7888 :nrepl-env-type :bb

# Using cli-assist profile for CLI coding assistants
clojure -Tmcp start :config-profile :cli-assist

# Like cli-assist, but clojure-mcp's read/edit tools are first-class (agent-driven workflow)
clojure -Tmcp start :config-profile :cli-assist-full

# cli-assist with a custom agent tool re-enabled
clojure -Tmcp start :config-profile :cli-assist :add-tools '[:my_custom_agent]'

# cli-assist but also remove clojure_eval
clojure -Tmcp start :config-profile :cli-assist :remove-tools '[:clojure_eval]'

# Full override — only these two tools
clojure -Tmcp start :enable-tools '[:clojure_eval :read_file]'

Note: String values need to be properly quoted for the shell, hence '"value"' syntax for strings.

⚙️ Configuration

The Clojure MCP server supports minimal project-specific configuration through a .clojure-mcp/config.edn file in your project's root directory. This configuration provides security controls and customization options for the MCP server.

Configuration File Location

Create a .clojure-mcp/config.edn file in your project root:

your-project/
├── .clojure-mcp/
│   └── config.edn
├── src/
├── deps.edn
└── ...

Configuration Options

Configuration is extensively documented here.

Example Configuration

edn
{:allowed-directories ["."
                       "src"
                       "test"
                       "resources"
                       "dev"
                       "/absolute/path/to/shared/code"
                       "../sibling-project"]
 :write-file-guard :partial-read
 :cljfmt false
 :bash-over-nrepl false}

Configuration Details

Path Resolution:

  • Relative paths (like "src", "../other-project") are resolved relative to your project root
  • Absolute paths (like "/home/user/shared") are used as-is
  • The project root directory is automatically included in allowed directories

Security:

  • Tools validate all file operations against the allowed directories
  • Attempts to access files outside allowed directories will fail with an error
  • This prevents accidental access to sensitive system files
  • the Bash tool doesn't respect these boundaries so be wary

Default Behavior:

  • Without a config file, only the project directory and its subdirectories are accessible
  • The nREPL working directory is automatically added to allowed directories

Note: Configuration is loaded when the MCP server starts. Restart the server (or the Chat Agent) after making configuration changes.

📝 License

Eclipse Public License - v 2.0

Copyright (c) 2025 Bruce Hauman

This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0

License Summary

  • ✅ Use freely for personal projects, internal business tools, and development
  • ✅ Modify and distribute - improvements and forks are welcome
  • ✅ Commercial use - businesses can use this commercially without restrictions
  • ✅ Flexible licensing - can be combined with proprietary code
  • 📤 Share improvements - source code must be made available when distributed

将 Clojure MCP MCP 与多个 AI 模型配合使用

TypingMind 在工作区级别连接 MCP 工具,因此连接 Clojure MCP 后,您就可以在 TypingMind 中搭配不同的 AI 模型使用,无需为每个模型单独设置。 此 MCP 通过您设备上的 TypingMind MCP 连接器在本地运行。

本地连接器设置指南

如果 MCP 服务器需要访问您电脑上的本地文件、应用或私有资源,请选择此方式。

1

打开 MCP 设置

在 TypingMind 中,依次前往“设置”、“高级设置”和“模型上下文协议”,然后选择“设置连接器”。

  1. 在您的浏览器中打开 TypingMind。
  2. 点击“设置”图标。
  3. 进入“高级设置”。
  4. 打开“模型上下文协议”部分。
  5. 点击“设置连接器”,然后选择“此设备”。
TypingMind MCP 连接器设置界面,已选择“此设备”
2

运行连接器命令

选择“此设备”,从 TypingMind 复制命令并在终端中运行。使用 MCP 时,请保持该进程运行。

  1. 复制 TypingMind 显示的设置命令。
  2. 在 macOS 上打开“终端”,或在 Windows 上打开 Windows Terminal。
  3. 粘贴并运行命令。
  4. 如果终端询问您是否继续,请确认安装软件包。
  5. 使用 MCP 工具时,请保持终端窗口及其中的进程运行。
3

将 Clojure MCP 添加为服务器

当连接器状态为“就绪”时,点击“编辑服务器”,然后粘贴 MCP 服务器配置。

  1. 等待连接器状态显示为“就绪”。
  2. 点击“编辑服务器”。
  3. 粘贴 Clojure MCP MCP 服务器配置。
  4. 保存服务器列表。
  5. 如需确认连接器是否仍处于就绪状态,请刷新。
TypingMind MCP 设置界面,显示正在运行的服务器和“编辑服务器”按钮
{
  "mcpServers": {
    "clojure-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

在不同模型中使用同一连接

保存服务器列表,打开“插件”,启用 Clojure MCP MCP 工具,然后在 TypingMind 中选择任意受支持的 AI 模型,即可在聊天中使用这些工具,或将其分配给智能体。

  1. 在 TypingMind 中打开“插件”页面。
  2. 启用 Clojure MCP MCP 工具。
  3. 开始聊天并选择您想使用的 AI 模型。
  4. 在聊天中使用 MCP 工具,或将其分配给 AI 智能体。
  5. 根据需要随时切换到其他 AI 模型,无需重新连接 MCP。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 Clojure MCP 帮我完成这项任务吗?
Clojure MCP
当然。我已阅读。
以下是我使用 Clojure MCP 得到的结果。

常见问题

Clojure MCP MCP 服务器有什么用途?

Clojure MCP 是一个 MCP 服务器,可让兼容的 AI 客户端连接外部工具并获取上下文。在 TypingMind 中,只需添加一次此 MCP 服务器,即可在您的 AI 工作区中使用其工具。

可以在 TypingMind 中让多个 AI 模型使用 Clojure MCP MCP 吗?

可以。TypingMind 在工作区层面连接 MCP 工具,因此您可以让 Claude、ChatGPT、Gemini 等不同 AI 模型,或您在 TypingMind 中配置的其他模型使用 Clojure MCP,而无需为每个模型单独配置 MCP 服务器。

为什么在 TypingMind 中使用 Clojure MCP MCP?

TypingMind 将多个 AI 模型、提示词、插件、AI 智能体、API 密钥和 MCP 工具整合到同一个工作区中,是优秀的大语言模型聊天前端之一。连接 Clojure MCP 后,您可以在偏好的不同模型中使用其 MCP 工具,同时在 TypingMind 中井然有序地管理聊天工作流程。

如何将 Clojure MCP MCP 连接到 TypingMind?

Clojure MCP 通过 TypingMind 本地 MCP 连接器运行。当 MCP 服务器需要访问您计算机上的本地文件、桌面应用、命令行工具或私有资源时,这种方式最合适。

Clojure MCP MCP 在 TypingMind 中提供哪些工具?

Clojure MCP 提供 MCP 功能,您可以在 TypingMind 的插件页面启用这些功能,然后在聊天中使用,或将其分配给 AI 智能体。

使用 Clojure MCP MCP 需要向 TypingMind 提供我的 API 密钥吗?

不需要。TypingMind 采用本地优先的设计,让您自行掌控模型提供商、API 密钥、提示词和 MCP 配置。如果 Clojure MCP 需要身份验证,请在创建连接时,为该 MCP 服务器添加所需的请求头、OAuth 设置或本地配置。

相关 MCP 服务器

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇