openwebui - bhauman/clojure-mcp GitHub Wiki

openwebui

Create a directory:

mkdir clojure-mcp-container
cd clojure-mcp-container

Create a file: Containerfile

FROM python:3.11-slim 

WORKDIR /app

COPY clojure-mcp-server.sh .
COPY mcpo-config.json .

RUN chmod 0750 clojure-mcp-server.sh
RUN chmod 0644 mcpo-config.json

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

RUN apt-get install -y --no-install-recommends \
    ca-certificates curl  git gnupg gzip jq \
    iproute2 vim-tiny  strace  ncat nmap less \
    openjdk-17-jdk-headless ssh rlwrap tar

# install mcpo and uv
RUN pip install mcpo uv

# 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

# install latest npm
#RUN npm install npm -g

# 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

RUN rm -rf /var/lib/apt/lists/*

# install 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 /app/clojure
RUN rm ./posix-install.sh

# add clojure to the path
RUN echo "export PATH=${PATH}:/app/clojure/bin" >> /root/.bashrc

RUN mkdir /app/project

WORKDIR /app/project

# mount your project to /app/project

# expose mcpo port
EXPOSE 8000
# expose nrepl port
EXPOSE 7888

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

Create a file: clojure-mcp-server.sh

#!/usr/bin/env bash

# add clojure to the path
PATH="${PATH}:/app/clojure/bin"

cd /app/project

clojure -M:nrepl 1>> /app/nrepl.out 2>> /app/nrepl.err &

sleep 10

uvx mcpo --host 0.0.0.0 --port 8000 --config /app/mcpo-config.json 1>> /app/mcpo.out 2>> /app/mcpo.err

Create a file: mcpo-config.json

{
  "mcpServers": {
    "clojure-mcp": {
      "command": "/app/clojure/bin/clojure",
      "args": ["-X:mcp"]
    }
  }
}

Run the podman build (works for docker too):

podman build -t clojure-mcp .

In your local project directory make sure you have the :nrepl and :mcp aliases setup in deps.edn (BEFORE YOU RUN THE CONTAINER):

{:paths   ["src"]
 :deps    {com.bhauman/clojure-mcp        {:git/url "https://github.com/bhauman/clojure-mcp.git"
                                           :git/sha "83627e7095f0ebab3d5503a5b2ee94aa6953cb0d"}
           ch.qos.logback/logback-classic {:mvn/version "1.4.14"}}

 :aliases {:mcp   {:exec-fn    clojure-mcp.main/start-mcp-server
                   :exec-args  {:port 7888}}

           :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]"]}}}

podman run (also works for docker):

Change the /local/path/to/project here to the correct path to your local clojure project. If you want agent support set an API key here in the environment (-e). This project should be a git repo, clojure-mcp can and will edit files in the project at any time.

podman run -d -p 8000:8000 \
    --name clojure-mcp \
    -e OPENAI_API_KEY=sk-..... \
    -v /local/path/to/project:/app/project:rw,Z \
    clojure-mcp

Once the mcpo clojure-mcp container is running you can point openwebui tools at:

http://localhost:8000/clojure-mcp/openapi.json

Or load the mcpo api docs in your browser:

http://localhost:8000/clojure-mcp/docs