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
Clojure: 1.10.0以上Leiningen: 2.9.1以上Installation
Installation
Prerequisites
Please specify required software and versions: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
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
Additional Resources
repl-mcp is an MCP server for Clojure development that provides interactive coding assistance and structural editing tools via nREPL integration. It aims to minimize friction and speed up the feedback loop during development. Users can create their own tools and workflows, and the project encourages feedback as it is currently in alpha stage.
clj-mcp-starter is a starter template designed to simplify the initial setup of projects using Clojure. It allows developers to quickly establish a Clojure environment and efficiently proceed with development. This reduces the time required to launch projects and promotes the development of applications that leverage the characteristics of Clojure.