Skip to main content
Glama

kimai-timelog-mcp

tests

Ein MCP-Server, der es Claude (oder jedem MCP-fähigen LLM-Client) ermöglicht, deine Kimai-Zeitnachweise zu lesen und zu schreiben. Du sagst „Erfasse 9 bis 12:30 Uhr für den Portal-Umbau, inklusive Korrektur der Login-Weiterleitung“ und der Eintrag erscheint in Kimai.

Jede Anfrage wird in deinem Namen ausgeführt – sie verwendet dein persönliches Kimai-API-Token und kann daher nur das sehen und ändern, was dein Kimai-Konto darf.


1. Kimai-API-Token besorgen

  1. Öffne Kimai → klicke auf deinen Namen (oben rechts) → Mein Profil → Reiter API-Zugriff.

  2. Erstelle ein Token, gib ihm einen Namen wie claude, und kopiere es sofort – Kimai zeigt es nur genau einmal an.

Related MCP server: Kimai MCP Server

2. Installation

Du benötigst uv (empfohlen) oder Python 3.10+.

# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows (PowerShell)
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

Danach entweder:

A. Aus einem gemeinsamen Ordner / Git-Repo (so machen es Kolleginnen und Kollegen)

uvx --from git+https://github.com/Alpha101Code/kimai-timelog-mcp kimai-mcp --check

B. Aus einer lokalen Kopie

cd /path/to/kimai-timelog-mcp
uv run kimai-mcp --check

--check überprüft die URL und das Token und gibt deine sichtbaren Projekte aus. Setze zuerst die beiden Umgebungsvariablen:

export KIMAI_URL=https://timesheet-sd.maccs.mu
export KIMAI_API_TOKEN=your-token-here

3. In deinen Client einbinden

Claude Desktop

Einstellungen → Entwickler → Konfiguration bearbeiten, dann hinzufügen:

{
  "mcpServers": {
    "kimai": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/Alpha101Code/kimai-timelog-mcp", "kimai-mcp"],
      "env": {
        "KIMAI_URL": "https://timesheet-sd.maccs.mu",
        "KIMAI_API_TOKEN": "your-token-here"
      }
    }
  }
}

Starte Claude Desktop neu. Unter Windows verwende uvx.exe, falls uvx nicht im PATH gefunden wird.

Claude Code

claude mcp add kimai \
  --env KIMAI_URL=https://timesheet-sd.maccs.mu \
  --env KIMAI_API_TOKEN=your-token-here \
  -- uvx --from git+https://github.com/Alpha101Code/kimai-timelog-mcp kimai-mcp

Cursor / Windsurf / Cline / Zed

Gleiche JSON-Struktur wie bei Claude Desktop, in der MCP-Konfigurationsdatei des jeweiligen Clients (~/.cursor/mcp.json bei Cursor).

Alles andere

Es ist ein standardmäßiger stdio-MCP-Server. Befehl: kimai-mcp. Konfiguration: die beiden oben genannten Umgebungsvariablen.


Werkzeuge

Tool

Was es tut

whoami

Wem das Token gehört, dessen Zeitzone, heutiges Datum

list_projects

Projekte, auf die du buchen kannst, nach Name durchsuchbar

list_activities

Aktivitäten, die für ein Projekt gültig sind (projektspezifisch + global)

list_customers

Kunden, die du sehen kannst

list_tags

In Kimai konfigurierte Tag-Namen

list_timesheets

Deine Einträge für einen Zeitraum, mit Summen

recent_entries

Deine zuletzt verwendeten Projekt-/Aktivitäts-/Beschreibungs-Kombinationen

summarize_time

Stunden summiert nach Projekt, Aktivität oder Tag

log_time

Einen abgeschlossenen Eintrag schreiben

start_timer

Einen laufenden Eintrag starten

active_timers

Was aktuell läuft

stop_timer

Den laufenden Eintrag stoppen

restart_timer

Einen alten Eintrag als neuen laufenden Eintrag klonen

update_timesheet

Einen vorhandenen Eintrag ändern

delete_timesheet

Einen Eintrag löschen (erfordert eine explizite Bestätigung)

Wissenswerte Design-Entscheidungen

  • Namen, keine IDs. project: "Portal Revamp" funktioniert; ebenso ein eindeutiger Teilstring wie "portal". Bei mehrdeutigen Namen kommt ein Fehler zurück, der die Kandidaten auflistet; das Modell kann sie dir dann als Frage stellen.

  • Flexible Zeiteingabe. date: today, yesterday, monday, 3 days ago, 2026-08-24, 25/08/2026. start/end: 09:00, 9am, 5.30pm, 0930. duration: 1h30m, 90m, 1.5h, 1:30.

  • Deine Zeitzone. Kimai meldet die Zeitzone des Token-Inhabers; alles wird danach aufgelöst, nicht nach der Server-Uhr.

  • Keine erfundenen Stunden. log_time benötigt start+end, start+duration oder duration – wenn nichts davon angegeben ist, gibt es einen Fehler zurück, der das Modell auffordert, dich zu fragen, statt zu raten.

  • Löschen erfolgt in zwei Schritten. Der erste Aufruf gibt zurück, was gelöscht würde; erst ein zweiter Aufruf mit confirm: true entfernt es.

Beispiel-Prompts

Log 9:00–12:30 today on Portal Revamp, development, "fixed the login redirect".
What did I log this week? Break it down by project.
Same as yesterday afternoon, but for today.
Start a timer on Internal Tools / Admin.
I forgot Monday — 4 hours on Mobile App, release testing.
Move entry 512 to start at 10:15 instead.

Ausrollen bei Kolleginnen und Kollegen

Alle benötigen drei Dinge: uv installiert, ein eigenes Kimai-Token und den obigen Konfigurationsblock. Zwischen den Nutzern wird nichts geteilt – kein Server, den man betreiben muss, kein zentrales Token.

Falls du später einen einzelnen gehosteten Server anstelle einer Installation pro Maschine möchtest, bleibt die Tool-Ebene unverändert; nur der Transport in __main__.py ändert sich.

Sicherheit

  • Das Token ist wie ein Passwort zu behandeln. Es liegt in der Konfigurationsdatei deines Clients auf deinem eigenen Rechner – committe es nicht und füge es nicht in ein gemeinsames Dokument ein.

  • Versehe Tokens in Kimai mit einem Ablaufdatum und rotiere sie.

  • Der Server kommuniziert nur mit KIMAI_URL. Er hat keinen weiteren Netzwerkzugriff, keinen Dateisystemzugriff und keine Shell.

  • Wenn dein Kimai nur intern erreichbar ist, muss dies auf einem Rechner laufen, der es erreichen kann (VPN oder Büronetzwerk).

Entwicklung

src/kimai_mcp/
  client.py     Kimai REST client — auth, errors, name→id resolution, caching
  timeutil.py   parsing for human dates, times and durations
  server.py     the MCP tools
  __main__.py   stdio entrypoint + --check
tests/
  mock_kimai.py a stand-in Kimai instance
  test_e2e.py   drives the real server over stdio against it

Führe die Testsuite aus (keine Kimai-Instanz erforderlich):

uv run --with mcp --with httpx python tests/test_e2e.py

Kompatibilität

Funktioniert mit beiden Hauptversionen des Python-MCP-SDK: mcp 1.x (FastMCP) und 2.x (MCPServer). Der Server wählt beim Import die richtige Version aus, und vorhersehbare Fehler sind Unterklassen des ToolError des SDK, sodass die Meldung das Modell erreicht, statt einer generischen „Fehler beim Ausführen des Tools“. Die Testsuite wird in CI gegen beide ausgeführt.

Die Distribution heißt kimai-timelog-mcp (passend zum Repo); der Befehl, den sie installiert, ist kimai-mcp.

Entwickelt gegen die Kimai-2-REST-API (/api, Authorization: Bearer <token>). Endpunkt-Referenz: https://www.kimai.org/documentation/rest-api.html und /api/doc deiner eigenen Instanz.

Available Tools

15 tools
active_timersB

Any currently running time entries for this user.

Inputs: no named parameters. Returns: result

delete_timesheetA

Permanently delete a time entry.

Args: timesheet_id: the entry to delete. confirm: must be true. Show the user what will be deleted first.

Inputs: timesheet_id (required), confirm. Returns: object

list_activitiesA

List activities, optionally the ones valid for a given project.

Args: project: project name or id. Omit to list every activity. search: optional substring filter on the activity name.

Inputs: search, project. Returns: result

list_customersA

List customers visible to this user.

Inputs: no named parameters. Returns: result

list_projectsA

List the projects this user can book time against.

Args: search: optional substring to filter project or customer names. customer: optional customer name or id to scope the list.

Inputs: search, customer. Returns: result

list_tagsA

Tag names configured in this Kimai instance.

Inputs: no named parameters. Returns: result

list_timesheetsA

The user's own time entries for a date range, newest first.

Defaults to the last 7 days. Use this before writing an entry to avoid duplicates, and to answer "what did I log this week".

Args: from_date: 'today', 'monday', '2026-08-24', '3 days ago'. to_date: same formats; defaults to today. project: optional project name or id to filter by. search: optional free-text search over descriptions. limit: maximum entries to return (max 500).

Inputs: limit, search, project, to_date, +1 more. Returns: object

log_timeA

Write a finished time entry to Kimai.

Give either start+end, or start+duration, or duration alone (which books the period ending now). Do not guess missing times — ask the user instead.

Args: project: project name or id. activity: activity name or id, must be valid for the project. description: what was worked on. Strongly recommended. date: 'today', 'yesterday', 'monday', '2026-08-24'. start: '09:00', '9am', '14.30'. end: same formats as start. duration: '1h30m', '90m', '1.5h', '1:30'. tags: optional list of Kimai tag names. billable: optional override of the project default.

Inputs: project (required), activity (required), end, date, +5 more. Returns: object

recent_entriesA

The project/activity/description combinations this user booked most recently.

Best first call for "log the usual" or "same as yesterday" requests.

Inputs: limit. Returns: result

restart_timerA

Start a new running entry that copies an existing one's project/activity.

Inputs: timesheet_id (required). Returns: object

start_timerB

Start a running timer now (or at a given start time today).

Args: project: project name or id. activity: activity name or id. description: what is being worked on. start: optional start time such as '09:00'; defaults to now.

Inputs: project (required), activity (required), start, description. Returns: object

stop_timerA

Stop a running timer.

Args: timesheet_id: which entry to stop. Omit to stop the only running one.

Inputs: timesheet_id. Returns: object

summarize_timeA

Total the user's logged hours over a range, grouped for reporting.

Args: from_date: defaults to 7 days ago. to_date: defaults to today. group_by: 'project', 'activity' or 'day'.

Inputs: to_date, group_by, from_date. Returns: object

update_timesheetA

Change an existing time entry. Only the fields you pass are touched.

Args: timesheet_id: the entry to change (from list_timesheets). date/start/end/duration: same formats as log_time. Passing any of these recomputes the entry's begin and end.

Inputs: timesheet_id (required), end, date, tags, +6 more. Returns: object

whoamiA

Who the Kimai API token belongs to, plus their timezone and today's date.

Call this once at the start of a time-logging conversation so that relative dates ("yesterday") and times are anchored correctly.

Inputs: no named parameters. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 15 tools

    Disambiguation5/5

    Each tool targets a distinct operation: reference data listing, timesheet queries, entry creation, timer control, editing, deletion, and reporting. Even similar tools like list_timesheets and recent_entries are clearly differentiated by what they return.

    Naming Consistency4/5

    The set mostly follows a clear list_ for read-only collections and verb_noun for actions, such as log_time and stop_timer. Minor deviations like active_timers, recent_entries, and whoami break the pattern slightly but remain understandable.

    Tool Count5/5

    At 15 tools, the server covers discovery, logging, timer lifecycle, modifications, deletion, and reporting without feeling bloated. Each tool contributes a meaningful piece of the time-logging workflow.

    Completeness5/5

    The toolset supports a full time-logging lifecycle: lookup reference data, check existing entries, log time, start and stop timers, restart entries, update or delete entries, and summarize hours. It also includes helpful context tools like whoami and recent_entries; admin CRUD for projects or customers is outside the apparent purpose.

    Related MCP Connectors

    Related MCP Servers