Cherry Studio - bhauman/clojure-mcp GitHub Wiki

Cherry Studio

Cherry Studio setup using clojure-mcp-sse and nrepl running from a container.

I use podman, all of this should work with docker as well. I use a container to sandbox the nrepl and SSE server together, and mount my project into the container at /app/project.

Create a directory:

mkdir clojure-mcp-server && cd clojure-mcp-server

Create a file: Containerfile

FROM docker.io/library/eclipse-temurin:21 as JAVA

FROM docker.io/library/python:3.12-bookworm

RUN mkdir /app

WORKDIR /app

COPY ansible-mcp-server.sh .

RUN chmod 0750 ansible-mcp-server.sh

RUN apt-get update
RUN apt-get upgrade -y

# last line here can be omitted for a smaller container
# these tools make troubleshooting in the container easier
RUN apt-get install -y --no-install-recommends \
    ca-certificates curl git gnupg gzip jq \
    ssh rlwrap tar zip \
    iproute2 vim-tiny strace ncat nmap less

# install uv
RUN pip install uv

# don't hardlink (container is bind mounted) 
ENV UV_LINK_MODE=copy

ENV VIRTUAL_ENV=/app/.venv

# ansible 2.16 is LTS and required for EL8 and older debian based distros
# python 3.6 is 3 years past EOL and newer ansible versions dropped support
RUN uv venv $VIRTUAL_ENV && uv pip install 'ansible-core<2.17' && \
       uv pip install ansible-runner && \
       uv pip install ansible-lint

# install node.js and npm via nodesource
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
    && apt-get update && apt-get install -y nodejs

# confirm npm and node versions
RUN node -v && npm -v

# setup yarn
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update && apt-get install -y yarn

# install JAVA 21 from eclipse-temurin:21
# see https://hub.docker.com/_/eclipse-temurin
ENV JAVA_HOME=/opt/java/openjdk
COPY --from=JAVA $JAVA_HOME $JAVA_HOME

# install babashka
ENV BABASHKA_HOME=/opt/babashka
RUN curl -fsSL -o bb-install 'https://raw.githubusercontent.com/babashka/babashka/master/install'
RUN chmod +x bb-install
RUN ./bb-install --dir $BABASHKA_HOME --download-dir /tmp --static
RUN chown -R root:root $BABASHKA_HOME

# install clojure
ENV CLOJURE_HOME=/opt/clojure
RUN curl -L -O https://github.com/clojure/brew-install/releases/latest/download/posix-install.sh
RUN chmod +x posix-install.sh
RUN ./posix-install.sh --prefix $CLOJURE_HOME
RUN rm ./posix-install.sh

# add various tools to the path
ENV PATH="${JAVA_HOME}/bin:${CLOJURE_HOME}/bin:${BABASHKA_HOME}:${VIRTUAL_ENV}/bin:${PATH}"

RUN mkdir -p /app/project

# mount your local project here
WORKDIR /app/project

# expose https sse port
EXPOSE 8079

# expose nrepl port
EXPOSE 7889

# expose portal port
EXPOSE 3600

# clear package cache
RUN apt-get autoremove -y
RUN apt-get autoclean -y
RUN apt-get clean -y
RUN rm -rf /var/lib/apt/lists/*

CMD ["/app/ansible-mcp-server.sh"]

In your clojure project, make sure you have the :nrepl and :mcp-sse aliases (BEFORE YOU RUN THE CONTAINER):

deps.edn

{:paths   ["src" "resources"]
 :deps    {com.bhauman/clojure-mcp        {:git/url "https://github.com/bhauman/clojure-mcp.git"
                                           :git/sha "6733ca8fb2e373e316a743186f79e7ec81c39609"}}
 :aliases {:mcp-sse {:extra-deps {;; optional
                                  ;; org.slf4j/slf4j-nop {:mvn/version "2.0.16"}
                                  jakarta.servlet/jakarta.servlet-api {:mvn/version "6.1.0"}
                                  org.eclipse.jetty/jetty-server      {:mvn/version "11.0.20"}
                                  org.eclipse.jetty/jetty-servlet     {:mvn/version "11.0.20"}}
                     :exec-fn    clojure-mcp.sse-main/start-sse-mcp-server
                     :exec-args  {:port         7888 ;; the nrepl port to connect to
                                  ;; specify the :mcp-sse-port to listen on
                                  :mcp-sse-port 8078}}

           :nrepl   {:extra-paths ["test"]
                     :extra-deps  {nrepl/nrepl       {:mvn/version "1.3.1"}
                                   cider/cider-nrepl {:mvn/version "0.56.0"}}
                     :jvm-opts    ["-Djdk.attach.allowAttachSelf"]
                     :main-opts   ["-m" "nrepl.cmdline" "--port" "7888" "--bind" "0.0.0.0"
                                   "--middleware" "[cider.nrepl/cider-middleware]"]}}}

Build the container:

podman build -t clojure-mcp-server .

Run the container:

Replace /path/to/project with the path to your clojure project that you added the above dependencies to deps.edn.

If you want to use the agent tools (architect, dispatch_agent, code_critique) then specify an API key for one of the major 3 providers with the -e option.

You should probably use a git repo as the base of your project, clojure-mcp can and will edit files in this project at any time.

podman run -d --replace --name clojure-mcp \
    -p 7888:7888 -p 8078:8078 \
    -e OPENAI_API_KEY=sk-..... \
    -v /path/to/project:/app/project:rw,Z \
    localhost/clojure-mcp-server:latest

In Cherry Studio add a new MCP server with the following settings: