From 6a6f05a6a9387e868663b2d934c3e26a7497c610 Mon Sep 17 00:00:00 2001 From: Adam Fourney Date: Tue, 25 Mar 2025 08:04:30 -0700 Subject: [PATCH] Added a Dockerfile, and updated the README accordingly. Also added instructions for Claude Desktop --- packages/markitdown-mcp/Dockerfile | 32 ++++++++++++++++ packages/markitdown-mcp/README.md | 61 +++++++++++++++++++++++++++++- 2 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 packages/markitdown-mcp/Dockerfile diff --git a/packages/markitdown-mcp/Dockerfile b/packages/markitdown-mcp/Dockerfile new file mode 100644 index 0000000..03b7f14 --- /dev/null +++ b/packages/markitdown-mcp/Dockerfile @@ -0,0 +1,32 @@ +FROM python:3.13-slim-bullseye + +ENV DEBIAN_FRONTEND=noninteractive +ENV EXIFTOOL_PATH=/usr/bin/exiftool +ENV FFMPEG_PATH=/usr/bin/ffmpeg + +# Runtime dependency +RUN apt-get update && apt-get install -y --no-install-recommends \ + ffmpeg \ + exiftool + +ARG INSTALL_GIT=false +RUN if [ "$INSTALL_GIT" = "true" ]; then \ + apt-get install -y --no-install-recommends \ + git; \ + fi + +# Cleanup +RUN rm -rf /var/lib/apt/lists/* + +COPY . /app +RUN pip --no-cache-dir install /app + +WORKDIR /workdir + +# Default USERID and GROUPID +ARG USERID=nobody +ARG GROUPID=nogroup + +USER $USERID:$GROUPID + +ENTRYPOINT [ "markitdown-mcp" ] diff --git a/packages/markitdown-mcp/README.md b/packages/markitdown-mcp/README.md index a09c800..8fe18c7 100644 --- a/packages/markitdown-mcp/README.md +++ b/packages/markitdown-mcp/README.md @@ -31,9 +31,68 @@ To run the MCP server, ussing SSE use the following command: markitdown-mcp --sse --host 127.0.0.1 --port 3001 ``` +## Running in Docker + +To run `markitdown-mcp` in Docker, build the Docker image using the provided Dockerfile: +```bash +docker build -t markitdown-mcp:latest . +``` + +And run it using: +```bash +docker run -it --rm markitdown-mcp:latest +``` +This will be sufficient for remote URIs. To access local files, you need to mount the local directory into the container. For example, if you want to access files in `/home/user/data`, you can run: + +```bash +docker run -it --rm -v /home/user/data:/workdir markitdown-mcp:latest +``` + +Once mounted, all files under data will be accessible under `/workdir` in the container. For example, if you have a file `example.txt` in `/home/user/data`, it will be accessible in the container at `/workdir/example.txt`. + ## Accessing from Claude Desktop -TODO +It is recommended to use the Docker image when running the MCP server for Claude Desktop. + +Follow [these instrutions](https://modelcontextprotocol.io/quickstart/user#for-claude-desktop-users) to access Claude's `claude_desktop_config.json` file. + +Edit it to include the following JSON entry: + +```json +{ + "mcpServers": { + "markitdown": { + "command": "docker", + "args": [ + "run", + "--rm", + "-i", + "markitdown-mcp:latest" + ] + } + } +} +``` + +If you want to mount a directory, adjust it accordingly: + +```json +{ + "mcpServers": { + "markitdown": { + "command": "docker", + "args": [ + "run", + "--rm", + "-i", + "-v", + "/home/user/data:/workdir", + "markitdown-mcp:latest" + ] + } + } +} +``` ## Debugging