Clockwork is a Model Context Protocol (MCP) server that automatically tracks your work time based on git commits. It aggregates commits into worklog entries, calculates durations, and manages projects - all through a simple CLI interface.
- Automatic Commit Aggregation: Automatically collects commits since your last worklog entry
- Smart Duration Calculation: Estimates work time based on commit timestamps
- Project Management: Track multiple projects with associated git repositories
- Invoice Tracking: Mark entries as invoiced for billing purposes
- Embedded Database: Standalone bbolt database requiring no external services
- MCP Protocol: Integrates seamlessly with LLM applications like Claude
- Go 1.21 or higher
- Git installed and configured
git clone https://github.com/alex20465/clockwork-mcp.git
cd clockwork-mcp
go build -o clockwork ./cmd/clockworkgo install ./cmd/clockworkAdd to your MCP client configuration (e.g., Claude Desktop):
{
"mcpServers": {
"clockwork": {
"command": "/path/to/clockwork"
}
}
}The server will automatically create its database at ~/.local/clockwork/default.db.
// Using MCP tool
create_project({
name: "My Project",
git_repo_path: "/path/to/my/repo"
})// Automatically aggregates commits and calculates duration
create_entry({
project_id: "project-uuid",
message: "Optional custom message", // If omitted, generates from commits
invoiced: false
})This will:
- Find all commits since your last worklog entry
- Aggregate commit messages into a summary
- Calculate work duration based on commit timestamps
- Create an entry with the latest commit hash
list_projects()list_entries({
project_id: "project-uuid"
})update_entry({
id: "entry-uuid",
duration: 180, // Override calculated duration (minutes)
message: "Updated work description",
invoiced: true
})delete_project({ id: "project-uuid" }) // Deletes project and all entries
delete_entry({ id: "entry-uuid" }){
"id": "uuid",
"name": "Project Name",
"git_repo_path": "/absolute/path/to/repo",
"created_at": "2025-01-27T10:00:00Z",
"updated_at": "2025-01-27T10:00:00Z"
}{
"id": "uuid",
"project_id": "project-uuid",
"duration": 120,
"message": "Aggregated 3 commits:\n1. [abc123] Fix bug\n2. [def456] Add feature\n3. [ghi789] Update docs",
"commit_hash": "ghi789...",
"invoiced": false,
"created_at": "2025-01-27T10:00:00Z",
"updated_at": "2025-01-27T10:00:00Z"
}When you create an entry, Clockwork:
- Finds the baseline: Looks up the last entry's commit hash
- Retrieves commits: Gets all commits from that hash to HEAD
- Generates summary: Creates a formatted list of commit messages
- Calculates time: Estimates duration based on commit timestamps
- Stores reference: Saves the latest commit hash for next time
- Single commit: Default 30 minutes
- Multiple commits: Time between first and last commit + 30 minute buffer
Example: If you have commits at 9:00 AM and 11:30 AM, the calculated duration is 2.5 hours + 0.5 hours = 3 hours (180 minutes).
Clockwork uses bbolt, a pure Go embedded key-value database:
- Location:
~/.local/clockwork/default.db - Format: Single file, no external dependencies
- Buckets:
projectsandentries - Persistence: All data persists between runs
| Tool | Description | Required Parameters |
|---|---|---|
create_project |
Create a new project | name, git_repo_path |
update_project |
Update project details | id, [name], [git_repo_path] |
delete_project |
Delete project and entries | id |
list_projects |
List all projects | - |
create_entry |
Create worklog with auto-aggregation | project_id, [message], [invoiced] |
update_entry |
Update entry fields | id, [duration], [message], [commit_hash], [invoiced] |
delete_entry |
Delete an entry | id |
list_entries |
List project entries | project_id |
# All tests
go test ./...
# With coverage
go test -cover ./...
# Specific package
go test ./internal/db -vclockwork-mcp/
├── cmd/clockwork/ # Main entry point
├── internal/
│ ├── db/ # Database operations
│ ├── models/ # Data structures
│ ├── git/ # Git integration
│ └── server/ # MCP server implementation
├── docs/ # Documentation
├── go.mod
├── CLAUDE.md # Project context for Claude
└── README.md
This means there are no commits since your last logged entry. Make some commits first, then create a new entry.
Ensure git is configured:
git config user.name "Your Name"
git config user.email "your@email.com"Verify the project exists:
list_projects()Only one instance of Clockwork can run at a time. Close other instances or check for stale processes.
MIT
Contributions welcome! Please open an issue or pull request.
Made with ⚙️ by the Techthos team