Get the FREE Ultimate OpenClaw Setup Guide β†’

mcp

MCP Server library

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio roklenarcic-mcp-server clojure -M -m org.clojars.roklenarcic.mcp-server.core

How to use

This MCP server library provides a framework for building Model Context Protocol (MCP) servers in Clojure without forcing a particular transport, JSON library, or web framework. It exposes a set of core abstractions for sessions, routing of JSON-RPC-like calls to handlers, and a pluggable serialization layer. Typical usage involves choosing a JSON serializer, defining a session with a server-info descriptor and one or more tools/handlers, and then starting a STDIO-based server or integrating with your preferred transport. The README demonstrates creating a server with a weather example tool that receives a location and returns a generated weather description, illustrating how you can define input schemas, handler functions, and dispatch tables to route commands from clients.

To use this server, you would:

  • Pick a JSON serializer (choices include Charred, Cheshire, clj-data, and others) and wire it into the session via the serde abstraction.
  • Define a server-info map with a name, version, and instructions to describe your service.
  • Create tools by specifying a name, description, an input schema, and a handler function that processes incoming RPC calls.
  • Build a session (optionally starting from the provided helpers) and start the server over STDIO or your chosen transport by supplying the session to start-server-on-streams or a custom transport layer. The design emphasizes flexibility so you can swap in your own HTTP/WebSocket layer, logging, or data stores without changing core server logic.

How to install

Prerequisites:

  • Java runtime (recommended: Java 11+)
  • Clojure tooling installed (deps.edn and clojure command via clj/boot or babashka as desired)

Installation steps:

  1. Install Clojure tooling (if not already installed):
  2. Clone the repository or add the MCP server as a dependency in your project using your preferred Clojure tooling (deps.edn or leiningen).
  3. Add a dependency on the MCP server library in your deps.edn, for example (if published coordinates match): {:deps { org.clojars.roklenarcic/mcp-server {:mvn/version "<latest-version>"} }}
  4. Create a small application that requires the MCP server namespaces and builds a session as shown in the README examples (weather service etc.).
  5. Run your application with your normal Clojure startup flow (deps.edn + clojure -M:your-uber-jar or -X:your-main).

Note: The project is alpha and may require adapting to evolving APIs as features are added.

Additional notes

Tips and considerations:

  • The library supports both synchronous and asynchronous handlers; handlers may return plain values or Java CompletableFuture-like objects. Plan your tools accordingly.
  • You can mix JSON serializers by plugging in different serde implementations; you’re not locked into a single serializer.
  • Sessions are the central abstraction. They are maps stored in atoms and can hold per-connection state such as authentication data, database connections, or resource handles.
  • The README shows a complete STDIO-based server setup, but you can swap to other transports by implementing the client communication functions used by the exchange and handlers.
  • This project is in alpha; APIs and recommended patterns may change. Keep an eye on documentation and release notes for breaking changes.

Related MCP Servers

Sponsor this space

Reach thousands of developers β†—