Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerized It #21

Closed
wants to merge 4 commits into from
Closed

Dockerized It #21

wants to merge 4 commits into from

Conversation

christag
Copy link
Contributor

@christag christag commented Apr 2, 2025

Re-did the dockerization using the uv build of python bookworm slim, then added npx and curl which fixed all the issues I was having of using hosted tools.
Entrypoint.sh still automatically installs python tools added to /servers dir but no longer requires offline servers in order to run.
Also added environment variables for uvicorn port and log level.


set -e # Exit immediately if a command exits with a non-zero status

DIR="/servers"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should leave this as an optional env var and set the default as an empty string

echo "$DIR is empty"
fi

if ! [ -f "/app/config.json" ]; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should raise an exception instead of using example.config.json

- "8080:8000"
volumes:
- ./app:/app
- ./servers:/servers
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mark as optional

@@ -48,6 +49,30 @@ uvx mcpo --port 8000 -- uvx mcp-server-time --local-timezone=America/New_York

That’s it. Your MCP tool is now available at http://localhost:8000 with a generated OpenAPI schema — test it live at [http://localhost:8000/docs](http://localhost:8000/docs).

## 🐋 Docker

mcpo can be run in Docker with the enclosed dockerfile. Mount a volume containing config.json to /app and add custom (offline/source) servers to /servers.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(optional)

@tjbck tjbck changed the base branch from main to dev April 2, 2025 23:47
@dtinth
Copy link

dtinth commented Apr 3, 2025

Just in case it is useful, I made an unofficial Docker image distribution here:

https://github.com/dtinth/mcpo-docker/blob/main/Dockerfile

It's very unoptimized but it has:

Feel free to yoink code from it. 😃

@gaby
Copy link

gaby commented Apr 3, 2025

Would be useful to have a GitHub workflow to publish the image too. But this is a great start

COPY . /app

# Install mcpo from source
RUN pip install .

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to run this after apt-get since apt-get would be cached all the time, and only the next layers will be re-built.

@tjbck
Copy link
Collaborator

tjbck commented Apr 7, 2025

Closing in favour of 45c474e

@tjbck tjbck closed this Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants