Token导航 LogoToken导航TokenDH.com
MCP Clj logo
开发工具未说明官方级别未说明来源级核验

MCP Clj

MCP Server

A MCP server written in clojure

工具数

0

提示词数

0

GitHub Stars

57

资源数

0
服务器实现开发工具ClaudeClaude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

hugoduncan

提供方

hugoduncan

最后核验

2026/5/18 04:04

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

mcp-clj 翻译为中文可以是“MCP-CLJ”(如果这是一个特定的名称或缩写,且没有更具体的上下文来决定其含义,通常保持原样)。不过,如果“mcp-clj”是某种特定技术、项目或概念的缩写,并且在中文中有对应的翻译或更常用的表达,那么应该使用那个翻译。但基于提供的信息,直接翻译就是“MCP-CLJ”。

一个具有最小依赖且集成有自包含Clojure REPL的Clojure语言实现的模型上下文协议(MCP)。

快速入门

# Add to deps.edn
{:deps {org.hugoduncan/mcp-clj
        {:git/url   "https://github.com/hugoduncan/mcp-clj"
         :git/sha   "latest-commit-sha"
         :deps/root "projects/server"}}}
;; Start MCP server
(require 'mcp-clj.mcp-server.core)
(def server (mcp-clj.mcp-server.core/create-server {:transport {:type :stdio}}))

;; Server exposes tools like clj-eval and ls
;; Connect with Claude Desktop via stdio transport (see Claude Desktop Setup)

跳转到: 安装客户使用情况克劳德代码设置Claude 桌面版安装发展

什么 & 为什么

mcp-clj 同时提供了 MCP服务器 并且 客户 在Clojure中的实现:

  • 自包含的REPL(读取-求值-打印循环)直接在服务器进程中评估Clojure代码(无需nREPL依赖)
  • 低依赖性仅需 org.clojure/data.json
  • 多种运输方式SSE(HTTP)、stdio 和内存中测试
  • 内置工具Clojure 评估(clj-eval) 和文件列表 (ls) 支持 .gitignore 文件
  • MCP客户端从Clojure连接到其他MCP服务器

何时使用mcp-clj:

  • 将Clojure REPL功能暴露给Claude Desktop或其他MCP客户端
  • 构建使用MCP服务的Clojure应用程序
  • 简单部署,无需外部REPL依赖

与Clojure-MCP的权衡对比:

  • ✅ 更简单的设置,独立完成评估
  • ❌ 无法连接到现有的远程REPL
  • ❌ 内置工具较少

安装

Git 依赖项(推荐)

;; deps.edn
{:deps {org.hugoduncan/mcp-clj
        {:git/url   "https://github.com/hugoduncan/mcp-clj"
         :git/sha   "latest-commit-sha"  ; Replace with actual latest SHA
         :deps/root "projects/server"}}}

CLI 使用方法

# Clone and run directly
git clone https://github.com/hugoduncan/mcp-clj
cd mcp-clj

# Start stdio server (recommended for Claude Desktop)
clj -M:stdio-server

# Start SSE server (HTTP) on port 3001 (default)
clj -M:sse-server

# Start SSE server on custom port
clj -M:sse-server --port 8080

服务器使用情况

基本服务器

(require 'mcp-clj.mcp-server.core)

;; Stdio server (recommended for Claude Desktop)
(def server (mcp-clj.mcp-server.core/create-server
             {:transport {:type :stdio}}))

;; SSE server (for HTTP-based clients)
(def server (mcp-clj.mcp-server.core/create-server
             {:transport {:type :sse :port 3001}}))

;; Stop server
((:stop server))

自定义工具

(def echo-tool
  {:name "echo"
   :description "Echo the input text"
   :inputSchema {:type "object"
                 :properties {"text" {:type "string"}}
                 :required ["text"]}
   :implementation (fn [{:keys [text]}]
                     {:content [{:type "text" :text text}]
                      :isError false})})

;; Server with custom tools
(def server (mcp-clj.mcp-server.core/create-server
             {:transport {:type :sse :port 3001}
              :tools {"echo" echo-tool}}))

;; Add tools dynamically
(mcp-clj.mcp-server.core/add-tool! server echo-tool)

内置工具

clj-eval(在中文语境下,可直接保留原名或根据上下文稍作解释,但通常不直接翻译,因其是一个特定的技术术语或项目名)评估Clojure表达式

{"name": "clj-eval", "arguments": {"code": "(+ 1 2 3)"}}
// Returns: "6"

ls列出文件并支持 gitignore

{"name": "ls", "arguments": {"path": "src", "max-depth": 2, "max-files": 50}}
// Returns: {"files": [...], "truncated": false, "total-files": 12}

客户端使用

从Clojure连接到其他MCP服务器:

(require 'mcp-clj.mcp-client.core)

;; Connect to stdio MCP server
(def client (mcp-clj.mcp-client.core/create-client
             {:transport {:type :stdio
                          :command "clojure"
                          :args ["-M:stdio-server"]}
              :client-info {:name "my-client" :version "1.0.0"}}))

;; Wait for connection
(mcp-clj.mcp-client.core/wait-for-ready client)

;; List available tools
(mcp-clj.mcp-client.core/list-tools client)
;; => {:tools [{:name "clj-eval" :description "..." :inputSchema {...}}]}

;; Call a tool
@(mcp-clj.mcp-client.core/call-tool client "clj-eval" {:code "(* 6 7)"})
;; => {:content [{:type "text" :text "42"}] :isError false}

;; Cleanup
(.close client)

克劳德代码设置

Claude Code 可以使用 stdio 传输方式连接到 mcp-clj 服务器。

1. 在你的项目中添加mcp-clj

在你的 deps.edn:

{:aliases
 {:mcp {:extra-deps {org.hugoduncan/mcp-clj
        {:git/url   "https://github.com/hugoduncan/mcp-clj"
         :git/sha   "latest-commit-sha"
         :deps/root "projects/server"}}
 :main-opts ["-m" "mcp-clj.stdio-server.main"]}}}

2. 配置Claude代码

使用Claude Code的命令行界面(CLI)添加MCP服务器:

claude mcp add mcp-clj clojure -M:mcp

3. 测试连接

# Verify the MCP server is configured and accessible
claude mcp list

你应该看看 mcp-clj 在可用服务器列表中。Claude 代码 现在将能够访问 clj-evalls 项目中的工具 上下文。

Claude 桌面版安装

Claude Desktop 可以通过 stdio 传输直接连接到 mcp-clj 无需额外的代理工具。

1. 在你的项目中添加mcp-clj

在你的 deps.edn

{:deps {org.hugoduncan/mcp-clj
        {:git/url   "https://github.com/hugoduncan/mcp-clj"
         :git/sha   "latest-commit-sha"
         :deps/root "projects/server"}}

 :aliases
 {:mcp {:main-opts ["-m" "mcp-clj.stdio-server.main"]}}}

2. 配置Claude桌面版

添加到 ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "mcp-clj": {
      "command": "/opt/homebrew/bin/bash",
      "args": [
        "-c",
        "cd /path/to/your/project && clojure -M:mcp"
      ],
      "env": {
        "PATH": "/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin"
      }
    }
  }
}

替换 /path/to/your/project 使用您实际的项目目录,并根据需要调整bash路径(which bash 找到你的(答案/东西)。

3. 重启Claude桌面版

克劳德现在将能够访问 clj-evalls 在项目环境中运行的工具。

发展

设置

git clone https://github.com/hugoduncan/mcp-clj
cd mcp-clj

# Start REPL with all components
clj -M:dev

测试

# Fast unit tests (default)
clj -M:kaocha:dev:test

# Integration tests (starts servers)
clj -M:kaocha:dev:test --focus :integration

# All tests
clj -M:kaocha:dev:test --focus :unit :integration

# Specific namespace
clj -M:kaocha:dev:test --focus mcp-clj.mcp-server.core-test

REPL 开发

;; After adding dependencies to deps.edn
(require 'clojure.repl.deps)
(clojure.repl.deps/sync-deps)

;; Reload namespace
(require 'my.namespace :reload)

;; Run tests
(require 'clojure.test)
(clojure.test/run-tests 'mcp-clj.mcp-server.core-test)

更新日志

CHANGELOG.md 翻译为中文是:“版本更新日志文件” 查看发行说明和版本历史。

在本地生成变更日志

安装 git-cliff:

# macOS
brew install git-cliff

# Or download from https://github.com/orhun/git-cliff/releases

生成变更日志:

# Preview unreleased changes
git cliff --unreleased

# Update CHANGELOG.md
git cliff -o CHANGELOG.md

建筑学

mcp-clj 使用一个 Polylith风格的架构 基于组件的组织方式:

  • 组件components/) - 可重用功能(mcp服务器、mcp客户端、json-rpc、工具等)
  • 基地 (bases/) - 入口点(sse-server,stdio-server)
  • 项目 (projects/server/- 可部署的制品

关键组件

  • mcp-server/ - MCP协议服务器,配备工具、提示和资源
  • mcp-client/ - MCP协议客户端,用于连接服务器
  • json-rpc/ - 带有自动EDN/JSON转换的JSON-RPC 2.0
  • tools/ - 内置的MCP工具(clj-eval,ls)
  • *-transport/ - 多个传输层(SSE、stdio、HTTP、内存中)

所有组件均使用 mcp-clj 命名空间,并遵循带有MCP协议版本的JSON-RPC 2.0标准 2024-11-05

做出贡献

  1. 为仓库创建分支(或:克隆仓库)
  2. 创建一个特性分支
  3. 进行更改并确保测试通过: clj -M:kaocha:dev:test
  4. 提交一个拉取请求

许可证

麻省理工学院许可证。参见 许可证 文件中有详细信息。

目录标签

目录标签

服务器实现开发工具Claudedeveloper-toolsClojure本地部署ClojureREPL模型上下文协议客户端实现

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP