This project exposes the Handl API as MCP tools using Python and FastMCP.
server.pyStarts the MCP server.handl_mcp/server.pyCreates the sharedFastMCPapp object.handl_mcp/client.pyHandles HTTP requests to the Handl API.handl_mcp/tools/One file per MCP tool.handl_mcp/formatters.pyTurns API responses into readable text.handl_mcp/models.pyShared input types used by multiple tools.
Most tool files follow the same pattern:
- Import the shared
mcpobject. - Add
@mcp.tool(...)above a function. - Accept normal Python arguments.
- Call the Handl API through
get_client(). - Return a string.
Example:
@mcp.tool(name="handl_get_ticket")
def handl_get_ticket(id: str) -> str:
data = get_client().get(f"/api/tickets/{id}")
return format_ticket_details(data["ticket"])Install dependencies:
pip install -e .Run the server locally:
python server.pyThe server will listen on:
http://localhost:8000/mcp
Build the image:
docker build -t handl-mcp .Run the container:
docker run --rm -p 8000:8000 \
-e HANDL_API_BASE_URL=https://handl.veridox.nl \
-e HANDL_API_TOKEN=your_token_here \
handl-mcpThe container serves Streamable HTTP on:
http://localhost:8000/mcp
Or run it with Docker Compose:
docker compose up --buildPut HTTPS and your public hostname on the proxy in front of the container.
Forward requests to the container on port 8000 and keep the /mcp path intact.
Because the server runs with stateless_http=True, it is a better fit for running behind a proxy or load balancer.
This repo includes a GitHub Actions workflow at .github/workflows/docker-image.yml.
When you push to main, it builds the Docker image and pushes it to:
ghcr.io/<owner>/<repo>
Example pull command:
docker pull ghcr.io/your-org/handl-mcp:latestOn your Docker host, create a stack folder:
mkdir -p /opt/stacks/handl-mcp
cd /opt/stacks/handl-mcpCopy compose.stack.yml into that folder, rename it to docker-compose.yml, and update:
image: ghcr.io/YOUR_GITHUB_OWNER/YOUR_REPO_NAME:latest
HANDL_API_BASE_URL: https://handl.veridox.nl
HANDL_API_TOKEN: your_token_hereThen start the stack:
docker compose pull
docker compose up -dFor future updates:
docker compose pull
docker compose up -dserver.pyhandl_mcp/server.pyhandl_mcp/client.pyhandl_mcp/tools/get_ticket.pyhandl_mcp/tools/create_ticket.py