Skip to content

Commit 129b0e4

Browse files
glazperleclaude
andcommitted
feat: Add Streamable HTTP server for Claude.ai Connectors
Add new Streamable HTTP transport server compatible with Claude.ai Connectors: - Add streamable_http_server.py with multi-user support - Add user_config.py for JSON-based user configuration - Add config/users.example.json as configuration template - Add kimai-mcp-streamable entrypoint - Update Dockerfile to use new server by default - Update docker-compose.yml for user config volume mount This enables the MCP server to work as a remote connector in Claude.ai, allowing access from web and mobile clients. Each user gets their own endpoint (/mcp/{user_slug}) with server-side Kimai credentials. 🤖 Generated with [Claude Code](https://claude.ai/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 57c76b5 commit 129b0e4

File tree

7 files changed

+661
-12
lines changed

7 files changed

+661
-12
lines changed

Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/pytho
2828
COPY --from=builder /usr/local/bin /usr/local/bin
2929
COPY --from=builder /app /app
3030

31+
# Create config directory
32+
RUN mkdir -p /app/config
33+
3134
# Create non-root user
3235
RUN useradd -m -u 1000 -s /bin/bash kimai && \
3336
chown -R kimai:kimai /app
@@ -42,5 +45,6 @@ EXPOSE 8000
4245
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
4346
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"
4447

45-
# Run the server
46-
CMD ["kimai-mcp-server"]
48+
# Default: Run the new Streamable HTTP server (for Claude.ai Connectors)
49+
# Use kimai-mcp-server for the legacy SSE server
50+
CMD ["kimai-mcp-streamable"]

config/users.example.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"max": {
3+
"kimai_url": "https://kimai.example.com",
4+
"kimai_token": "your-api-token-for-max",
5+
"kimai_user_id": "1",
6+
"ssl_verify": true
7+
},
8+
"anna": {
9+
"kimai_url": "https://kimai.example.com",
10+
"kimai_token": "your-api-token-for-anna",
11+
"kimai_user_id": "2",
12+
"ssl_verify": true
13+
}
14+
}

docker-compose.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@ services:
1010

1111
# Environment variables
1212
environment:
13-
# MCP Server authentication (optional - auto-generated if not set)
14-
- MCP_SERVER_TOKEN=${MCP_SERVER_TOKEN:-}
15-
16-
# Optional: Default Kimai URL (clients can override)
17-
- DEFAULT_KIMAI_URL=${DEFAULT_KIMAI_URL:-}
13+
# Path to users config file (inside container)
14+
- USERS_CONFIG_FILE=/app/config/users.json
1815

1916
# SSL verification for Kimai connections
2017
- KIMAI_SSL_VERIFY=${KIMAI_SSL_VERIFY:-true}
@@ -23,9 +20,11 @@ services:
2320
ports:
2421
- "${SERVER_PORT:-8000}:8000"
2522

26-
# Optional: Mount CA certificates for custom SSL
27-
# volumes:
28-
# - ./certs/ca-bundle.crt:/app/certs/ca-bundle.crt:ro
23+
# Mount the users config file
24+
volumes:
25+
- ./config/users.json:/app/config/users.json:ro
26+
# Optional: Mount CA certificates for custom SSL
27+
# - ./certs/ca-bundle.crt:/app/certs/ca-bundle.crt:ro
2928

3029
# Health check
3130
healthcheck:

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "kimai-mcp"
7-
version = "2.7.1"
7+
version = "2.8.0"
88
description = "MCP server for Kimai time-tracking API integration"
99
readme = "README.md"
1010
requires-python = ">=3.10"
@@ -54,6 +54,7 @@ Repository = "https://github.com/glazperle/kimai_mcp"
5454
[project.scripts]
5555
kimai-mcp = "kimai_mcp.server:entrypoint"
5656
kimai-mcp-server = "kimai_mcp.sse_server:main"
57+
kimai-mcp-streamable = "kimai_mcp.streamable_http_server:main"
5758

5859
[tool.hatch.build.targets.wheel]
5960
packages = ["src/kimai_mcp"]

src/kimai_mcp/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from pathlib import Path
1212
from typing import Any, Dict, List, Optional, Union
1313

14-
__version__ = "2.7.1"
14+
__version__ = "2.8.0"
1515

1616
# Load environment variables from .env file if it exists
1717
try:

0 commit comments

Comments
 (0)