Skip to content

Quickstart

This page will walk you through creating your first PluMCP server.

Prerequisites

Make sure you have installed the required software.

1. Create the MCP server app

Run the following commands in a terminal as follows:

lein new app hello-mcp-clj
cd hello-mcp-clj
lein new app hello-mcp-clj
cd hello-mcp-clj

With Node.js:

npx create-cljs-project hello-mcp-cljs
cd hello-mcp-cljs
With Bun.js:
bunx create-cljs-project hello-mcp-cljs
cd hello-mcp-cljs

2. Add/edit the dependencies

Edit the files as highlighted below:

project.clj
(defproject hello-mcp-clj "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "https://example.com/FIXME"
  :dependencies [[org.clojure/clojure "1.12.4"]
                 [io.github.plumce/plumcp.core-json-charred "0.1.0"]]
  :main ^:skip-aot hello-mcp-clj.core
  :target-path "target/%s"
  :profiles {:uberjar
             {:aot :all
              :jvm-opts ["-Dclojure.compiler.direct-linking=true"]}})
project.clj
(defproject hello-mcp-clj "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "https://example.com/FIXME"
  :dependencies [[org.clojure/clojure "1.12.4"]
                 [io.github.plumce/plumcp.core-json-charred "0.1.0"]
                 [com.github.clj-easy/graal-build-time "1.0.5"]]
  :main ^:skip-aot hello-mcp-clj.core
  :target-path "target/%s"
  :profiles {:uberjar {:aot :all
                       :jvm-opts ["-Dclojure.compiler.direct-linking=true"]}
             :dev {:plugins [[lein-shell "0.5.0"]]}}
  :aliases
  {"native"
   ["shell"
    "native-image"
    "-Ob"
    "-H:+TraceNativeToolUsage"
    "-H:+AllowIncompleteClasspath"
    "--verbose"
    "--no-fallback"
    "--report-unsupported-elements-at-runtime"
    ;; add here the namespaces of the library to test separated by commas
    "--features=clj_easy.graal_build_time.InitClojureClasses"
    "-jar"
    "./target/uberjar/${:uberjar-name:-${:name}-${:version}-standalone.jar}"
    "-H:Name=./target/${:name}"]

   "run-native" ["shell" "./target/${:name}"]})
shadow-cljs.edn
;; shadow-cljs configuration
{:source-paths
 ["src/dev"
  "src/main"
  "src/test"]

 :dependencies
 [[io.github.plumce/plumcp.core-json-charred "0.1.0"]]

 :builds
 {:app {:target :node-script
        :main hello-mcp-cljs.core/main
        :output-to "out/node-server.js"}}}

3. Edit the sources

Add or edit the source files to add an MCP tool as follows:

src/hello_mcp_clj/core.clj
(ns hello-mcp-clj.core
  (:require [plumcp.core.api.entity-support :as es]
            [plumcp.core.api.mcp-server :as ms])
  (:gen-class))

(def info (es/make-info "Hello MCP Server" "0.1.0"))

(defn ^{:mcp-type :tool} add
  "Add two integers"
  [{:keys [^{:doc "An integer" :type "integer"} a
           ^{:doc "Another integer" :type "integer"} b]}]
  (str "Sum of " a " and " b " is " (+ a b)))

(defn -main
  [& args]
  (ms/run-server {:info info :transport :http}))
src/hello_mcp_clj/core.clj
(ns hello-mcp-clj.core
  (:require [plumcp.core.api.entity-support :as es]
            [plumcp.core.api.mcp-server :as ms])
  (:gen-class))

(def info (es/make-info "Hello MCP Server" "0.1.0"))

(defn ^{:mcp-type :tool} add
  "Add two integers"
  [{:keys [^{:doc "An integer" :type "integer"} a
           ^{:doc "Another integer" :type "integer"} b]}]
  (str "Sum of " a " and " b " is " (+ a b)))

(defn -main
  [& args]
  (ms/run-server {:info info :transport :http}))

Create any missing/required directory:

mkdir -p src/main/hello_mcp_cljs
Then create this file as follows:
src/main/hello_mcp_cljs/core.cljs
(ns hello-mcp-cljs.core
  (:require
   [plumcp.core.api.entity-support :as es]
   [plumcp.core.api.mcp-server :as ms]))

(def info (es/make-info "Hello MCP Server" "0.1.0"))

(defn ^{:mcp-type :tool} add
  "Add two integers"
  [{:keys [^{:doc "An integer" :type "integer"} a
           ^{:doc "Another integer" :type "integer"} b]}]
  (str "Sum of " a " and " b " is " (+ a b)))

(defn main
  [& args]
  (ms/run-server {:info info :transport :http}))

4. Compile/Run the MCP server

lein run
lein uberjar
lein native
lein run-native  # or ./target/hello-mcp-clj

Using Node.js:

npx shadow-cljs compile :app
node out/node-server.js
Using Bun.js:
bunx shadow-cljs compile :app
bun out/node-server.js

When the MCP server is up and running, you may connect using a suitable MCP client.