mcp-clojure-sdk

This Clojure SDK is a tool for creating Model Context Protocol servers. It includes examples such as a calculator and data visualization, providing templates for developers to quickly set up servers. The SDK also contains detailed documentation to help understand the communication flow and core components.

GitHub Stars

54

User Rating

Not Rated

Favorites

0

Views

63

Forks

7

Issues

0

Installation
Difficulty
Intermediate
Estimated Time
10-20 minutes
Requirements
Clojure: 1.10.0以上
Leiningen: 2.9.1以上

Installation

Installation

Prerequisites

Please specify required software and versions:
Clojure: 1.10.0 or higher
Leiningen: 2.9.1 or higher

Installation Steps

1. Clone Repository

bash
git clone https://github.com/unravel-team/mcp-clojure-sdk.git
cd mcp-clojure-sdk

2. Install Dependencies

bash
lein deps

3. Build Sample Servers

bash
make clean && make examples-jar

Troubleshooting

Common Issues

Issue: Server won't start Solution: Check Clojure and Leiningen versions, and reinstall dependencies. Issue: Sample server not found Solution: Verify the path to the JAR file.

Configuration

Configuration

Basic Configuration

Claude Desktop Setup

Edit ~/.config/claude-desktop/claude_desktop_config.json (macOS/Linux) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
json
{
  "mcpServers": {
    "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",
        "-jar",
        "path/to/examples.jar"
      ]
    }
  }
}

Environment Variables

Set the following environment variables as needed:
bash
export API_KEY="your-api-key"
export DEBUG="true"

Configuration Example

Basic Configuration

json
{
  "mcpServers": {
    "example-mcp": {
      "command": "java",
      "args": ["-jar", "path/to/examples.jar"]
    }
  }
}

Examples

Examples

Basic Usage

Here are basic usage examples for the MCP server:

Using with Claude Desktop

1Verify MCP Server Startup
Open Claude Desktop and confirm that the configuration has been loaded correctly.
2Execute Basic Commands

   Available tools from this MCP server:
   - calculator: Basic arithmetic operations
   

Programmatic Usage

clojure
;; Clojure example
(require '[clojure.java.shell :as shell])
(shell/sh "java" "-jar" "path/to/examples.jar")

Advanced Examples

Automation Script

bash
#!/bin/bash

Batch processing example

for file in *.txt; do mcp-tool process "$file" done

API Integration

python

Python example

import requests import json def call_mcp_tool(tool_name, params): response = requests.post( 'http://localhost:3000/mcp/call', json={ 'tool': tool_name, 'parameters': params } ) return response.json()

Usage example

result = call_mcp_tool('analyze', { 'input': 'sample data', 'options': {'format': 'json'} })

Use Cases

Building a calculator server for basic arithmetic operations
Implementing a Vega-lite server for data visualization
Developing a server for code analysis
Integrating with AI models using MCP

Additional Resources