Modex Minimal MCP Example
April 21, 2025 · View on GitHub
A minimal Model Context Protocol (MCP) plugin for Claude, built with Modex. This repository demonstrates how to wrap two simple tools—hello and inc—in a standalone Clojure server and integrate it into the Claude desktop application.
Table of Contents
- Prerequisites
- Project Structure
- Building the Uberjar
- Running the Server
- Claude Desktop Configuration
- Troubleshooting
- License
Prerequisites
- Java 11+: Required to run the generated JAR.
- Clojure CLI Tools: Used by the
build.shscript to compile and package. - Git: To fetch the Modex dependency from GitHub.
Project Structure
├── build.sh # Script to assemble the uberjar
├── deps.edn # Clojure CLI dependencies configuration
└── src
└── modex
└── minimal
└── core.clj # Namespace: modex.minimal.core
build.sh: Useshf.depstarto producetarget/minimal-mcp.jarwith AOT compilation and proper manifest.deps.edn: Declares Clojure, Modex, and other dependencies (including the Git SHA for Modex).src/modex/minimal/core.clj: Defines two tools—helloandinc—and the-mainentrypoint that starts the MCP server.
Building the Uberjar
Make the build script executable and run it:
chmod +x build.sh
./build.sh
Upon success, you’ll have:
target/minimal-mcp.jar
Running the Server
Start the MCP server from the generated JAR:
java -jar target/minimal-mcp.jar
The server will listen on stdin/stdout for JSON-RPC v2.0 requests (e.g., from Claude).
Claude Desktop Configuration
To wire this plugin into Claude’s desktop app, edit your config.json and add:
{
"mcpServers": {
"minimal-mcp": {
"command": "java",
"args": ["-jar", "/absolute/path/to/target/minimal-mcp.jar"]
}
},
"globalShortcut": ""
}
- Replace
/absolute/path/to/target/minimal-mcp.jarwith the actual path on your machine. - Optionally set a
globalShortcutfor quick activation.
Troubleshooting
-
ClassNotFoundException: Ensure yoursrc/modex/minimal/core.cljhas:(ns modex.minimal.core (:gen-class) …)and that
build.shspecifies:main-class modex.minimal.core. -
Git dependency errors: In
deps.edn, pin Modex correctly:theronic/modex {:git/url "https://github.com/theronic/modex.git" :sha "<commit-sha>"} -
Missing manifest entry: Verify with:
unzip -p target/minimal-mcp.jar META-INF/MANIFEST.MFYou should see:
Main-Class: modex.minimal.core
License
This example is provided under the MIT License. Feel free to adapt and extend it to build your own MCP tools with Modex.