HM

hugoduncan/mcp-clj

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

58 stars 11 forks 质量 64 趋势 13EPL-2.0

hugoduncan/mcp-clj 是从 https://github.com/hugoduncan/mcp-clj. 导入的 MCP 服务器候选。

概览

hugoduncan/mcp-clj 是从 https://github.com/hugoduncan/mcp-clj. 导入的 MCP 服务器候选。

概述(AI 翻译)

这是模型上下文协议(MCP)的Clojure实现,依赖最小,且自包含Clojure REPL集成。

快速启动

跳转到: 安装 • 客户端使用情况 • Claude 代码设置 • Claude 桌面设置 • 开发

什么以及为什么

mcp-clj 在 Clojure 中同时提供 MCP 服务器 和 客户端 实现:

  • 自包含REPL:直接在服务器进程中评估Clojure(无nREPL依赖)
  • 低依赖:只需org.clojure/data.json
  • 多传输:SSE(HTTP)、标准节点和内存测试
  • 内置工具:支持gitignore的Clojure评估(clj-eval)和文件列表(ls)
  • MCP 客户端:通过 Clojure 连接到其他 MCP 服务器

何时使用mcp-clj:

  • 向 Claude Desktop 或其他 MCP 客户端开放 Clojure REPL 功能
  • 构建消耗MCP服务的Clojure应用程序
  • 无需外部 REPL 依赖的简单部署

与clojure-mcp的权衡:

  • ✅ 更简单的设置,自包含的评估
  • ❌ 无法连接现有的远程REPL
  • ❌ 内置工具较少

安装

Git 依赖关系(推荐)

CLI 使用

服务器使用

基础服务器

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

mcp-clj

A Clojure implementation of the Model Context Protocol (MCP) with minimal dependencies and self-contained Clojure REPL integration.

Quick Start

# 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)

Jump to: Installation • Client Usage • Claude Code Setup • Claude Desktop Setup • Development

What & Why

mcp-clj provides both MCP server and client implementations in Clojure:

  • Self-contained REPL: Evaluates Clojure directly in the server process (no nREPL dependency)
  • Low dependencies: Only requires org.clojure/data.json
  • Multiple transports: SSE (HTTP), stdio, and in-memory for testing
  • Built-in tools: Clojure evaluation (clj-eval) and file listing (ls) with gitignore support
  • MCP client: Connect to other MCP servers from Clojure

When to use mcp-clj:

  • Expose Clojure REPL functionality to Claude Desktop or other MCP clients
  • Build Clojure applications that consume MCP services
  • Simple deployment without external REPL dependencies

Trade-offs vs clojure-mcp:

  • ✅ Simpler setup, self-contained evaluation
  • ❌ Cannot connect to existing remote REPLs
  • ❌ Fewer built-in tools

Installation

;; 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 Usage

# 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

Server Usage

Basic Server

(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))

Custom Tools

(def echo-tool
  {:name "echo"
   :description "Echo the input text"
   :inputSchema {:type "object"
                 :properties {"text" {:type "string"}}
                 :required ["text"]}
   :implementation (fn [{:keys [text]}]
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "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" } } } }