-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
Dockerized It #21
Conversation
|
||
set -e # Exit immediately if a command exits with a non-zero status | ||
|
||
DIR="/servers" |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(optional)
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. 😃 |
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 . |
There was a problem hiding this comment.
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.
Closing in favour of 45c474e |
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.