unravel_team_mcp_clojure_sdk

unravel_team_mcp_clojure_sdk

by unravel-team
A Clojure SDK for building MCP servers and clients, enabling integration with tools like Claude Desktop and MCP Inspector.

Clojure SDK for Model Context Protocol Servers

Overview

The Clojure SDK for Model Context Protocol (MCP) Servers is a powerful tool designed to help developers create MCP servers (and eventually clients) using Clojure. This SDK simplifies the process of building and deploying MCP servers, enabling developers to focus on implementing their specific functionalities.

Features

  • Calculator Server: Provides basic arithmetic tools like addition, subtraction, multiplication, division, power, square root, average, and factorial.
  • Vega-lite Server: Generates Vega-lite charts for data visualization.
  • Code Analysis Server: Offers prompts for code analysis and generating poems about code.

Usage

Building the Examples Jar

To build the examples jar, run the following command:

$ make clean && make examples-jar

The examples jar includes the following servers:
1. Calculator Server
2. Vega-lite Server
3. Code Analysis Server

Calculator Server

The calculator_server provides basic arithmetic tools. Example commands you can try in Claude Desktop or Inspector:

  1. What's the average of [1, 2, 3, 4, 5]?
  2. What's the factorial of 15?
  3. What's 2 to the power of 1000?
  4. What's the square-root of 64?

Running the Calculator Server

In Claude Desktop:

"calculator": {
  "command": "java",
  "args": [
    "-Dclojure.tools.logging.factory=clojure.tools.logging.impl/log4j2-factory",
    "-Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog",
    "-Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector",
    "-Dlog4j2.configurationFile=log4j2-mcp.xml",
    "-Dbabashka.json.provider=metosin/jsonista",
    "-Dlogging.level=INFO",
    "-cp",
    "/Users/vedang/mcp-clojure-sdk/examples/target/io.modelcontextprotocol.clojure-sdk/examples-1.2.0.jar",
    "calculator_server"
  ]
}

In MCP Inspector:

npx @modelcontextprotocol/inspector java -Dclojure.tools.logging.factory=clojure.tools.logging.impl/log4j2-factory -Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog -Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -Dlog4j2.configurationFile=log4j2-mcp.xml -Dbabashka.json.provider=metosin/jsonista -Dlogging.level=INFO -cp examples/target/io.modelcontextprotocol.clojure-sdk/examples-1.2.0.jar calculator_server

Vega-lite Server

The vegalite_server generates Vega-lite charts for data visualization. Example commands you can try in Claude Desktop or Inspector:

[
  { "year": 2011, "value": 14.6, "growth_type": "Market Cap Growth" },
  { "year": 2011, "value": 11.4, "growth_type": "Revenue Growth" },
  { "year": 2011, "value": 26.6, "growth_type": "Net Income Growth" },
  { "year": 2012, "value": 40.1, "growth_type": "Market Cap Growth" },
  { "year": 2012, "value": 42.7, "growth_type": "Revenue Growth" },
  { "year": 2012, "value": 36.9, "growth_type": "Net Income Growth" },
  { "year": 2013, "value": 16.9, "growth_type": "Market Cap Growth" },
  { "year": 2013, "value": 14.6, "growth_type": "Revenue Growth" },
  { "year": 2013, "value": 15.3, "growth_type": "Net Income Growth" },
  { "year": 2014, "value": 9.6, "growth_type": "Market Cap Growth" },
  { "year": 2014, "value": 7.9, "growth_type": "Revenue Growth" },
  { "year": 2014, "value": 10.9, "growth_type": "Net Income Growth" },
  { "year": 2015, "value": 5.8, "growth_type": "Market Cap Growth" },
  { "year": 2015, "value": 6.7, "growth_type": "Revenue Growth" },
  { "year": 2015, "value": 6.2, "growth_type": "Net Income Growth" },
  { "year": 2016, "value": -12.4, "growth_type": "Market Cap Growth" },
  { "year": 2016, "value": -3.9, "growth_type": "Revenue Growth" },
  { "year": 2016, "value": -32.2, "growth_type": "Net Income Growth" },
  { "year": 2017, "value": 25.3, "growth_type": "Market Cap Growth" },
  { "year": 2017, "value": 5.9, "growth_type": "Revenue Growth" },
  { "year": 2017, "value": 43.9, "growth_type": "Net Income Growth" }
]

Running the Vega-lite Server

In Claude Desktop:

"vegalite": {
  "command": "java",
  "args": [
    "-Dclojure.tools.logging.factory=clojure.tools.logging.impl/log4j2-factory",
    "-Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog",
    "-Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector",
    "-Dlog4j2.configurationFile=log4j2-mcp.xml",
    "-Dbabashka.json.provider=metosin/jsonista",
    "-Dlogging.level=INFO",
    "-Dmcp.vegalite.vl_convert_executable=/Users/vedang/.cargo/bin/vl-convert",
    "-cp",
    "/Users/vedang/mcp-clojure-sdk/examples/target/io.modelcontextprotocol.clojure-sdk/examples-1.2.0.jar",
    "vegalite_server"
  ]
}

In MCP Inspector:

npx @modelcontextprotocol/inspector java -Dclojure.tools.logging.factory=clojure.tools.logging.impl/log4j2-factory -Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog -Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -Dlog4j2.configurationFile=log4j2-mcp.xml -Dbabashka.json.provider=metosin/jsonista -Dlogging.level=INFO -Dmcp.vegalite.vl_convert_executable=/Users/vedang/.cargo/bin/vl-convert -cp examples/target/io.modelcontextprotocol.clojure-sdk/examples-1.2.0.jar vegalite_server

Code Analysis Server

The code_analysis_server provides prompts for code analysis and generating poems about code.

Running the Code Analysis Server

In Claude Desktop:

"code-anaylsis": {
  "command": "java",
  "args": [
    "-Dclojure.tools.logging.factory=clojure.tools.logging.impl/log4j2-factory",
    "-Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog",
    "-Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector",
    "-Dlog4j2.configurationFile=log4j2-mcp.xml",
    "-Dbabashka.json.provider=metosin/jsonista",
    "-Dlogging.level=INFO",
    "-cp",
    "/Users/vedang/mcp-clojure-sdk/examples/target/io.modelcontextprotocol.clojure-sdk/examples-1.2.0.jar",
    "code_analysis_server"
  ]
}

In MCP Inspector:

npx @modelcontextprotocol/inspector java -Dclojure.tools.logging.factory=clojure.tools.logging.impl/log4j2-factory -Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog -Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -Dlog4j2.configurationFile=log4j2-mcp.xml -Dbabashka.json.provider=metosin/jsonista -Dlogging.level=INFO -cp examples/target/io.modelcontextprotocol.clojure-sdk/examples-1.2.0.jar code_analysis_server

Pending Work

For a list of pending changes, check the todo.org file.

Development of the SDK

The clojure-sdk is a standard deps-new project. Use the following commands for development:

  • Run tests: $ make test or clojure -T:build test
  • Run CI pipeline and build a JAR: $ make build or clojure -T:build ci
  • Install locally: $ make install or clojure -T:build install
  • Deploy to Clojars: $ make deploy or clojure -T:build deploy

Inspiration

This SDK is built on top of lsp4clj, which handles the edge-cases of a JSON-RPC based server.

License

Distributed under the MIT License. Copyright © 2025 Unravel.tech.

Features & Capabilities

Categories
mcp_server model_context_protocol clojure json_rpc api_integration claude vega_lite code_analysis

Implementation Details

Stats

0 Views
10 GitHub Stars

Repository Info

unravel-team Organization

Similar MCP Servers

continuedev_continue by continuedev
25049
21423
9300