MCPSERV.CLUB
hugoduncan

Mcp Clj

MCP Server

Clojure MCP server with self‑contained REPL

Active(80)
44stars
2views
Updated 11 days ago

About

Mcp Clj implements the Model Context Protocol in Clojure, providing a lightweight MCP server and client with built‑in tools like clj-eval and ls. It supports stdio, SSE, and in‑memory transports for easy integration with agents such as Claude Desktop.

Capabilities

Resources
Access data sources
Tools
Execute functions
Prompts
Pre-built templates
Sampling
AI model interactions

Overview

mcp‑clj is a lightweight, Clojure‑centric implementation of the Model Context Protocol (MCP) that bridges AI assistants like Claude with native Clojure tooling. By running an MCP server inside a Clojure process, it exposes a REPL and file‑system utilities directly to the assistant without requiring an external nREPL or complex tooling chain. This solves a common pain point for developers who want to harness AI reasoning while still executing and inspecting code in the same runtime environment.

The server is intentionally minimal: it depends only on and ships with its own REPL engine. That means no heavyweight JVM processes or external sockets are needed—just a single Clojure binary and an MCP transport. The built‑in tools include , which evaluates arbitrary Clojure code and returns the result, and , a file‑listing utility that respects rules. These tools let an assistant inspect project structure, run snippets, or debug logic in real time, all while staying within the same process that hosts the application.

mcp‑clj supports three transports—stdio, Server‑Sent Events (SSE) over HTTP, and an in‑memory channel for testing. The stdio transport is the recommended setup for Claude Desktop, enabling a seamless “plug‑and‑play” experience: the assistant can issue calls and receive immediate results without leaving its UI. The SSE transport allows web‑based clients or other services to connect over a standard HTTP endpoint, making the server suitable for microservice architectures where AI agents need to query Clojure code from a remote host.

Key advantages include zero external dependencies beyond the JSON library, self‑contained evaluation, and the ability to add custom tools at runtime. Developers can define new MCP actions—such as a custom tool or domain‑specific utilities—and inject them into the running server with simple Clojure calls. The client library also lets you consume other MCP servers from within a Clojure application, enabling bidirectional AI–Clojure integration.

Typical use cases span from rapid prototyping (where an assistant evaluates snippets while a developer iterates) to production pipelines that expose business logic to AI agents for monitoring or automated debugging. By keeping the MCP server in the same process that runs your application, you avoid context switches, reduce latency, and maintain a single source of truth for state and configuration. This makes mcp‑clj an ideal choice for teams that value tight coupling between AI assistants and their Clojure codebases.