mirror of
https://github.com/modelcontextprotocol/servers.git
synced 2026-02-19 11:54:58 -05:00
feat: configurable timezone for docker in time server
Fixes #639 Add support for configurable timezone in Docker for `time` server. * Update `src/time/Dockerfile` to include `LOCAL_TIMEZONE` environment variable. * Set default timezone to "UTC" in `src/time/Dockerfile`. * Modify `ENTRYPOINT` in `src/time/Dockerfile` to include `--local-timezone` argument. * Update `src/time/README.md` to include instructions on setting the timezone using `LOCAL_TIMEZONE` environment variable. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/modelcontextprotocol/servers/issues/639?shareId=XXXX-XXXX-XXXX-XXXX).
This commit is contained in:
@@ -32,5 +32,8 @@ COPY --from=uv --chown=app:app /app/.venv /app/.venv
|
||||
# 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 ["mcp-server-time"]
|
||||
# Set the LOCAL_TIMEZONE environment variable
|
||||
ENV LOCAL_TIMEZONE=${LOCAL_TIMEZONE:-"UTC"}
|
||||
|
||||
# when running the container, add --local-timezone and a bind mount to the host's db file
|
||||
ENTRYPOINT ["mcp-server-time", "--local-timezone", "${LOCAL_TIMEZONE}"]
|
||||
|
||||
@@ -61,7 +61,7 @@ Add to your Claude settings:
|
||||
"mcpServers": {
|
||||
"time": {
|
||||
"command": "docker",
|
||||
"args": ["run", "-i", "--rm", "mcp/time"]
|
||||
"args": ["run", "-i", "--rm", "-e", "LOCAL_TIMEZONE", "mcp/time"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
from .server import serve
|
||||
|
||||
|
||||
def main():
|
||||
"""MCP Time Server - Time and timezone conversion functionality for MCP"""
|
||||
import argparse
|
||||
import asyncio
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description="give a model the ability to handle time queries and timezone conversions"
|
||||
)
|
||||
parser.add_argument("--local-timezone", type=str, help="Override local timezone")
|
||||
|
||||
args = parser.parse_args()
|
||||
asyncio.run(serve(args.local_timezone))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user