[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-bhauman--clojure-mcp":3,"tool-bhauman--clojure-mcp":61},[4,18,26,36,44,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",148568,2,"2026-04-09T23:34:24",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108111,"2026-04-08T11:23:26",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":32,"last_commit_at":50,"category_tags":51,"status":17},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[52,13,15,14],"插件",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":32,"last_commit_at":59,"category_tags":60,"status":17},4721,"markitdown","microsoft\u002Fmarkitdown","MarkItDown 是一款由微软 AutoGen 团队打造的轻量级 Python 工具，专为将各类文件高效转换为 Markdown 格式而设计。它支持 PDF、Word、Excel、PPT、图片（含 OCR）、音频（含语音转录）、HTML 乃至 YouTube 链接等多种格式的解析，能够精准提取文档中的标题、列表、表格和链接等关键结构信息。\n\n在人工智能应用日益普及的今天，大语言模型（LLM）虽擅长处理文本，却难以直接读取复杂的二进制办公文档。MarkItDown 恰好解决了这一痛点，它将非结构化或半结构化的文件转化为模型“原生理解”且 Token 效率极高的 Markdown 格式，成为连接本地文件与 AI 分析 pipeline 的理想桥梁。此外，它还提供了 MCP（模型上下文协议）服务器，可无缝集成到 Claude Desktop 等 LLM 应用中。\n\n这款工具特别适合开发者、数据科学家及 AI 研究人员使用，尤其是那些需要构建文档检索增强生成（RAG）系统、进行批量文本分析或希望让 AI 助手直接“阅读”本地文件的用户。虽然生成的内容也具备一定可读性，但其核心优势在于为机器",93400,"2026-04-06T19:52:38",[52,14],{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":67,"readme_en":68,"readme_zh":69,"quickstart_zh":70,"use_case_zh":71,"hero_image_url":72,"owner_login":73,"owner_name":74,"owner_avatar_url":75,"owner_bio":76,"owner_company":76,"owner_location":76,"owner_email":76,"owner_twitter":73,"owner_website":77,"owner_url":78,"languages":79,"stars":88,"forks":89,"last_commit_at":90,"license":91,"difficulty_score":32,"env_os":92,"env_gpu":93,"env_ram":93,"env_deps":94,"category_tags":101,"github_topics":76,"view_count":32,"oss_zip_url":76,"oss_zip_packed_at":76,"status":17,"created_at":102,"updated_at":103,"faqs":104,"releases":134},6186,"bhauman\u002Fclojure-mcp","clojure-mcp","Clojure MCP","clojure-mcp 是一款专为 Clojure 开发者设计的 AI 辅助开发工具，它作为 MCP（模型上下文协议）服务器，将大语言模型（如 Claude Code 或 Claude Desktop）与您的 Clojure 项目无缝连接。\n\n在 Clojure 开发中，繁琐的括号匹配和严格的格式要求常让通用 AI 助手“水土不服”，导致代码生成错误或 REPL 执行失败。clojure-mcp 正是为了解决这一痛点而生。它不仅提供了稳定的 REPL 连接功能，能在代码求值前自动修复分隔符错误，还集成了 parinfer、cljfmt 等专业库，实现了对 Clojure 代码结构的智能感知与编辑，确保生成的代码符合语言规范。\n\n该工具特别适合使用 Clojure 进行后端开发、数据科学或函数式编程探索的软件工程师。无论是习惯命令行交互的极客，还是偏好桌面聊天界面的开发者，都能从中受益。其独特的技术亮点在于“结构化编辑”能力：当传统基于文本的查找替换失效时，它能依据代码的语法结构精准定位并修改内容，大幅提升了 AI 辅助编码的可靠性。通过简单的安装配置，clojure-mcp 即可让您的","clojure-mcp 是一款专为 Clojure 开发者设计的 AI 辅助开发工具，它作为 MCP（模型上下文协议）服务器，将大语言模型（如 Claude Code 或 Claude Desktop）与您的 Clojure 项目无缝连接。\n\n在 Clojure 开发中，繁琐的括号匹配和严格的格式要求常让通用 AI 助手“水土不服”，导致代码生成错误或 REPL 执行失败。clojure-mcp 正是为了解决这一痛点而生。它不仅提供了稳定的 REPL 连接功能，能在代码求值前自动修复分隔符错误，还集成了 parinfer、cljfmt 等专业库，实现了对 Clojure 代码结构的智能感知与编辑，确保生成的代码符合语言规范。\n\n该工具特别适合使用 Clojure 进行后端开发、数据科学或函数式编程探索的软件工程师。无论是习惯命令行交互的极客，还是偏好桌面聊天界面的开发者，都能从中受益。其独特的技术亮点在于“结构化编辑”能力：当传统基于文本的查找替换失效时，它能依据代码的语法结构精准定位并修改内容，大幅提升了 AI 辅助编码的可靠性。通过简单的安装配置，clojure-mcp 即可让您的 AI 助手真正“懂”Clojure，从而显著提升开发效率与体验。","# Clojure MCP: REPL-Driven Development with AI Assistance\n\nClojureMCP is an MCP server for Clojure!\n\n## Table of Contents\n\n- [What is ClojureMCP?](#what-is-clojuremcp)\n- [How do I use it?](#how-do-i-use-it)\n- [Main Features](#main-features)\n- [Help and Community Resources](#help-and-community-resources)\n- [📋 Installation](#-installation)\n- [CLI Assistants](#cli-assistants)\n- [Claude Desktop](#claude-desktop)\n  - [Project Summary Management](#project-summary-management)\n  - [Chat Session Summarize and Resume](#chat-session-summarize-and-resume)\n- [LLM API Keys](#llm-api-keys)\n- [🧰 Available Tools](#-available-tools)\n- [🔧 Customization](#-customization)\n- [CLI Options](#cli-options)\n- [⚙️ Configuration](#-configuration)\n- [📝 License](#-license)\n\n## What is ClojureMCP?\n\nClojureMCP is an MCP server that connects an LLM client (like Claude\nCode or Claude Desktop) to your Clojure project. It provides REPL\ntools and Clojure-aware editing tools designed to handle Clojure's\nparentheses and formatting reliably.\n\nDepending on your LLM client, ClojureMCP can either:\n- Provide a **complete set of Clojure aware code assistance tools** for desktop chat apps like Claude Desktop, or\n- Fill in Clojure-specific gaps for **CLI assistants** that already have great file editing and shell tools (such as REPL integration + Clojure-aware edits).\n\n## How do I use it?\n\n1. Install ClojureMCP (`clojure -Ttools install-latest ...`).\n2. Register it as an MCP server in your LLM client.\n\nIf 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).\n\nIf you're using a desktop chat app, you'll typically use the full ClojureMCP toolchain.\n\n## Main Features\n\n- **Clojure REPL Connection** - which repairs delimiters prior to evaluation\n- **Clojure Aware editing** - Using parinfer, cljfmt, and clj-rewrite\n- **Optimized set of tools for Clojure Development**\n\n## Help and Community Resources\n\n* The [#ai-assisted-coding Channel on Clojurians Slack](https:\u002F\u002Fclojurians.slack.com\u002Farchives\u002FC068E9L5M2Q) is very active and where I spend a lot of time.\n* The [ClojureMCP Wiki](https:\u002F\u002Fgithub.com\u002Fbhauman\u002Fclojure-mcp\u002Fwiki) has info on various integrations and sandboxing.\n\n## 📋 Installation\n\n### Prerequisites\n\n- [Clojure](https:\u002F\u002Fclojure.org\u002Fguides\u002Finstall_clojure)\n- [Java](https:\u002F\u002Fopenjdk.org\u002F) (JDK 17 or later)\n- **Optional but HIGHLY recommended**: [ripgrep](https:\u002F\u002Fgithub.com\u002FBurntSushi\u002Fripgrep#installation) for better `grep` and `glob_files` performance\n\n### Install ClojureMCP\n\nInstall ClojureMCP using the Clojure tools installer:\n\n```bash\nclojure -Ttools install-latest :lib io.github.bhauman\u002Fclojure-mcp :as mcp\n```\n\nThis installs ClojureMCP globally, making `clojure -Tmcp start` available from any directory.\n\n## CLI Assistants\n\nCLI coding assistants (Claude Code, Codex, Gemini CLI) already have great inline-diff editing and shell tools.\n\n**Start with [clojure-mcp-light](https:\u002F\u002Fgithub.com\u002Fbhauman\u002Fclojure-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.\n\n**Consider adding ClojureMCP** with the `:cli-assist` profile if you want:\n- **Structural editing fallback** - clojure-mcp-light can repair parens after an edit succeeds, but can't help when the find\u002Freplace match string doesn't match the code (happens \u003C5% of the time, but can throw off the LLM). Structural editing targets forms by type and name, avoiding this problem.\n- **First-class REPL tool** - LLMs tend to use MCP tools more readily than CLI commands, which may lead to more frequent REPL usage.\n\nAdding ClojureMCP to clojure-mcp-light can provide an enhanced Clojure development experience for CLI assistants.\n\n### Adding ClojureMCP with `:cli-assist`\n\n```bash\n# Claude Code\nclaude mcp add clojure-mcp -- clojure -Tmcp start :config-profile :cli-assist\n\n# OpenAI Codex\ncodex mcp add clojure-mcp -- clojure -Tmcp start :config-profile :cli-assist\n\n# Google Gemini CLI\ngemini mcp add clojure-mcp clojure -Tmcp start :config-profile :cli-assist\n```\n\n### Check install by starting the server\n\nFrom your project directory:\n\n```bash\nclojure -Tmcp start :config-profile :cli-assist\n```\n\nYou should see JSON-RPC output like this:\n\n```json\n{\"jsonrpc\":\"2.0\",\"method\":\"notifications\u002Ftools\u002Flist_changed\"}\n{\"jsonrpc\":\"2.0\",\"method\":\"notifications\u002Ftools\u002Flist_changed\"}\n{\"jsonrpc\":\"2.0\",\"method\":\"notifications\u002Fresources\u002Flist_changed\"}\n{\"jsonrpc\":\"2.0\",\"method\":\"notifications\u002Fprompts\u002Flist_changed\"}\n```\n\n## Claude Desktop\n\nDesktop chat apps (like Claude Desktop) start MCP servers outside your\nproject directory and do not provide built-in coding tools.  In this\nenvironment, you’ll typically use the full ClojureMCP toolchain and\nconnect it to an nREPL running in your project.\n\nClojureMCP was initially developed to turn Claude Desktop into a\ncoding assistant similar to Claude Code with tools designed to work\neffectively with the Clojure programming language.\n\n### Start an nREPL in your project\n\nStart an nREPL server from your project directory.\nIf you don't already have an nREPL alias or configuration, see [doc\u002Fnrepl.md](doc\u002Fnrepl.md).\n\n### Configure Claude Desktop\n\nPick the shell executable that will most likely pick up your\nenvironment config:\n\nIf you are using **Bash** find the explicit `bash` executable path:\n\n```bash\n$ which bash\n\u002Fopt\u002Fhomebrew\u002Fbin\u002Fbash\n```\n\nIf you are using **Z Shell** find the explicit `zsh` executable path:\n\n```bash\n$ which zsh\n\u002Fbin\u002Fzsh\n```\n\nNow we're going to use this explicit shell path in the `command`\nparameter in the Claude Desktop configuration as seen below.\n\nCreate or edit `~\u002FLibrary\u002FApplication\\ Support\u002FClaude\u002Fclaude_desktop_config.json`:\n\n```json\n{\n    \"mcpServers\": {\n        \"clojure-mcp\": {\n            \"command\": \"\u002Fopt\u002Fhomebrew\u002Fbin\u002Fbash\",\n            \"args\": [\n                \"-c\",\n                \"clojure -Tmcp start :not-cwd true :port 7888\"\n            ]\n        }\n    }\n}\n```\n\nThe `: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.\n\nThis allows a simple working pattern of starting a REPL on 7888, then\nstarting Claude Desktop and allowing it to detect where you are working.\n\nWhen you want to switch to a different project you would stop the\ncurrent REPL running on 7888 and start a nREPL server in the project\nyou want to work in on port 7888.\n\n### Test the setup\n\n1. **Start nREPL** in your target project:\n   ```bash\n   cd \u002Fpath\u002Fto\u002Fyour\u002Fproject\n   clojure -M:nrepl\n   ```\n   Look for: `nREPL server started on port 7888...`\n\n2. **Restart Claude Desktop** (required after configuration changes)\n\n3. **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.\n\n4. If there was an error please see the [Troubleshooting Guide](doc\u002Ftroubleshooting.md). If it connected, go see the [Starting a new conversation in Claude Desktop](#starting-a-new-conversation-in-claude-desktop) section.\n\n### IMPORTANT: Turn Claude Desktop capabilities off\n\n**Code Execution and file creation**: `off`\n\nCode execution and file creation provides tools that compete with\nClojureMCP; it's best to turn them off.\n\nGo to settings > Capabilities > Code Execution and file creation and toggle it off.\n\nYou may also want to turn **Artifacts** off as well.\n\n### Other Clients besides Claude Desktop\n\nSee the [Wiki](https:\u002F\u002Fgithub.com\u002Fbhauman\u002Fclojure-mcp\u002Fwiki) for\ninformation on setting up other MCP clients.\n\n### Starting a new conversation in Claude Desktop\n\nOnce everything is set up I'd suggest starting a new chat in Claude.\n\nThe first thing you are going to want to do is initialize context\nabout the Clojure project in the conversation attached to the nREPL.\n\nIn Claude Desktop click the `+` tools and optionally add\n * resource `PROJECT_SUMMARY.md`  - (have the LLM create this) see below\n * resource `Clojure Project Info` - which introspects the nREPL connected project\n * resource `LLM_CODE_STYLE.md` - Which is your personal coding style instructions (copy the one in this repo to the root of your project)\n * prompt `clojure_repl_system_prompt` - instructions on how to code - cribbed a bunch from Claude Code\n\nThen start the chat.\n\nI would start by stating a problem and then chatting with the LLM to\ninteractively design a solution. You can ask Claude to \"present a solution for my review\".\n\nIterate on that a bit then have it either:\n\nA. code and validate the idea in the REPL.\n\n> Don't underestimate LLMs abilities to use the REPL! Current LLMs are\n> absolutely fantastic at using the Clojure REPL.\n\nB. ask the LLM to make the changes to the source code and then have it validate the code in the REPL after file editing.\n\nC. ask to run the tests.\nD. ask to commit the changes.\n\n> Make a branch and have the LLM commit often so that it doesn't ruin good work by going in a bad direction.\n\n### Project Summary Management\n\nThis project includes a workflow for maintaining an LLM-friendly `PROJECT_SUMMARY.md` that helps assistants quickly understand the codebase structure.\n\n#### How It Works\n\n1. **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:\n   - Analyze the codebase structure\n   - Document key files, dependencies, and available tools\n   - Generate comprehensive documentation in a format optimized for LLM assistants\n\n2. **Using the Summary**: When starting a new conversation with an assistant:\n   - The \"Project Summary\" resource automatically loads PROJECT_SUMMARY.md\n   - This gives the assistant immediate context about the project structure\n   - The assistant can provide more accurate help without lengthy exploration\n\n3. **Keeping It Updated**: At the end of a productive session where new features or components were added:\n   - Invoke the `create-update-project-summary` prompt again\n   - The system will update the PROJECT_SUMMARY.md with newly added functionality\n   - This ensures the summary stays current with ongoing development\n\nThis 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.\n\n### Chat Session Summarize and Resume\n\nThe Clojure MCP server provides a pair of prompts that enable\nconversation continuity across chat sessions using the `scratch_pad`\ntool. By default, data is stored **in memory only** for the current session.\nTo persist summaries across server restarts, you must enable scratch pad\npersistence using the configuration options described in the scratch pad section.\n\n#### How It Works\n\nThe system uses two complementary prompts:\n\n1. **`chat-session-summarize`**: Creates a summary of the current conversation\n   - Saves a detailed summary to the scratch pad\n   - Captures what was done, what's being worked on, and what's next\n   - Accepts an optional `chat_session_key` parameter (defaults to `\"chat_session_summary\"`)\n\n2. **`chat-session-resume`**: Restores context from a previous conversation\n   - Reads the PROJECT_SUMMARY.md file\n   - Calls `clojure_inspect_project` for current project state\n   - Retrieves the previous session summary from scratch pad\n   - Provides a brief 8-line summary of where things left off\n   - Accepts an optional `chat_session_key` parameter (defaults to `\"chat_session_summary\"`)\n\n#### Usage Workflow\n\n**Ending a Session:**\n1. At the end of a productive conversation, invoke the `chat-session-summarize` prompt\n2. The assistant will store a comprehensive summary in the scratch pad\n3. This summary persists across sessions thanks to the scratch pad's global state\n\n**Starting a New Session:**\n1. When continuing work, invoke the `chat-session-resume` prompt\n2. The assistant will load all relevant context and provide a brief summary\n3. You can then continue where you left off with full context\n\n#### Advanced Usage with Multiple Sessions\n\nYou can maintain multiple parallel conversation contexts by using custom keys:\n\n```\n# For feature development\nchat-session-summarize with key \"feature-auth-system\"\n\n# For bug fixing\nchat-session-summarize with key \"debug-memory-leak\"\n\n# Resume specific context\nchat-session-resume with key \"feature-auth-system\"\n```\n\nThis enables switching between different development contexts while maintaining the full state of each conversation thread.\n\n#### Working with Multiple REPLs\n\nWith `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.\n\n## LLM API Keys\n\n> This is NOT required to use the Clojure MCP server.\n\n> IMPORTANT: if you have the following API keys set in your\n> environment, then ClojureMCP will make calls to them when you use\n> the `dispatch_agent`,`architect` and `code_critique` tools. These\n> calls will incur API charges.\n\nThere are a few MCP tools provided that are agents unto themselves and they need API keys to function.\n\nTo use the agent tools, you'll need API keys from one or more of these providers:\n\n- **`GEMINI_API_KEY`** - For Google Gemini models\n  - Get your API key at: https:\u002F\u002Fmakersuite.google.com\u002Fapp\u002Fapikey\n  - Used by: `dispatch_agent`, `architect`, `code_critique`\n\n- **`OPENAI_API_KEY`** - For GPT models\n  - Get your API key at: https:\u002F\u002Fplatform.openai.com\u002Fapi-keys\n  - Used by: `dispatch_agent`, `architect`, `code_critique`\n\n- **`ANTHROPIC_API_KEY`** - For Claude models\n  - Get your API key at: https:\u002F\u002Fconsole.anthropic.com\u002F\n  - Used by: `dispatch_agent`\n\n#### Setting Environment Variables\n\n**Option 1: Export in your shell**\n```bash\nexport ANTHROPIC_API_KEY=\"your-anthropic-api-key-here\"\nexport OPENAI_API_KEY=\"your-openai-api-key-here\"\nexport GEMINI_API_KEY=\"your-gemini-api-key-here\"\n```\n\n**Option 2: Add to your shell profile** (`.bashrc`, `.zshrc`, etc.)\n```bash\n# Add these lines to your shell profile\nexport ANTHROPIC_API_KEY=\"your-anthropic-api-key-here\"\nexport OPENAI_API_KEY=\"your-openai-api-key-here\"\nexport GEMINI_API_KEY=\"your-gemini-api-key-here\"\n```\n\n#### Configuring LLM Keys for Claude Desktop\n\nWhen setting up Claude Desktop, ensure it can access your environment variables by updating your config.\n\nPersonally I `source` them right in bash command:\n\n```json\n{\n    \"mcpServers\": {\n        \"clojure-mcp\": {\n            \"command\": \"\u002Fbin\u002Fsh\",\n            \"args\": [\n                \"-c\",\n                \"source ~\u002F.api_credentials.sh && PATH=\u002Fyour\u002Fbin\u002Fpath:$PATH && clojure -Tmcp start :not-cwd true :port 7888\"\n            ]\n        }\n    }\n}\n```\n\n> **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.\n\n## 🧰 Available Tools\n\nThe default tools included in `main.clj` are organized by category to support different workflows:\n\n### Read-Only Tools\n\n| Tool Name | Description | Example Usage |\n|-----------|-------------|---------------|\n| `LS` | Returns a recursive tree view of files and directories | Exploring project structure |\n| `read_file` | Smart file reader with pattern-based exploration for Clojure files | Reading files with collapsed view, pattern matching |\n| `grep` | Fast content search using regular expressions | Finding files containing specific patterns |\n| `glob_files` | Pattern-based file finding | Finding files by name patterns like `*.clj` |\n\n### Code Evaluation\n\n| Tool Name | Description | Example Usage |\n|-----------|-------------|---------------|\n| `clojure_eval` | Evaluates Clojure code in the current namespace; supports optional `port` parameter for multi-REPL workflows | Testing expressions, connecting to different REPLs |\n| `list_nrepl_ports` | Discovers running nREPL servers on the machine | Finding available REPLs to connect to |\n| `bash` | Execute shell commands on the host system | Running tests, git commands, file operations |\n\n### File Editing Tools\n\n| Tool Name | Description | Example Usage |\n|-----------|-------------|---------------|\n| `clojure_edit` | Structure-aware editing of Clojure forms | Replacing\u002Finserting functions, handling defmethod |\n| `clojure_edit_replace_sexp` | Modify expressions within functions | Changing specific s-expressions |\n| `file_edit` | Edit files by replacing text strings | parinfer repair after edit if needed |\n| `file_write` | Write complete files with safety checks | Creating new files, overwriting with validation |\n\n### Agent Tools (Require API Keys)\n\n| Tool Name | Description | Example Usage |\n|-----------|-------------|---------------|\n| `dispatch_agent` | Launch agents with read-only tools for complex searches | Multi-step file exploration and analysis |\n| `architect` | Technical planning and implementation guidance | System design, architecture decisions |\n\n### Experimental Tools\n\n| Tool Name | Description | Example Usage |\n|-----------|-------------|---------------|\n| `scratch_pad` | Persistent workspace for structured data storage | Task tracking, planning, inter-tool communication with optional file persistence (disabled by default) |\n| `code_critique` | Interactive code review and improvement suggestions | Iterative code quality improvement |\n\n### Key Tool Features\n\n#### Smart File Reading (`read_file`)\n- **Collapsed View**: Shows only function signatures for large Clojure files\n- **Pattern Matching**: Use `name_pattern` to find functions by name, `content_pattern` to search content\n- **defmethod Support**: Handles dispatch values like `\"area :rectangle\"` or vector dispatches\n- **Multi-language**: Clojure files get smart features, other files show raw content\n\n#### Structure-Aware Editing (`clojure_edit`)\n- **Form-based Operations**: Target functions by type and identifier, not text matching\n- **Multiple Operations**: Replace, insert_before, insert_after\n- **Syntax Validation**: Built-in linting prevents unbalanced parentheses\n- **defmethod Handling**: Works with qualified names and dispatch values\n\n#### Code Evaluation (`clojure_eval`)\n- **REPL Integration**: Executes in the connected nREPL session\n- **Helper Functions**: Built-in namespace and symbol exploration tools\n- **Multiple Expressions**: Evaluates and partitions multiple expressions\n\n#### Shell Commands (`bash`)\n- **Configurable Execution**: Can run over nREPL or locally based on config\n- **Session Isolation**: When using nREPL mode, runs in separate session to prevent REPL interference\n- **Output Truncation**: Consistent 8500 character limit with smart stderr\u002Fstdout allocation\n- **Path Security**: Validates filesystem paths against allowed directories\n\n#### Agent System (`dispatch_agent`)\n- **Autonomous Search**: Handles complex, multi-step exploration tasks\n- **Read-only Access**: Agents have read only tool access\n- **Detailed Results**: Returns analysis and findings\n\n#### Scratch Pad (`scratch_pad`)\n- **Persistent Workspace**: Store structured data for planning and inter-tool communication\n- **Memory-Only**: Data is stored in memory only and lost when session ends (default behavior)\n- **Path-Based Operations**: Use `set_path`, `get_path`, `delete_path` for precise data manipulation\n- **JSON Compatibility**: Store any JSON-compatible data (objects, arrays, strings, numbers, booleans)\n\n## 🔧 Customization\n\nClojureMCP 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.\n\nYou can customize:\n- **Tools** - Choose which tools to include, create new ones with multimethods or simple maps\n- **Prompts** - Add project-specific prompts for your workflows\n- **Resources** - Expose your documentation, configuration, and project information\n- **Tool Selection** - Create read-only servers, development servers, or specialized configurations\n\nThe customization approach is both easy and empowering - you're essentially building your own personalized AI development companion.\n\n**📖 [Complete Customization Documentation](doc\u002FREADME.md)**\n\nFor a quick start: **[Creating Your Own Custom MCP Server](doc\u002Fcustom-mcp-server.md)** - This is where most users should begin.\n\n## CLI options\n\nValues passed to `clojure -Tmcp start` are EDN values.\n\n#### `:port`\n**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.\n\n`:port 7888`\n\n#### `:host`\n**Optional** - The nREPL server host. Defaults to localhost if not specified.\n\n`:host \"localhost\"` or `:host \"0.0.0.0\"`\n\n#### `:not-cwd`\n**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.\n\nThis 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.\n\n`:not-cwd true`\n\n#### `:start-nrepl-cmd`\n**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. \n\nWhen 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.\n\n**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.\n\n**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 '\"\u002Fpath\u002Fto\u002Fyour\u002Fclojure\u002Fproject\"'`. This limitation does not affect Claude Code or other CLI-based tools that you run from your project directory.\n\n`:start-nrepl-cmd [\"lein\" \"repl\" \":headless\"]` or `:start-nrepl-cmd [\"clojure\" \"-M:nrepl\"]`\n\n#### `:config-file`\n**Optional** - Specify the location of a configuration file. Must be a path to an existing file.\n\n`:config-file \"\u002Fpath\u002Fto\u002Fconfig.edn\"`\n\n#### `:project-dir`\n**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.\n\n`:project-dir \"\u002Fpath\u002Fto\u002Fyour\u002Fclojure\u002Fproject\"`\n\n#### `:nrepl-env-type`\n**Optional** - Specify the type of environment that we are connecting to over the nREPL connection. This overrides automatic detection. Valid options are:\n\n* `:clj` for Clojure or ClojureScript\n* `:bb` for [Babashka](https:\u002F\u002Fbabashka.org\u002F) - Native, fast starting Clojure interpreter for scripting\n* `:basilisp` for [Basilisp](https:\u002F\u002Fbasilisp.readthedocs.io\u002F) - A Clojure-compatible Lisp dialect targeting Python 3.9+\n* `:scittle` for [Scittle](https:\u002F\u002Fgithub.com\u002Fbabashka\u002Fscittle) - Execute ClojureScript directly from browser script tags\n\n`:nrepl-env-type :bb`\n\n#### `:shadow-cljs-repl-message`\n**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.\n\n`:shadow-cljs-repl-message false`\n\n#### `:config-profile`\n**Optional** - Load a built-in configuration profile that adjusts tool availability and descriptions. Useful for tailoring ClojureMCP to specific use cases.\n\nAvailable profiles:\n* `: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.\n\n`:config-profile :cli-assist`\n\n#### `:enable-tools`\n**Optional** - Allowlist of tool keywords. When provided, replaces any `:enable-tools` value from config. Only the listed tools will be available.\n\n`:enable-tools [:clojure_eval :read_file]`\n\n#### `:disable-tools`\n**Optional** - Blocklist of tool keywords. When provided, replaces any `:disable-tools` value from config. The listed tools will be disabled.\n\n`:disable-tools [:bash :dispatch_agent]`\n\n#### `:add-tools`\n**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.\n\n`:add-tools [:my_custom_agent]`\n\n#### `:remove-tools`\n**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.\n\n`:remove-tools [:clojure_eval]`\n\n#### Tool filtering application order\n\n1. Config loaded (home + project + profile merge)\n2. `:enable-tools`\u002F`:disable-tools` from opts replace config values (if provided)\n3. `:remove-tools` applied (force-disable)\n4. `:add-tools` applied (force-enable — wins over `:remove-tools` on overlap)\n5. `ENABLE_TOOLS`\u002F`DISABLE_TOOLS` env vars still win over everything\n\nSee [Component Filtering](doc\u002Fcomponent-filtering.md) for details on how enable\u002Fdisable lists work in config files.\n\n### Example Usage\n\n```bash\n# Basic usage with just port\nclojure -Tmcp start :port 7888\n\n# With automatic nREPL server startup and port discovery\n# Perfect for CLI assistants - run this from your project directory\nclojure -Tmcp start :start-nrepl-cmd '[\"lein\" \"repl\" \":headless\"]'\n\n# For deps.edn projects (from project directory)\nclojure -Tmcp start :start-nrepl-cmd '[\"clojure\" \"-M:nrepl\"]'\n\n# Auto-start with explicit port (uses fixed port, no parsing)\nclojure -Tmcp start :port 7888 :start-nrepl-cmd '[\"clojure\" \"-M:nrepl\"]'\n\n# For Claude Desktop: must provide project-dir since it doesn't run from your project\nclojure -Tmcp start :start-nrepl-cmd '[\"lein\" \"repl\" \":headless\"]' :project-dir '\"\u002Fpath\u002Fto\u002Fyour\u002Fclojure\u002Fproject\"'\n\n# With custom host and project directory\nclojure -Tmcp start :port 7888 :host '\"0.0.0.0\"' :project-dir '\"\u002Fpath\u002Fto\u002Fproject\"'\n\n# Using a custom config file\nclojure -Tmcp start :port 7888 :config-file '\"\u002Fpath\u002Fto\u002Fcustom-config.edn\"'\n\n# Specifying Babashka environment\nclojure -Tmcp start :port 7888 :nrepl-env-type :bb\n\n# Using cli-assist profile for CLI coding assistants\nclojure -Tmcp start :config-profile :cli-assist\n\n# cli-assist with a custom agent tool re-enabled\nclojure -Tmcp start :config-profile :cli-assist :add-tools '[:my_custom_agent]'\n\n# cli-assist but also remove clojure_eval\nclojure -Tmcp start :config-profile :cli-assist :remove-tools '[:clojure_eval]'\n\n# Full override — only these two tools\nclojure -Tmcp start :enable-tools '[:clojure_eval :read_file]'\n```\n\n**Note**: String values need to be properly quoted for the shell, hence `'\"value\"'` syntax for strings.\n\n## ⚙️ Configuration\n\nThe Clojure MCP server supports minimal project-specific configuration\nthrough a `.clojure-mcp\u002Fconfig.edn` file in your project's root\ndirectory. This configuration provides security controls and\ncustomization options for the MCP server.\n\n### Configuration File Location\n\nCreate a `.clojure-mcp\u002Fconfig.edn` file in your project root:\n\n```\nyour-project\u002F\n├── .clojure-mcp\u002F\n│   └── config.edn\n├── src\u002F\n├── deps.edn\n└── ...\n```\n\n### Configuration Options\n\nConfiguration is extensively documented [here](doc\u002FCONFIG.md).\n\n### Example Configuration\n\n```edn\n{:allowed-directories [\".\"\n                       \"src\"\n                       \"test\"\n                       \"resources\"\n                       \"dev\"\n                       \"\u002Fabsolute\u002Fpath\u002Fto\u002Fshared\u002Fcode\"\n                       \"..\u002Fsibling-project\"]\n :write-file-guard :partial-read\n :cljfmt false\n :bash-over-nrepl false}\n```\n\n### Configuration Details\n\n**Path Resolution**:\n- Relative paths (like `\"src\"`, `\"..\u002Fother-project\"`) are resolved relative to your project root\n- Absolute paths (like `\"\u002Fhome\u002Fuser\u002Fshared\"`) are used as-is\n- The project root directory is automatically included in allowed directories\n\n**Security**:\n- Tools validate all file operations against the allowed directories\n- Attempts to access files outside allowed directories will fail with an error\n- This prevents accidental access to sensitive system files\n- the Bash tool doesn't respect these boundaries so be wary\n\n**Default Behavior**:\n- Without a config file, only the project directory and its subdirectories are accessible\n- The nREPL working directory is automatically added to allowed directories\n\n**Note**: Configuration is loaded when the MCP server starts. Restart the server (or the Chat Agent) after making configuration changes.\n\n## 📝 License\n\nEclipse Public License - v 2.0\n\nCopyright (c) 2025 Bruce Hauman\n\nThis program and the accompanying materials are made available under the\nterms of the Eclipse Public License 2.0 which is available at\nhttp:\u002F\u002Fwww.eclipse.org\u002Flegal\u002Fepl-2.0\n\n### License Summary\n\n- ✅ **Use freely** for personal projects, internal business tools, and development\n- ✅ **Modify and distribute** - improvements and forks are welcome\n- ✅ **Commercial use** - businesses can use this commercially without restrictions\n- ✅ **Flexible licensing** - can be combined with proprietary code\n- 📤 **Share improvements** - source code must be made available when distributed\n","# Clojure MCP：基于 REPL 的 AI 辅助开发\n\nClojureMCP 是一个用于 Clojure 的 MCP 服务器！\n\n## 目录\n\n- [什么是 ClojureMCP？](#what-is-clojuremcp)\n- [如何使用它？](#how-do-i-use-it)\n- [主要特性](#main-features)\n- [帮助与社区资源](#help-and-community-resources)\n- [📋 安装](#-installation)\n- [CLI 助手](#cli-assistants)\n- [Claude Desktop](#claude-desktop)\n  - [项目摘要管理](#project-summary-management)\n  - [聊天会话总结与恢复](#chat-session-summarize-and-resume)\n- [LLM API 密钥](#llm-api-keys)\n- [🧰 可用工具](#-available-tools)\n- [🔧 自定义](#-customization)\n- [CLI 选项](#cli-options)\n- [⚙️ 配置](#-configuration)\n- [📝 许可证](#-license)\n\n## 什么是 ClojureMCP？\n\nClojureMCP 是一个 MCP 服务器，它可以将 LLM 客户端（如 Claude Code 或 Claude Desktop）连接到你的 Clojure 项目。它提供了 REPL 工具和对 Clojure 敏感的编辑工具，旨在可靠地处理 Clojure 的括号和格式化。\n\n根据你使用的 LLM 客户端，ClojureMCP 可以：\n- 为桌面聊天应用（如 Claude Desktop）提供一套完整的 Clojure 敏感代码辅助工具；或者\n- 为已经具备优秀文件编辑和 Shell 工具的 CLI 助手填补 Clojure 特有的空白（例如 REPL 集成 + Clojure 敏感的编辑功能）。\n\n## 如何使用它？\n\n1. 安装 ClojureMCP（`clojure -Ttools install-latest ...`）。\n2. 在你的 LLM 客户端中将其注册为 MCP 服务器。\n\n如果你使用的是 CLI 助手，通常更倾向于保留 CLI 原生的文件编辑工具，并主要将 ClojureMCP 用于 REPL 集成（以及作为编辑的后备方案）。\n\n如果你使用的是桌面聊天应用，则通常会使用完整的 ClojureMCP 工具链。\n\n## 主要特性\n\n- **Clojure REPL 连接**——在评估之前修复分隔符\n- **Clojure 敏感编辑**——使用 parinfer、cljfmt 和 clj-rewrite\n- **专为 Clojure 开发优化的工具集**\n\n## 帮助与社区资源\n\n* [Clojurians Slack 上的 #ai-assisted-coding 频道](https:\u002F\u002Fclojurians.slack.com\u002Farchives\u002FC068E9L5M2Q) 非常活跃，我经常在那里交流。\n* [ClojureMCP Wiki](https:\u002F\u002Fgithub.com\u002Fbhauman\u002Fclojure-mcp\u002Fwiki) 包含各种集成和沙箱环境的相关信息。\n\n## 📋 安装\n\n### 先决条件\n\n- [Clojure](https:\u002F\u002Fclojure.org\u002Fguides\u002Finstall_clojure)\n- [Java](https:\u002F\u002Fopenjdk.org\u002F)（JDK 17 或更高版本）\n- **可选但强烈推荐**：[ripgrep](https:\u002F\u002Fgithub.com\u002FBurntSushi\u002Fripgrep#installation)，以提升 `grep` 和 `glob_files` 的性能\n\n### 安装 ClojureMCP\n\n使用 Clojure 工具安装程序安装 ClojureMCP：\n\n```bash\nclojure -Ttools install-latest :lib io.github.bhauman\u002Fclojure-mcp :as mcp\n```\n\n这会全局安装 ClojureMCP，使你在任何目录下都可以运行 `clojure -Tmcp start`。\n\n## CLI 助手\n\nCLI 编码助手（Claude Code、Codex、Gemini CLI）已经具备优秀的内联差异编辑和 Shell 工具。\n\n**从 [clojure-mcp-light](https:\u002F\u002Fgithub.com\u002Fbhauman\u002Fclojure-mcp-light) 开始**——它提供 REPL 集成和分隔符修复功能，同时保留了 CLI 原生的内联差异显示。这对于大多数 Clojure 开发来说都非常合适。\n\n**考虑添加 ClojureMCP** 并使用 `:cli-assist` 配置文件，如果你需要：\n- **结构化编辑的后备方案**——clojure-mcp-light 可以在编辑成功后修复括号，但在查找\u002F替换匹配字符串与代码不一致时无法提供帮助（这种情况虽然不到 5%，但也可能影响 LLM 的判断）。结构化编辑则通过类型和名称来定位表单，从而避免此类问题。\n- **一流的 REPL 工具**——LLM 更倾向于使用 MCP 工具，而不是 CLI 命令，这可能会导致更频繁地使用 REPL。\n\n将 ClojureMCP 添加到 clojure-mcp-light 中，可以为 CLI 助手提供更强大的 Clojure 开发体验。\n\n### 使用 `:cli-assist` 添加 ClojureMCP\n\n```bash\n# Claude Code\nclaude mcp add clojure-mcp -- clojure -Tmcp start :config-profile :cli-assist\n\n# OpenAI Codex\ncodex mcp add clojure-mcp -- clojure -Tmcp start :config-profile :cli-assist\n\n# Google Gemini CLI\ngemini mcp add clojure-mcp clojure -Tmcp start :config-profile :cli-assist\n```\n\n### 启动服务器以检查安装\n\n在你的项目目录中运行：\n\n```bash\nclojure -Tmcp start :config-profile :cli-assist\n```\n\n你应该会看到类似以下的 JSON-RPC 输出：\n\n```json\n{\"jsonrpc\":\"2.0\",\"method\":\"notifications\u002Ftools\u002Flist_changed\"}\n{\"jsonrpc\":\"2.0\",\"method\":\"notifications\u002Ftools\u002Flist_changed\"}\n{\"jsonrpc\":\"2.0\",\"method\":\"notifications\u002Fresources\u002Flist_changed\"}\n{\"jsonrpc\":\"2.0\",\"method\":\"notifications\u002Fprompts\u002Flist_changed\"}\n```\n\n## Claude Desktop\n\n桌面聊天应用（如 Claude Desktop）会在你的项目目录之外启动 MCP 服务器，并且不提供内置的编码工具。在这种环境下，你通常会使用完整的 ClojureMCP 工具链，并将其连接到你项目中正在运行的 nREPL。\n\nClojureMCP 最初就是为将 Claude Desktop 打造成类似于 Claude Code 的编码助手而开发的，其工具专为 Clojure 编程语言设计，能够高效工作。\n\n### 在你的项目中启动 nREPL\n\n从你的项目目录中启动 nREPL 服务器。如果你还没有 nREPL 别名或配置，请参阅 [doc\u002Fnrepl.md](doc\u002Fnrepl.md)。\n\n### 配置 Claude Desktop\n\n选择最有可能读取你的环境配置的 Shell 可执行文件：\n\n如果你使用的是 **Bash**，请找到明确的 `bash` 可执行文件路径：\n\n```bash\n$ which bash\n\u002Fopt\u002Fhomebrew\u002Fbin\u002Fbash\n```\n\n如果你使用的是 **Z Shell**，请找到明确的 `zsh` 可执行文件路径：\n\n```bash\n$ which zsh\n\u002Fbin\u002Fzsh\n```\n\n现在我们将这个明确的 Shell 路径用于 Claude Desktop 配置中的 `command` 参数，如下所示。\n\n创建或编辑 `~\u002FLibrary\u002FApplication\\ Support\u002FClaude\u002Fclaude_desktop_config.json` 文件：\n\n```json\n{\n    \"mcpServers\": {\n        \"clojure-mcp\": {\n            \"command\": \"\u002Fopt\u002Fhomebrew\u002Fbin\u002Fbash\",\n            \"args\": [\n                \"-c\",\n                \"clojure -Tmcp start :not-cwd true :port 7888\"\n            ]\n        }\n    }\n}\n```\n\n`:not-cwd true` 标志指示 ClojureMCP 不要使用当前的工作目录（对于 Claude Desktop 来说，这并不是你的项目目录）。相反，它会通过 nREPL 连接来发现项目的实际工作目录。\n\n这样就可以采用一种简单的操作模式：先在 7888 端口启动 REPL，然后启动 Claude Desktop，让它自动检测你正在工作的目录。当你想切换到另一个项目时，只需停止当前在 7888 端口运行的 REPL，并在目标项目中重新启动一个在 7888 端口运行的 nREPL 服务器即可。\n\n### 测试设置\n\n1. 在目标项目中**启动 nREPL**：\n   ```bash\n   cd \u002Fpath\u002Fto\u002Fyour\u002Fproject\n   clojure -M:nrepl\n   ```\n   你应该 увидеть: `nREPL server started on port 7888...`\n\n2. **重启 Claude Desktop**（配置更改后需要）\n\n3. **验证连接**：在 Claude Desktop 中，点击聊天区域的 `+` 按钮。你应该会在菜单中看到“Add from clojure-mcp”。需要注意的是，这可能需要几秒钟才会显示出来。\n\n4. 如果出现错误，请参阅[故障排除指南](doc\u002Ftroubleshooting.md)。如果已成功连接，请前往[在 Claude Desktop 中开始新对话](#starting-a-new-conversation-in-claude-desktop)部分。\n\n### 重要提示：关闭 Claude Desktop 的相关功能\n\n**代码执行和文件创建**：`关闭`\n\n代码执行和文件创建提供了与 ClojureMCP 竞争的功能；最好将其关闭。\n\n前往设置 > 功能 > 代码执行和文件创建，并将其切换为关闭状态。\n\n你也可以选择同时关闭**Artifacts**功能。\n\n### 其他客户端\n\n有关设置其他 MCP 客户端的信息，请参阅[Wiki](https:\u002F\u002Fgithub.com\u002Fbhauman\u002Fclojure-mcp\u002Fwiki)。\n\n### 在 Claude Desktop 中开始新对话\n\n一切设置完成后，建议在 Claude 中开始一个新的聊天。\n\n首先要做的是，在与 nREPL 连接的会话中初始化关于 Clojure 项目的上下文。\n\n在 Claude Desktop 中，点击 `+` 工具，并可选择添加以下内容：\n * 资源 `PROJECT_SUMMARY.md` - （让 LLM 自动生成）见下文\n * 资源 `Clojure Project Info` - 用于检查当前连接的 nREPL 项目\n * 资源 `LLM_CODE_STYLE.md` - 包含你的个人编码风格说明（将本仓库中的文件复制到项目根目录）\n * 提示词 `clojure_repl_system_prompt` - 编码指导说明，参考了 Claude Code 的部分内容\n\n然后开始聊天。\n\n我建议先提出一个问题，再与 LLM 互动设计解决方案。你可以要求 Claude “提供一个方案供我审查”。\n\n稍作迭代后，可以：\n\nA. 让 LLM 编写代码并在 REPL 中验证该想法。\n\n> 不要低估 LLM 使用 REPL 的能力！目前的 LLM 在使用 Clojure REPL 方面表现非常出色。\n\nB. 让 LLM 对源代码进行修改，然后在编辑文件后通过 REPL 验证代码。\n\nC. 让 LLM 运行测试。\n\nD. 让 LLM 提交更改。\n\n> 建立一个分支，并让 LLM 经常提交，以免它朝错误的方向发展而破坏已完成的工作。\n\n### 项目摘要管理\n\n该项目包含一个工作流程，用于维护适合 LLM 的 `PROJECT_SUMMARY.md` 文件，帮助助手快速理解代码库结构。\n\n#### 工作原理\n\n1. **创建摘要**：要生成或更新 PROJECT_SUMMARY.md 文件，可在 `+` > `clojure-mcp` 菜单中使用 MCP 提示词 `create-update-project-summary`。此提示词将：\n   - 分析代码库结构\n   - 记录关键文件、依赖项和可用工具\n   - 以针对 LLM 助手优化的格式生成全面的文档\n\n2. **使用摘要**：当开始与助手的新对话时：\n   - “Project Summary”资源会自动加载 PROJECT_SUMMARY.md\n   - 这使助手能够立即了解项目结构\n   - 助手无需长时间探索即可提供更准确的帮助\n\n3. **保持更新**：在完成一次富有成效的会话并添加了新功能或组件后：\n   - 再次调用 `create-update-project-summary` 提示词\n   - 系统会用新增功能更新 PROJECT_SUMMARY.md\n   - 从而确保摘要始终反映最新的开发进展。\n\n这一工作流程形成了良性循环：每次会话都建立在之前会话积累的知识基础上，随着项目不断发展，助手的能力也会越来越强。\n\n### 聊天会话总结与恢复\n\nClojure MCP 服务器提供了一对提示词，可通过 `scratch_pad` 工具实现跨聊天会话的连续性。默认情况下，数据仅在当前会话的内存中存储。如需在服务器重启后保留摘要，必须启用 scratch pad 的持久化功能，具体方法请参阅 scratch pad 部分的配置说明。\n\n#### 工作原理\n\n系统使用两个互补的提示词：\n\n1. **`chat-session-summarize`**：创建当前会话的摘要\n   - 将详细摘要保存到 scratch pad\n   - 记录已完成的工作、正在进行的内容以及下一步计划\n   - 接受可选的 `chat_session_key` 参数（默认值为 `\"chat_session_summary\"`）\n\n2. **`chat-session-resume`**：从之前的会话恢复上下文\n   - 读取 PROJECT_SUMMARY.md 文件\n   - 调用 `clojure_inspect_project` 获取当前项目状态\n   - 从 scratch pad 中检索上一节会话的摘要\n   - 提供一段 8 行左右的简短总结，说明上次中断的地方\n   - 接受可选的 `chat_session_key` 参数（默认值为 `\"chat_session_summary\"`）\n\n#### 使用流程\n\n**结束会话：**\n1. 在一次富有成效的对话结束时，调用 `chat-session-summarize` 提示词。\n2. 助手会将一份全面的摘要存储到 scratch pad 中。\n3. 由于 scratch pad 具有全局状态，该摘要将在后续会话中持续有效。\n\n**开始新会话：**\n1. 当继续工作时，调用 `chat-session-resume` 提示词。\n2. 助手会加载所有相关上下文，并提供简短的总结。\n3. 你可以在此基础上继续之前的工作，拥有完整的上下文信息。\n\n#### 多会话高级用法\n\n可以通过自定义键来维护多个并行的对话上下文：\n\n```\n# 用于功能开发\nchat-session-summarize，键为 \"feature-auth-system\"\n\n# 用于修复 bug\nchat-session-summarize，键为 \"debug-memory-leak\"\n\n# 恢复特定上下文\nchat-session-resume，键为 \"feature-auth-system\"\n```\n\n这样可以在不同开发场景之间切换，同时保持每个对话线程的完整状态。\n\n#### 多个 REPL 的协作\n\n借助 `list_nrepl_ports`，助手可以同时发现你的 Clojure 和 shadow-cljs REPL。该工具能够识别哪些是 shadow-cljs 实例，从而使助手可以根据需要使用 `clojure_eval` 并指定相应的 `port` 参数，在任一 REPL 上进行评估。\n\n## LLM API 密钥\n\n> 这并非使用 Clojure MCP 服务器的必要条件。\n\n> 重要提示：如果您在环境中设置了以下 API 密钥，那么当您使用 `dispatch_agent`、`architect` 和 `code_critique` 工具时，ClojureMCP 将会调用这些 API。这些调用会产生相应的 API 费用。\n\n提供了一些 MCP 工具本身就是代理工具，它们需要 API 密钥才能正常工作。\n\n要使用这些代理工具，您需要从以下提供商中获取一个或多个 API 密钥：\n\n- **`GEMINI_API_KEY`** - 用于 Google Gemini 模型\n  - 在 https:\u002F\u002Fmakersuite.google.com\u002Fapp\u002Fapikey 获取您的 API 密钥\n  - 使用工具：`dispatch_agent`、`architect`、`code_critique`\n\n- **`OPENAI_API_KEY`** - 用于 GPT 模型\n  - 在 https:\u002F\u002Fplatform.openai.com\u002Fapi-keys 获取您的 API 密钥\n  - 使用工具：`dispatch_agent`、`architect`、`code_critique`\n\n- **`ANTHROPIC_API_KEY`** - 用于 Claude 模型\n  - 在 https:\u002F\u002Fconsole.anthropic.com\u002F 获取您的 API 密钥\n  - 使用工具：`dispatch_agent`\n\n#### 设置环境变量\n\n**选项 1：在 shell 中导出**\n```bash\nexport ANTHROPIC_API_KEY=\"your-anthropic-api-key-here\"\nexport OPENAI_API_KEY=\"your-openai-api-key-here\"\nexport GEMINI_API_KEY=\"your-gemini-api-key-here\"\n```\n\n**选项 2：添加到您的 shell 配置文件**（`.bashrc`、`.zshrc` 等）\n```bash\n# 将这些行添加到您的 shell 配置文件\nexport ANTHROPIC_API_KEY=\"your-anthropic-api-key-here\"\nexport OPENAI_API_KEY=\"your-openai-api-key-here\"\nexport GEMINI_API_KEY=\"your-gemini-api-key-here\"\n```\n\n#### 为 Claude Desktop 配置 LLM 密钥\n\n在设置 Claude Desktop 时，请确保它可以通过更新配置来访问您的环境变量。\n\n我个人直接在 bash 命令中 `source` 它们：\n\n```json\n{\n    \"mcpServers\": {\n        \"clojure-mcp\": {\n            \"command\": \"\u002Fbin\u002Fsh\",\n            \"args\": [\n                \"-c\",\n                \"source ~\u002F.api_credentials.sh && PATH=\u002Fyour\u002Fbin\u002Fpath:$PATH && clojure -Tmcp start :not-cwd true :port 7888\"\n            ]\n        }\n    }\n}\n```\n\n> **注意**：代理工具可以使用任何可用的 API 密钥。您不需要全部三个——只需设置您有权使用的那些即可。工具会自动从可用模型中选择。目前，ANTHROPIC API 仅限于 dispatch_agent 使用。\n\n## 🧰 可用工具\n\n`main.clj` 中默认包含的工具按类别组织，以支持不同的工作流程：\n\n### 只读工具\n\n| 工具名称 | 描述 | 示例用法 |\n|-----------|-------------|---------------|\n| `LS` | 返回文件和目录的递归树状视图 | 探索项目结构 |\n| `read_file` | 具有模式探索功能的智能文件阅读器，适用于 Clojure 文件 | 以折叠视图阅读文件，进行模式匹配 |\n| `grep` | 使用正则表达式进行快速内容搜索 | 查找包含特定模式的文件 |\n| `glob_files` | 基于模式查找文件 | 根据文件名模式如 `*.clj` 查找文件 |\n\n### 代码评估\n\n| 工具名称 | 描述 | 示例用法 |\n|-----------|-------------|---------------|\n| `clojure_eval` | 在当前命名空间中评估 Clojure 代码；支持可选的 `port` 参数，用于多 REPL 工作流 | 测试表达式，连接到不同的 REPL |\n| `list_nrepl_ports` | 发现机器上正在运行的 nREPL 服务器 | 查找可用的 REPL 连接 |\n| `bash` | 在主机系统上执行 Shell 命令 | 运行测试、Git 命令、文件操作 |\n\n### 文件编辑工具\n\n| 工具名称 | 描述 | 示例用法 |\n|-----------|-------------|---------------|\n| `clojure_edit` | 对 Clojure 表达式进行结构感知编辑 | 替换\u002F插入函数，处理 defmethod |\n| `clojure_edit_replace_sexp` | 修改函数内的表达式 | 更改特定的 s-expression |\n| `file_edit` | 通过替换文本字符串编辑文件 | 如果需要，可在编辑后进行 parinfer 修复 |\n| `file_write` | 在安全检查下写入完整文件 | 创建新文件，带验证覆盖现有文件 |\n\n### 代理工具（需要 API 密钥）\n\n| 工具名称 | 描述 | 示例用法 |\n|-----------|-------------|---------------|\n| `dispatch_agent` | 启动带有只读工具的代理，用于复杂搜索 | 多步骤的文件探索与分析 |\n| `architect` | 技术规划与实施指导 | 系统设计、架构决策 |\n\n### 实验性工具\n\n| 工具名称 | 描述 | 示例用法 |\n|-----------|-------------|---------------|\n| `scratch_pad` | 用于存储结构化数据的持久化工作区 | 任务跟踪、规划、工具间通信，可选文件持久化（默认关闭） |\n| `code_critique` | 交互式代码审查与改进建议 | 迭代提升代码质量 |\n\n### 重要工具特性\n\n#### 智能文件阅读 (`read_file`)\n- **折叠视图**：对于大型 Clojure 文件，仅显示函数签名\n- **模式匹配**：使用 `name_pattern` 按名称查找函数，使用 `content_pattern` 搜索内容\n- **defmethod 支持**：处理如 `\"area :rectangle\"` 或向量分派等分派值\n- **多语言支持**：Clojure 文件具有智能功能，其他文件则显示原始内容\n\n#### 结构感知编辑 (`clojure_edit`)\n- **基于形式的操作**：按类型和标识符定位函数，而非文本匹配\n- **多种操作**：替换、在前插入、在后插入\n- **语法验证**：内置 linting 功能防止括号不匹配\n- **defmethod 处理**：支持带限定名和分派值的函数\n\n#### 代码评估 (`clojure_eval`)\n- **REPL 集成**：在已连接的 nREPL 会话中执行\n- **辅助函数**：内置命名空间和符号探索工具\n- **多表达式**：评估并分割多个表达式\n\n#### Shell 命令 (`bash`)\n- **可配置执行**：可根据配置通过 nREPL 或本地执行\n- **会话隔离**：使用 nREPL 模式时，在独立会话中运行，以避免干扰 REPL\n- **输出截断**：一致的 8500 字符限制，并智能分配 stderr\u002Fstdout\n- **路径安全**：验证文件系统路径是否在允许的目录范围内\n\n#### 代理系统 (`dispatch_agent`)\n- **自主搜索**：处理复杂的多步骤探索任务\n- **只读访问**：代理仅拥有只读工具访问权限\n- **详细结果**：返回分析和发现结果\n\n#### 便笺板 (`scratch_pad`)\n- **持久化工作区**：存储结构化数据，用于规划和工具间通信\n- **仅内存存储**：数据仅存储在内存中，会话结束时即丢失（默认行为）\n- **基于路径的操作**：使用 `set_path`、`get_path`、`delete_path` 进行精确的数据操作\n- **JSON 兼容性**：可存储任何 JSON 兼容的数据（对象、数组、字符串、数字、布尔值）\n\n## 🔧 自定义\n\nClojureMCP 被设计为高度可定制的。在 Alpha 阶段，创建您自己的自定义 MCP 服务器是根据您的特定需求配置系统的首要方式。\n\n您可以自定义：\n- **工具** - 选择要包含的工具，使用多方法或多映射创建新工具\n- **提示** - 为您的工作流添加项目特定的提示\n- **资源** - 公开您的文档、配置和项目信息\n- **工具选择** - 创建只读服务器、开发服务器或专用配置\n\n这种自定义方式既简单又强大——您实际上是在构建属于您自己的个性化 AI 开发伴侣。\n\n**📖 [完整自定义文档](doc\u002FREADME.md)**\n\n快速入门：**[创建您自己的自定义 MCP 服务器](doc\u002Fcustom-mcp-server.md)** - 大多数用户应该从这里开始。\n\n## CLI 选项\n\n传递给 `clojure -Tmcp start` 的值是 EDN 格式的值。\n\n#### `:port`\n**可选** - 连接到 nREPL 服务器的端口。当使用 `:start-nrepl-cmd` 而不指定 `:port` 时，端口将自动从命令输出中发现。\n\n`:port 7888`\n\n#### `:host`\n**可选** - nREPL 服务器的主机。如果未指定，则默认为 localhost。\n\n`:host \"localhost\"` 或 `:host \"0.0.0.0\"`\n\n#### `:not-cwd`\n**可选** - 如果为 true，则不将当前工作目录用作项目目录。需要指定 `:port`。MCP 服务器将通过 introspect nREPL 连接来发现项目的根目录。\n\n这对于 Claude Desktop 和其他在项目目录之外启动 MCP 服务器的客户端来说至关重要。通过连接到运行在您项目中的 nREPL，ClojureMCP 可以自动确定正确的根目录。\n\n`:not-cwd true`\n\n#### `:start-nrepl-cmd`\n**可选** - 用于在尚未运行 nREPL 服务器时自动启动 nREPL 服务器的命令。必须以字符串向量的形式指定。MCP 服务器将启动该进程并管理其生命周期。\n\n当与 `:port` 一起使用时，MCP 服务器会从命令输出中自动解析端口；而单独使用时，则会使用固定的端口。\n\n**重要提示**：此选项要求您从项目目录（即包含 `deps.edn` 或 `project.clj` 的目录）运行 `clojure-mcp`。nREPL 服务器将在当前工作目录中启动。这对于 Claude Code 和其他希望自动启动 nREPL 而无需手动管理进程的命令行 LLM 客户端特别有用。\n\n**Claude Desktop 用户注意**：Claude Desktop 不会从您的项目目录启动 MCP 服务器，因此除非您同时提供指向特定项目的 `:project-dir` 命令行参数，否则 `:start-nrepl-cmd` 将不起作用。例如：`:project-dir '\"\u002Fpath\u002Fto\u002Fyour\u002Fclojure\u002Fproject\"'`。这一限制不会影响 Claude Code 或您从项目目录运行的其他基于 CLI 的工具。\n\n`:start-nrepl-cmd [\"lein\" \"repl\" \":headless\"]` 或 `:start-nrepl-cmd [\"clojure\" \"-M:nrepl\"]`\n\n#### `:config-file`\n**可选** - 指定配置文件的位置。必须是现有文件的路径。\n\n`:config-file \"\u002Fpath\u002Fto\u002Fconfig.edn\"`\n\n#### `:project-dir`\n**可选** - 指定代码库的工作目录。这会覆盖通过 nREPL 连接自动检测到的项目目录。必须是现有目录的路径。\n\n`:project-dir \"\u002Fpath\u002Fto\u002Fyour\u002Fclojure\u002Fproject\"`\n\n#### `:nrepl-env-type`\n**可选** - 指定我们通过 nREPL 连接所连接的环境类型。这会覆盖自动检测功能。有效选项包括：\n\n* `:clj` 表示 Clojure 或 ClojureScript\n* `:bb` 表示 [Babashka](https:\u002F\u002Fbabashka.org\u002F) - 一种原生且启动迅速的 Clojure 解释器，适用于脚本编写\n* `:basilisp` 表示 [Basilisp](https:\u002F\u002Fbasilisp.readthedocs.io\u002F) - 一种兼容 Clojure 的 Lisp 方言，目标为 Python 3.9+\n* `:scittle` 表示 [Scittle](https:\u002F\u002Fgithub.com\u002Fbabashka\u002Fscittle) - 直接从浏览器 script 标签执行 ClojureScript\n\n`:nrepl-env-type :bb`\n\n#### `:shadow-cljs-repl-message`\n**可选** - 控制 shadow-cljs REPL 模式状态消息是否包含在 eval 结果中（默认为 `true`）。当连接到 shadow-cljs nREPL 时，每个 eval 结果前都会附加一条关于 CLJS 模式的状态消息。将其设置为 `false` 可以禁用此消息。\n\n`:shadow-cljs-repl-message false`\n\n#### `:config-profile`\n**可选** - 加载一个内置配置文件，调整工具的可用性和描述。对于针对特定用例定制 ClojureMCP 非常有用。\n\n可用的配置文件包括：\n* `:cli-assist` - 用于 CLI 编程助手（Claude Code、Codex、Gemini CLI）的最小化工具集。禁用冗余工具，并将 `clojure_edit` 配置为原生 Edit 失败时的备用工具。\n\n`:config-profile :cli-assist`\n\n#### `:enable-tools`\n**可选** - 工具关键字白名单。如果提供，则会替换配置中的任何 `:enable-tools` 值。只有列出的工具才会可用。\n\n`:enable-tools [:clojure_eval :read_file]`\n\n#### `:disable-tools`\n**可选** - 工具关键字黑名单。如果提供，则会替换配置中的任何 `:disable-tools` 值。列出的工具将被禁用。\n\n`:disable-tools [:bash :dispatch_agent]`\n\n#### `:add-tools`\n**可选** - 在配置解析后强制启用特定工具。将工具从禁用列表中移除，并在存在启用列表时将其添加到启用列表中。这对于有选择地重新启用配置文件禁用的工具非常有用。\n\n`:add-tools [:my_custom_agent]`\n\n#### `:remove-tools`\n**可选** - 在配置解析后强制禁用特定工具。将工具加入禁用列表，并在存在启用列表时将其从启用列表中移除。这对于在不替换整个配置的情况下有选择地禁用工具非常有用。\n\n`:remove-tools [:clojure_eval]`\n\n#### 工具过滤应用顺序\n\n1. 加载配置文件（主目录 + 项目目录 + 配置文件合并）\n2. 选项中的 `:enable-tools`\u002F`:disable-tools` 替换配置值（如果提供）\n3. 应用 `:remove-tools`（强制禁用）\n4. 应用 `:add-tools`（强制启用 — 在重叠时优先于 `:remove-tools`）\n5. 环境变量 `ENABLE_TOOLS`\u002F`DISABLE_TOOLS` 仍然优先于一切\n\n有关配置文件中启用\u002F禁用列表如何工作的详细信息，请参阅 [组件过滤](doc\u002Fcomponent-filtering.md)。\n\n### 示例用法\n\n```bash\n# 仅指定端口的基本用法\nclojure -Tmcp start :port 7888\n\n# 自动启动 nREPL 服务器并发现端口\n# 非常适合 CLI 助手 - 请从您的项目目录运行\nclojure -Tmcp start :start-nrepl-cmd '[\"lein\" \"repl\" \":headless\"]'\n\n# 对于 deps.edn 项目（从项目目录运行）\nclojure -Tmcp start :start-nrepl-cmd '[\"clojure\" \"-M:nrepl\"]'\n\n# 自动启动并指定端口（使用固定端口，不进行解析）\nclojure -Tmcp start :port 7888 :start-nrepl-cmd '[\"clojure\" \"-M:nrepl\"]'\n\n# 对于 Claude Desktop：必须提供项目目录，因为它不会从你的项目中运行\nclojure -Tmcp start :start-nrepl-cmd '[\"lein\" \"repl\" \":headless\"]' :project-dir '\"\u002Fpath\u002Fto\u002Fyour\u002Fclojure\u002Fproject\"'\n\n# 使用自定义主机和项目目录\nclojure -Tmcp start :port 7888 :host '\"0.0.0.0\"' :project-dir '\"\u002Fpath\u002Fto\u002Fproject\"'\n\n# 使用自定义配置文件\nclojure -Tmcp start :port 7888 :config-file '\"\u002Fpath\u002Fto\u002Fcustom-config.edn\"'\n\n# 指定 Babashka 环境\nclojure -Tmcp start :port 7888 :nrepl-env-type :bb\n\n# 使用 cli-assist 配置文件以启用 CLI 编程助手\nclojure -Tmcp start :config-profile :cli-assist\n\n# 启用 cli-assist 并重新启用自定义代理工具\nclojure -Tmcp start :config-profile :cli-assist :add-tools '[:my_custom_agent]'\n\n# 启用 cli-assist，但同时移除 clojure_eval 工具\nclojure -Tmcp start :config-profile :cli-assist :remove-tools '[:clojure_eval]'\n\n# 完全覆盖——仅使用这两个工具\nclojure -Tmcp start :enable-tools '[:clojure_eval :read_file]'\n```\n\n**注意**：字符串值需要在 shell 中正确引用，因此使用 `'\"value\"'` 语法来表示字符串。\n\n## ⚙️ 配置\n\nClojure MCP 服务器支持通过项目根目录下的 `.clojure-mcp\u002Fconfig.edn` 文件进行最小化的项目特定配置。此配置为 MCP 服务器提供了安全控制和自定义选项。\n\n### 配置文件位置\n\n在项目根目录下创建 `.clojure-mcp\u002Fconfig.edn` 文件：\n\n```\nyour-project\u002F\n├── .clojure-mcp\u002F\n│   └── config.edn\n├── src\u002F\n├── deps.edn\n└── ...\n```\n\n### 配置选项\n\n配置的详细说明请参阅 [此处](doc\u002FCONFIG.md)。\n\n### 配置示例\n\n```edn\n{:allowed-directories [\".\"\n                       \"src\"\n                       \"test\"\n                       \"resources\"\n                       \"dev\"\n                       \"\u002Fabsolute\u002Fpath\u002Fto\u002Fshared\u002Fcode\"\n                       \"..\u002Fsibling-project\"]\n :write-file-guard :partial-read\n :cljfmt false\n :bash-over-nrepl false}\n```\n\n### 配置细节\n\n**路径解析**：\n- 相对路径（如 `\"src\"`、`\"..\u002Fother-project\"`）会相对于项目根目录解析。\n- 绝对路径（如 `\"\u002Fhome\u002Fuser\u002Fshared\"`）则按原样使用。\n- 项目根目录会自动包含在允许的目录列表中。\n\n**安全措施**：\n- 所有文件操作都会由工具验证是否在允许的目录范围内。\n- 尝试访问允许目录之外的文件将导致错误。\n- 这可以防止意外访问敏感的系统文件。\n- 注意，Bash 工具不受这些限制的影响，使用时需谨慎。\n\n**默认行为**：\n- 如果没有配置文件，只有项目目录及其子目录是可访问的。\n- nREPL 的工作目录会自动添加到允许的目录列表中。\n\n**注意**：配置会在 MCP 服务器启动时加载。修改配置后，请重启服务器或聊天代理。\n\n## 📝 许可证\n\nEclipse 公共许可证 - v 2.0\n\n版权所有 © 2025 布鲁斯·豪曼\n\n本程序及随附材料根据 Eclipse 公共许可证 2.0 提供，该许可证可在 http:\u002F\u002Fwww.eclipse.org\u002Flegal\u002Fepl-2.0 上找到。\n\n### 许可证摘要\n\n- ✅ **可自由使用**：用于个人项目、内部业务工具和开发。\n- ✅ **可修改和分发**：欢迎改进和分支。\n- ✅ **商业用途**：企业可以无限制地将其用于商业用途。\n- ✅ **灵活许可**：可与专有代码结合使用。\n- 📤 **分享改进**：分发时必须公开源代码。","# ClojureMCP 快速上手指南\n\nClojureMCP 是一个专为 Clojure 设计的 MCP（Model Context Protocol）服务器，旨在将 LLM 客户端（如 Claude Code、Claude Desktop）与您的 Clojure 项目连接起来。它提供 REPL 集成和感知 Clojure 语法的编辑工具，能够可靠地处理括号匹配和代码格式化。\n\n## 环境准备\n\n在开始之前，请确保您的开发环境满足以下要求：\n\n*   **Clojure**: 已安装并配置好 Clojure 命令行工具。\n*   **Java**: JDK 17 或更高版本。\n*   **Ripgrep (强烈推荐)**: 用于显著提升 `grep` 和文件搜索性能。\n    *   安装方式示例 (macOS): `brew install ripgrep`\n    *   安装方式示例 (Linux): `sudo apt-get install ripgrep` 或通过包管理器安装。\n\n## 安装步骤\n\n使用 Clojure 官方工具安装器进行全局安装：\n\n```bash\nclojure -Ttools install-latest :lib io.github.bhauman\u002Fclojure-mcp :as mcp\n```\n\n安装完成后，您可以在任何目录下通过 `clojure -Tmcp start` 命令启动服务。\n\n## 基本使用\n\n根据您的使用场景（命令行助手或桌面应用），选择以下一种方式进行配置。\n\n### 场景一：命令行助手 (CLI Assistants)\n适用于 **Claude Code**, **OpenAI Codex**, **Google Gemini CLI** 等工具。这些工具通常自带优秀的文件编辑功能，ClojureMCP 主要作为 REPL 集成和结构化编辑的补充。\n\n**推荐方案**：首先尝试轻量版 [clojure-mcp-light](https:\u002F\u002Fgithub.com\u002Fbhauman\u002Fclojure-mcp-light)。若需要更强大的结构化编辑 fallback 或优先使用 MCP 工具调用 REPL，可添加完整版的 `:cli-assist` 配置。\n\n**添加配置命令：**\n\n*   **Claude Code:**\n    ```bash\n    claude mcp add clojure-mcp -- clojure -Tmcp start :config-profile :cli-assist\n    ```\n*   **OpenAI Codex:**\n    ```bash\n    codex mcp add clojure-mcp -- clojure -Tmcp start :config-profile :cli-assist\n    ```\n*   **Google Gemini CLI:**\n    ```bash\n    gemini mcp add clojure-mcp clojure -Tmcp start :config-profile :cli-assist\n    ```\n\n**验证安装：**\n在项目目录下运行以下命令，若看到 JSON-RPC 输出则表示成功：\n```bash\nclojure -Tmcp start :config-profile :cli-assist\n```\n\n### 场景二：Claude Desktop (桌面应用)\n桌面应用通常不在项目目录下运行，且缺乏内置编程工具。此场景需配合项目中运行的 nREPL 使用。\n\n**1. 启动 nREPL**\n在您的 Clojure 项目目录下启动 nREPL 服务器（默认端口通常为 7888，具体请参考项目 `deps.edn` 配置）：\n```bash\ncd \u002Fpath\u002Fto\u002Fyour\u002Fproject\nclojure -M:nrepl\n```\n*注意：请确保 nREPL 监听在端口 7888，或相应调整后续配置。*\n\n**2. 获取 Shell 路径**\n找到您当前使用的 Shell 绝对路径：\n*   Bash: `which bash` (例如 `\u002Fopt\u002Fhomebrew\u002Fbin\u002Fbash`)\n*   Zsh: `which zsh` (例如 `\u002Fbin\u002Fzsh`)\n\n**3. 配置 Claude Desktop**\n编辑配置文件 `~\u002FLibrary\u002FApplication\\ Support\u002FClaude\u002Fclaude_desktop_config.json` (macOS) 或对应系统的路径。将 `\u003CSHELL_PATH>` 替换为上一步获取的路径：\n\n```json\n{\n    \"mcpServers\": {\n        \"clojure-mcp\": {\n            \"command\": \"\u003CSHELL_PATH>\",\n            \"args\": [\n                \"-c\",\n                \"clojure -Tmcp start :not-cwd true :port 7888\"\n            ]\n        }\n    }\n}\n```\n*说明：`:not-cwd true` 参数让 ClojureMCP 通过 nREPL 连接自动发现项目目录，而非使用 Claude Desktop 的启动目录。*\n\n**4. 关键设置**\n重启 Claude Desktop 后，请务必进入 **Settings > Capabilities**，将 **Code Execution and file creation** 设置为 **Off**。这是为了避免原生工具与 ClojureMCP 的功能冲突。\n\n**5. 开始对话**\n在聊天窗口点击 `+` 号添加工具\u002F资源，推荐初始化以下内容以增强上下文理解：\n*   Resource: `PROJECT_SUMMARY.md` (可由 LLM 生成)\n*   Resource: `Clojure Project Info` (自动内省项目)\n*   Prompt: `clojure_repl_system_prompt`\n\n现在您可以让 AI 协助编写代码、在 REPL 中验证逻辑或运行测试了。","一位 Clojure 开发者正试图让 AI 助手修复一个因括号嵌套错误导致运行时崩溃的复杂数据处理函数。\n\n### 没有 clojure-mcp 时\n- **括号地狱难以逾越**：AI 生成的代码经常丢失或错配括号，导致整个文件语法损坏，开发者必须手动逐行检查平衡性。\n- **REPL 交互断裂**：AI 无法直接连接本地 REPL 验证代码，只能盲目生成片段，开发者需频繁切换窗口手动复制粘贴测试。\n- **格式化混乱**：自动修复往往破坏 Clojure 特有的缩进风格（如 `cljfmt` 规则），产生大量无意义的代码差异噪音。\n- **调试效率低下**：当 AI 的查找替换策略失败时（例如匹配字符串不精确），缺乏结构性编辑能力来精准定位并重写特定代码形式（Form）。\n\n### 使用 clojure-mcp 后\n- **智能括号修复**：clojure-mcp 内置 `parinfer` 和分隔符修复机制，确保 AI 输出的每一行代码括号自动平衡，从源头消除语法错误。\n- **无缝 REPL 驱动开发**：工具直接将 AI 连接到本地 REPL，允许模型实时评估表达式并获取反馈，实现“编写 - 运行 - 修正”的闭环。\n- **原生格式感知**：集成 `cljfmt` 和 `clj-rewrite`，确保所有代码修改自动符合 Clojure 社区标准格式，保持代码库整洁一致。\n- **结构化精准编辑**：即使常规文本匹配失败，clojure-mcp 也能通过识别代码形式（Form）的类型和名称进行结构性重写，大幅提升修复成功率。\n\nclojure-mcp 将 AI 从单纯的文本生成器升级为懂 Clojure 语法的结对编程伙伴，彻底释放了 REPL 驱动开发的潜力。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fbhauman_clojure-mcp_2b76961c.png","bhauman","Bruce Hauman","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fbhauman_c1c2d812.jpg",null,"http:\u002F\u002Frigsomelight.com","https:\u002F\u002Fgithub.com\u002Fbhauman",[80,84],{"name":81,"color":82,"percentage":83},"Clojure","#db5855",99.9,{"name":85,"color":86,"percentage":87},"Shell","#89e051",0.1,727,76,"2026-04-09T20:21:36","EPL-2.0","Linux, macOS, Windows","未说明",{"notes":95,"python":96,"dependencies":97},"该工具是基于 Clojure 的 MCP 服务器，不需要 Python 环境。必须安装 Clojure 工具和 JDK 17 或更高版本。强烈建议安装 ripgrep 以提升文件搜索性能。在桌面端使用时，需配置外部 nREPL 服务器连接；在 CLI 助手使用时，可作为 REPL 集成和结构化编辑的补充工具。","不需要",[81,98,99,100],"Java JDK 17+","ripgrep (可选但强烈推荐)","nREPL",[14,52],"2026-03-27T02:49:30.150509","2026-04-10T18:54:26.655680",[105,110,115,120,125,130],{"id":106,"question_zh":107,"answer_zh":108,"source_url":109},28015,"如何在 Claude Desktop 中配置 clojure-mcp 服务器？","需要在 `~\u002F.clojure\u002Fdeps.edn` 中定义别名（alias），例如 `:mcp`，并指定依赖项和执行函数。然后在 `~\u002FLibrary\u002FApplication Support\u002FClaude\u002Fclaude_desktop_config.json` (macOS) 中配置 MCP 服务器，使用 `\u002Fbin\u002Fsh -c` 命令导出 PATH 并执行 `clojure -X:mcp :port \u003C端口号>`。示例配置：\n\ndeps.edn:\n:aliases {:mcp {:deps {com.bhauman\u002Fclojure-mcp {:git\u002Furl \"https:\u002F\u002Fgithub.com\u002Fbhauman\u002Fclojure-mcp.git\" :git\u002Ftag \"v0.1.5-alpha\"}} :exec-fn clojure-mcp.main\u002Fstart-mcp-server :exec-args {:port 7888}}}\n\nclaude_desktop_config.json:\n\"mcpServers\": {\"clojure-mcp\": {\"command\": \"\u002Fbin\u002Fsh\", \"args\": [\"-c\", \"export PATH=\u002Fopt\u002Fhomebrew\u002Fbin:$PATH && exec clojure -X:mcp :port 7888\"]}}","https:\u002F\u002Fgithub.com\u002Fbhauman\u002Fclojure-mcp\u002Fissues\u002F46",{"id":111,"question_zh":112,"answer_zh":113,"source_url":114},28016,"为什么在使用 clojure_edit_replace_sexp 工具时报告 'Invalid Clojure code in match_form' 错误？","该错误通常是因为提供的 `:match_form` 不是一个完整的 Clojure S-表达式（例如缺少闭合括号）。虽然工具调用本身有效，但服务器会对匹配形式进行语法验证。如果目的是重命名变量或修改部分代码，请确保 `:match_form` 是语法完整的表单，或者检查是否因截断导致括号不匹配。目前协议主要处理工具执行，需保证输入代码片段的语法正确性。","https:\u002F\u002Fgithub.com\u002Fbhauman\u002Fclojure-mcp\u002Fissues\u002F11",{"id":116,"question_zh":117,"answer_zh":118,"source_url":119},28017,"使用 ClojureMCP 是否必须建立 nREPL 连接？","不一定。nREPL 连接主要用于 `clojure_eval` 工具以提供动态求值功能，但这不应是硬性要求。在较新版本（如 0.1.7+）中，clojure-mcp 不再强制需要端口参数，默认会使用当前工作目录。如果仅需项目检查或文件编辑功能，可以不启动 nREPL 服务器直接运行。","https:\u002F\u002Fgithub.com\u002Fbhauman\u002Fclojure-mcp\u002Fissues\u002F70",{"id":121,"question_zh":122,"answer_zh":123,"source_url":124},28018,"如何为 Basilisp 项目配置 clojure-mcp？","对于 Basilisp 项目，如果使用 0.1.7-alpha 或更高版本，通常不需要显式传递 `:project-dir` 参数，工具会自动识别。如果必须指定项目目录，请使用单引号包裹路径字符串，命令格式如下：\nclojure -X:mcp :port 7890 :project-dir '\"\u002Fpath\u002Fto\u002Fyour\u002Fproject\"'\n注意不要使用标准的 JSON 风格双引号嵌套，Shell 解析时需要特定的引号处理方式以避免 'No user directory' 错误。","https:\u002F\u002Fgithub.com\u002Fbhauman\u002Fclojure-mcp\u002Fissues\u002F38",{"id":126,"question_zh":127,"answer_zh":128,"source_url":129},28019,"clojure-mcp 是否支持没有文件扩展名的 Babashka 脚本（例如带有 shebang 的可执行文件）？","早期版本会报错 'File must have a Clojure extension'，限制文件必须以 .clj, .cljs, .cljc, .bb 或 .edn 结尾。该问题已在后续更新中修复（commit 6256ff8），现在支持通过正则表达式识别带有 Shebang（如 `#!\u002Fusr\u002Fbin\u002Fenv bb`）的无扩展名文件。请确保升级到最新版本以支持此类文件编辑。","https:\u002F\u002Fgithub.com\u002Fbhauman\u002Fclojure-mcp\u002Fissues\u002F67",{"id":131,"question_zh":132,"answer_zh":133,"source_url":109},28020,"遇到 'Request timed out' 超时错误该如何排查？","如果在 Claude Desktop 中遇到初始化超时（Error: MCP error -32001: Request timed out），请检查以下几点：\n1. 确认操作系统环境（如 macOS Sequoia）及终端权限。\n2. 检查项目目录结构，运行 `find . -name . --type d` 确认当前目录是否正确，避免工具扫描到用户根目录导致路径异常。\n3. 查看 `clojure_project_inspect` 的输出，确认 Source Paths 和 Test Paths 是否符合预期，排除可疑的目录配置。\n4. 尝试回退到稳定版本（如 0.1.4-alpha）对比是否为新版本引入的回归问题。",[135],{"id":136,"version":137,"summary_zh":138,"released_at":139},188894,"v0.3.1","现在可以直接通过 `main\u002Fstart` 的选项和 CLI 来控制工具过滤，而无需使用配置文件。此外，还修复了 `deps_grep`，使其必须提供 `:type` 参数，并在结果中过滤掉二进制文件条目。\n\n### 新增\n- **工具过滤 CLI 选项**：为 `main\u002Fstart` 和 `clojure -Tmcp start` 新增了 `:enable-tools`、`:disable-tools`、`:add-tools` 和 `:remove-tools` 选项，允许以编程方式或通过 CLI 控制哪些工具会被暴露：\n  - `:enable-tools`\u002F`:disable-tools` — 绝对覆盖选项，会替换配置中的值。\n  - `:add-tools`\u002F`:remove-tools` — 相对修改选项，在解析配置后应用（当有重叠时，`:add-tools` 优先）。\n  - 结合 `:config-profile :cli-assist` 使用时非常有用，可以有选择地重新启用或禁用某些工具。\n\n### 修复\n- **`deps_grep`**：现在必须提供 `:type` 参数，并且会在结果中过滤掉二进制文件条目。","2026-03-14T16:07:16"]