mirror of
https://github.com/modelcontextprotocol/servers.git
synced 2026-04-20 12:55:21 +02:00
Add Dockerfiles for the 17 sample MCP servers
* add Dockerfiles and update README.md definitions
This commit is contained in:
29
src/time/Dockerfile
Normal file
29
src/time/Dockerfile
Normal file
@@ -0,0 +1,29 @@
|
||||
# Use a Python image with uv pre-installed
|
||||
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
|
||||
|
||||
# Install the project into `/app`
|
||||
WORKDIR /app
|
||||
|
||||
# Enable bytecode compilation
|
||||
ENV UV_COMPILE_BYTECODE=1
|
||||
|
||||
# Copy from the cache instead of linking since it's a mounted volume
|
||||
ENV UV_LINK_MODE=copy
|
||||
|
||||
# Install the project's dependencies using the lockfile and settings
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
--mount=type=bind,source=uv.lock,target=uv.lock \
|
||||
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
|
||||
uv sync --frozen --no-install-project --no-dev
|
||||
|
||||
# Then, add the rest of the project source code and install it
|
||||
# Installing separately from its dependencies allows optimal layer caching
|
||||
ADD . /app
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
uv sync --frozen --no-dev
|
||||
|
||||
# Place executables in the environment at the front of the path
|
||||
ENV PATH="/app/.venv/bin:$PATH"
|
||||
|
||||
# when running the container, add --db-path and a bind mount to the host's db file
|
||||
ENTRYPOINT ["uv" , "run" , "--directory", ".", "mcp-server-time"]
|
||||
@@ -54,6 +54,19 @@ Add to your Claude settings:
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Using docker</summary>
|
||||
|
||||
```json
|
||||
"mcpServers": {
|
||||
"time": {
|
||||
"command": "docker",
|
||||
"args": ["run", "-i", "--rm", "ai/mcp-time"]
|
||||
}
|
||||
}
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Using pip installation</summary>
|
||||
|
||||
@@ -179,6 +192,15 @@ npx @modelcontextprotocol/inspector uv run mcp-server-time
|
||||
3. "When it's 4 PM in New York, what time is it in London?"
|
||||
4. "Convert 9:30 AM Tokyo time to New York time"
|
||||
|
||||
## Build
|
||||
|
||||
Docker build:
|
||||
|
||||
```bash
|
||||
cd src/time
|
||||
docker build -t ai/mcp-time .
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
We encourage contributions to help expand and improve mcp-server-time. Whether you want to add new time-related tools, enhance existing functionality, or improve documentation, your input is valuable.
|
||||
|
||||
Reference in New Issue
Block a user