Timebook CLI + MCP server is Timebook's command-line client and MCP server, used to track time from the terminal, manage timers, and expose the Timebook account to AI agents (Claude, Codex, Cursor, etc.) via the Model Context Protocol.
Purpose The tool is aimed at users who need to manage Timebook time records in the terminal or in AI agents, and can be used for time tracking, managing clients and projects, starting and stopping timers, and logging, updating, and deleting time entries.
Main capabilities
- Command-line client: time tracking-related operations can be completed in the terminal.
- MCP server: when the same binary is invoked as timebook mcp, it provides MCP service over stdio and can be connected to any MCP-compatible host (Claude Code, Claude Desktop, Codex, Cursor, etc.).
- Remote MCP: Timebook also runs as a hosted Streamable-HTTP MCP server at https://usetimebook.com/mcp,支持完整的 OAuth 2.0 (dynamic client registration + PKCE + refresh token rotation), with no need to install the CLI.
- Tools exposed to models: including get_active_timer, list_entries, update_entry, delete_entry, list_projects, start_timer, log_time, stop_timer, etc. (used to view the current timer, list entries, modify entries, delete entries, list projects, start timers, log time, and stop timers).
Usage Command line: requires Node.js 18.17+. Running timebook login opens the browser, logs in to Timebook (or uses an existing session) and selects scopes (which clients/projects the token can access). The browser passes the token back to a short-lived local loopback HTTP listener, and the CLI then writes the config file with 0600 permissions. Token storage locations: macOS is ~/Library/Preferences/timebook/config.json, Linux is ~/.config/timebook/config.json, Windows is %APPDATA%\timebook\Config\config.json. After login, the token does not leave the local machine; it can be revoked at https://usetimebook.com/settings/api-tokens . Duration format support: 1h, 45m, 1h30m, 1.5h, 1:30, or a plain number (interpreted as minutes, e.g. 90 → 1h 30m). Edit/delete authorization: An API token can only modify entries it created itself; JWT sessions (Web UI) and admin tokens are not subject to this rule; invoiced entries are locked for everyone via the API. When denied, it returns 403 with a friendly message, which can be fixed in the Web UI or by using the token that created the entry. MCP server: Use timebook mcp to invoke the same binary to provide MCP service over stdio, and it can be placed in any MCP-compatible host. The MCP server reuses the token saved by timebook login; before starting the agent, run timebook login once in the terminal. Remote MCP (Claude.ai web version): no CLI installation required; Claude.ai can discover it via the standard well-known endpoint: authorization server metadata https://usetimebook.com/.well-known/oauth-authorization-server,资源元数据 https://usetimebook.com/.well-known/oauth-protected-resource/mcp。从 Claude.ai → Settings → Connectors → Add → paste https://usetimebook.com/mcp connection, will redirect to the Timebook consent page once. The HTTP endpoint also accepts Authorization: Bearer tbk_* (existing API tokens), suitable for clients that prefer token pasting over OAuth, including server-to-server use.
Use cases Suitable for users who need to quickly log and adjust time entries in the terminal, and also for scenarios where you want an AI agent to directly operate Timebook time tracking via natural language. After connecting the MCP server, you can prompt the model in natural language, for example, to start a project timer, query the time logged for a project last week, log an entry with a specified time and rate, view the current work, stop the timer, correct or delete entries, etc. The model will choose the appropriate tool and, when necessary, first call list_projects to disambiguate.
Limitations and security
- The Timebook CLI runs locally and communicates only with your own Timebook account.
- Authentication: timebook login generates a personal API token through Timebook's OAuth-style consent screen; the token is stored locally with 0600 permissions and is not transmitted anywhere except to https://usetimebook.com(或自定义覆盖地址)的出站 API calls.
- Telemetry: neither the CLI nor the MCP server reports usage, errors, or analytics data.
- MCP host data: when using timebook mcp through Claude / Cursor, etc., the MCP host (not Timebook) controls what the model can see; tool input and output flow through the host's normal model context pipeline.
- Revoking access: access https://usetimebook.com/settings/api-tokens revoke the token at any time.
- The API/Web host can be overridden (for self-hosted Timebook or local development), and --api-url and --web-url can also be passed once during timebook login; subsequent commands reuse the saved values.
- If timebook login reports State mismatch or you want to see the request arriving at the loopback callback, you can run with --debug.
- Development-related: husky configures a pre-commit hook on npm install (ESLint + Prettier, via lint-staged); prepublishOnly runs lint + typecheck + tests + build.
- License: MIT © Squidcode LLC, see LICENSE.