MCP server for Kimai time-tracking API integration
Project description
Kimai MCP Server
A comprehensive Model Context Protocol (MCP) server for integrating with the Kimai time-tracking API. This server allows AI assistants like Claude to efficiently interact with Kimai instances to manage time tracking, projects, activities, customers, users, teams, absences, and more.
๐ Quick Start
# Install from PyPI
pip install kimai-mcp
# Run with your Kimai credentials
kimai-mcp --kimai-url=https://your-kimai.com --kimai-token=your-token
๐ ๏ธ Available Tools
Core Management Tools
- Entity Tool - Universal CRUD operations for projects, activities, customers, users, teams, tags, invoices, holidays
- Timesheet Tool - Complete timesheet management (list, create, update, delete, export)
- Timer Tool - Active timer operations (start, stop, restart, view active/recent)
- Rate Tool - Rate management across all entity types
- Team Access Tool - Team member and permission management
- Absence Tool - Complete absence workflow (create, approve, reject, list)
- Calendar Tool - Unified calendar data access
- Meta Tool - Custom field management across entities
- User Current Tool - Current user information
- Project Analysis Tool - Advanced project analytics
- Config Tool - Server configuration (timesheet settings, color codes, plugins, version info)
Complete Kimai Integration
- Timesheet Management - Create, update, delete, start/stop timers, view active timers
- Project & Activity Management - Browse and view projects and activities
- Customer Management - Browse and view customer information
- User Management - List, view, create, and update user accounts
- Team Management - Create teams, manage members, control access permissions
- Absence Management - Create, approve, reject, and track absences
- Tag Management - Create and manage tags for better organization
- Invoice Queries - View invoice information and status
Advanced Features
- Real-time Timer Control - Start, stop, and monitor active time tracking
- Comprehensive Filtering - Advanced filters for all data types
- Permission Management - Respect Kimai's role-based permissions
- Error Handling - Proper error handling with meaningful messages
- Flexible Configuration - Multiple configuration methods (CLI args, .env files, environment variables)
Installation
Prerequisites
- Python 3.10+
- A Kimai instance with API access enabled
- API token from your Kimai user profile
Install from PyPI (Recommended)
pip install kimai-mcp
Install from Source (Development)
# Clone the repository
git clone https://github.com/glazperle/kimai_mcp.git
cd kimai_mcp
# Install in development mode
pip install -e ".[dev]"
Configuration
Getting Your Kimai API Token
- Log into your Kimai instance
- Go to your user profile (click your username)
- Navigate to the "API" or "API Access" section
- Create a new API token or copy an existing one
- Note your Kimai instance URL (e.g.,
https://kimai.example.com)
Claude Desktop Integration
Step 1: Configure Claude Desktop
Add the Kimai MCP server to your Claude Desktop configuration file:
On macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
On Windows:
%APPDATA%\Claude\claude_desktop_config.json
Step 2: Add Configuration
Add the following to your Claude Desktop configuration:
{
"mcpServers": {
"kimai": {
"command": "python",
"args": [
"-m", "kimai_mcp.server",
"--kimai-url=https://your-kimai-instance.com",
"--kimai-token=your-api-token-here"
]
}
}
}
Important Notes:
- Replace
https://your-kimai-instance.comwith your actual Kimai URL - Replace
your-api-token-herewith your API token from Kimai - Optionally add
--kimai-user=USER_IDfor a default user ID
Step 3: Restart Claude Desktop
After saving the configuration file, restart Claude Desktop for the changes to take effect.
Alternative Configuration Methods
Method 1: Using a .env File (Recommended for Development)
If you prefer using a .env file for configuration, create a .env file in your project directory:
# .env file in the kimai_mcp directory
KIMAI_URL=https://your-kimai-instance.com
KIMAI_API_TOKEN=your-api-token-here
KIMAI_DEFAULT_USER=1
Then use this Claude Desktop configuration:
{
"mcpServers": {
"kimai": {
"command": "python",
"args": ["-m", "kimai_mcp.server"],
"cwd": "/path/to/your/kimai_mcp/directory"
}
}
}
Important Notes for .env Configuration:
- Replace
/path/to/your/kimai_mcp/directorywith the actual path to your kimai_mcp directory - The
cwdparameter ensures the .env file is found in the correct directory - Keep your .env file secure and never commit it to version control
- On Windows, use forward slashes in the path or escape backslashes
Example Windows Path:
{
"mcpServers": {
"kimai": {
"command": "python",
"args": ["-m", "kimai_mcp.server"],
"cwd": "C:/Users/YourName/Projects/kimai_mcp"
}
}
}
Method 2: Using Environment Variables (System-wide)
If you prefer system environment variables, you can set:
export KIMAI_URL="https://your-kimai-instance.com"
export KIMAI_API_TOKEN="your-api-token-here"
export KIMAI_DEFAULT_USER="1" # Optional
Then use this Claude Desktop configuration:
{
"mcpServers": {
"kimai": {
"command": "python",
"args": ["-m", "kimai_mcp.server"]
}
}
}
Usage Examples
Timesheet Management
List Timesheets
{
"tool": "timesheet",
"parameters": {
"action": "list",
"filters": {
"project": 17,
"user_scope": "self"
}
}
}
Create a Timesheet Entry
{
"tool": "timesheet",
"parameters": {
"action": "create",
"data": {
"project": 1,
"activity": 5,
"description": "Working on API integration",
"begin": "2024-08-03T09:00:00",
"end": "2024-08-03T10:30:00"
}
}
}
Start a Timer
{
"tool": "timer",
"parameters": {
"action": "start",
"data": {
"project": 1,
"activity": 5,
"description": "Working on API integration"
}
}
}
Stop a Timer
{
"tool": "timer",
"parameters": {
"action": "stop",
"id": 12345
}
}
Project & Activity Management
List Projects
{
"tool": "entity",
"parameters": {
"type": "project",
"action": "list",
"filters": {"customer": 1}
}
}
Get Project Details
{
"tool": "entity",
"parameters": {
"type": "project",
"action": "get",
"id": 17
}
}
List Activities
{
"tool": "entity",
"parameters": {
"type": "activity",
"action": "list",
"filters": {"project": 17}
}
}
User & Team Management
List Users
{
"tool": "entity",
"parameters": {
"type": "user",
"action": "list"
}
}
Create a Team
{
"tool": "entity",
"parameters": {
"type": "team",
"action": "create",
"data": {
"name": "Development Team",
"color": "#3498db"
}
}
}
Add Team Member
{
"tool": "team_access",
"parameters": {
"action": "add_member",
"team_id": 1,
"user_id": 5
}
}
Absence Management
Create an Absence
{
"tool": "absence",
"parameters": {
"action": "create",
"data": {
"comment": "Vacation in the mountains",
"date": "2024-02-15",
"end": "2024-02-20",
"type": "holiday"
}
}
}
List Absences
{
"tool": "absence",
"parameters": {
"action": "list",
"filters": {
"user": "5",
"status": "all"
}
}
}
Rate Management
List Customer Rates
{
"tool": "rate",
"parameters": {
"entity": "customer",
"action": "list",
"entity_id": 1
}
}
Current User Information
Get Current User
{
"tool": "user_current"
}
Troubleshooting
Common Issues
Connection Problems
- Verify Kimai URL: Ensure your Kimai URL is correct and accessible
- Check API Token: Verify your API token is valid and not expired
- API Access: Ensure your Kimai instance has API access enabled
- Network: Check if there are any firewall or network restrictions
Permission Errors
- Creating timesheets for other users requires admin permissions
- Managing users and teams requires appropriate role permissions
- Some absence operations require manager permissions
Configuration Issues
- Claude Desktop Config: Verify the JSON syntax is correct
- Path Issues: Ensure Python can find the
kimai_mcpmodule - Arguments: Check that command-line arguments are properly formatted
SSL Certificate Errors (Self-Hosted Instances)
If you're running a self-hosted Kimai instance with a custom CA certificate (e.g., self-signed certificates), you may encounter this error:
[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain
Solution 1: Use the --ssl-verify CLI option
# Point to your CA certificate file
python -m kimai_mcp.server --kimai-url=https://kimai.example.com --kimai-token=your-token --ssl-verify=/path/to/ca-bundle.crt
# Or disable verification (not recommended for production)
python -m kimai_mcp.server --kimai-url=https://kimai.example.com --kimai-token=your-token --ssl-verify=false
Solution 2: Use environment variables
# Using httpx's built-in SSL environment variables
SSL_CERT_DIR=/etc/ssl/certs python -m kimai_mcp.server --kimai-url=... --kimai-token=...
# Or using the KIMAI_SSL_VERIFY environment variable
KIMAI_SSL_VERIFY=/path/to/ca-bundle.crt python -m kimai_mcp.server --kimai-url=... --kimai-token=...
Claude Desktop configuration with custom certificates:
{
"mcpServers": {
"kimai": {
"command": "python",
"args": [
"-m", "kimai_mcp.server",
"--kimai-url=https://kimai.example.com",
"--kimai-token=your-token",
"--ssl-verify=/path/to/ca-bundle.crt"
]
}
}
}
Or using the environment variable:
{
"mcpServers": {
"kimai": {
"command": "python",
"args": ["-m", "kimai_mcp.server", "--kimai-url=...", "--kimai-token=..."],
"env": {
"KIMAI_SSL_VERIFY": "/path/to/ca-bundle.crt"
}
}
}
}
Debug Mode
For debugging, you can run the server directly:
# Using command line arguments
python -m kimai_mcp.server --kimai-url=https://your-kimai.com --kimai-token=your-token
# Using .env file (make sure you're in the directory with the .env file)
python -m kimai_mcp.server
# Test the package module execution
python -m kimai_mcp.server --help
Logging
The server includes comprehensive logging. Check the logs for detailed error information.
Security Considerations
- API Token Security: Keep your API token secure and never commit it to version control
- Network Security: Use HTTPS for your Kimai instance
- Permission Management: Use appropriate Kimai roles and permissions
- Regular Updates: Keep the MCP server and dependencies updated
Development
Project Structure
kimai_mcp/
โโโ src/
โ โโโ kimai_mcp/
โ โ โโโ __init__.py
โ โ โโโ server.py # MCP server implementation
โ โ โโโ client.py # Kimai API client
โ โ โโโ models.py # Data models
โ โ โโโ tools/ # MCP tool implementations
โ โ โโโ entity_manager.py
โ โ โโโ timesheet_consolidated.py
โ โ โโโ rate_manager.py
โ โ โโโ team_access_manager.py
โ โ โโโ absence_manager.py
โ โ โโโ calendar_meta.py
โ โ โโโ project_analysis.py
โ โ โโโ config_info.py
โโโ tests/
โโโ README.md
โโโ pyproject.toml
โโโ .gitignore
Running Tests
pytest tests/ -v
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
Licensing Information
- Kimai MCP Server: MIT License (this project)
- Kimai Core: AGPL-3.0 License (separate project)
- Model Context Protocol: Open standard by Anthropic
This MCP server is an independent integration tool that communicates with Kimai via its public API. It is not a derivative work of Kimai itself and can be freely used under the MIT license terms.
๐ค Contributing
We welcome contributions! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
Development Setup
- Clone the repository
- Install development dependencies:
pip install -e ".[dev]" - Run tests:
pytest tests/ -v - Follow the existing code style and add tests for new features
๐ Support
- Issues: Please use the GitHub issue tracker
- Documentation: Check the examples in the
examples/directory - Kimai Documentation: Visit kimai.org for Kimai-specific questions
๐ Acknowledgments
- Anthropic for creating the Model Context Protocol
- Kimai Team for the excellent time-tracking software and API
- MCP Community for examples and best practices
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kimai_mcp-2.3.7.tar.gz.
File metadata
- Download URL: kimai_mcp-2.3.7.tar.gz
- Upload date:
- Size: 50.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b7815675663e00bea97fd92a52f6d4e31391cc60902f5cb39d2b3a48c6666c2
|
|
| MD5 |
0626dd75b1be100bd32b8136bcce2464
|
|
| BLAKE2b-256 |
defef63134b013f43064b3e78c30d6fce424561e0a0db935c7dd9c7f0ab821df
|
Provenance
The following attestation bundles were made for kimai_mcp-2.3.7.tar.gz:
Publisher:
publish.yml on glazperle/kimai_mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kimai_mcp-2.3.7.tar.gz -
Subject digest:
0b7815675663e00bea97fd92a52f6d4e31391cc60902f5cb39d2b3a48c6666c2 - Sigstore transparency entry: 780790271
- Sigstore integration time:
-
Permalink:
glazperle/kimai_mcp@8062a94640a8b1b09834d6158bb412bafeb827fa -
Branch / Tag:
refs/tags/v2.3.7 - Owner: https://github.com/glazperle
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8062a94640a8b1b09834d6158bb412bafeb827fa -
Trigger Event:
release
-
Statement type:
File details
Details for the file kimai_mcp-2.3.7-py3-none-any.whl.
File metadata
- Download URL: kimai_mcp-2.3.7-py3-none-any.whl
- Upload date:
- Size: 50.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb593e40c399c21fdb8af3aedc141023750b7f96463851b1fc72d5ed8fb06926
|
|
| MD5 |
922df23e31a698c46059affb12769f09
|
|
| BLAKE2b-256 |
24d06c75251e3654488ba94bc5ba7562def1e86eb35effc6fd12c4d30a3e02ae
|
Provenance
The following attestation bundles were made for kimai_mcp-2.3.7-py3-none-any.whl:
Publisher:
publish.yml on glazperle/kimai_mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kimai_mcp-2.3.7-py3-none-any.whl -
Subject digest:
bb593e40c399c21fdb8af3aedc141023750b7f96463851b1fc72d5ed8fb06926 - Sigstore transparency entry: 780790273
- Sigstore integration time:
-
Permalink:
glazperle/kimai_mcp@8062a94640a8b1b09834d6158bb412bafeb827fa -
Branch / Tag:
refs/tags/v2.3.7 - Owner: https://github.com/glazperle
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8062a94640a8b1b09834d6158bb412bafeb827fa -
Trigger Event:
release
-
Statement type: