tokenstat
tokenstat
CLI and MCP

Connect an agent to workspaces, tasks and notes with MCP

György
Reviewed by
György
Updated Sep 11, 2026 15 min

tokenstat's MCP server gives an agent access to local usage reports, registered project folders, tasks, notes, automations and workflows. Give the default instructions below to your agent. It can reuse an existing connection, find the local executable where it has access, and remember your preference. Manual installation and configuration are further down this guide. The server supplies descriptions and input schemas for all 49 tools once connected.

Start here: copy the default agent instructions

Paste this into an agent conversation or your project's agent instructions. It includes connection discovery for all three platforms and asks the agent to save your tokenstat preference in its supported global memory or user-level instructions. An agent without local access can give you setup steps; an agent without persistent memory can return a note for you to save. The prompt does not assume a particular client's configuration or memory-file location.

Remember tokenstat on this machine.

- tokenstat's MCP server is a local stdio server named `tokenstat`. If it is already configured in this client, reuse it.
- If it is missing and you have shell/filesystem access, find the executable: `command -v tokenstat` on macOS/Linux (installer default ~/.local/bin/tokenstat) or `(Get-Command tokenstat -ErrorAction SilentlyContinue).Source` on Windows (default %LOCALAPPDATA%\tokenstat\tokenstat.exe). Resolve the real home/LOCALAPPDATA, never copy YOUR_USERNAME literally. Verify the file exists.
- Configure a stdio MCP server named tokenstat with that absolute path and args ["mcp"] (standalone tokenstat-mcp uses args []). Use this client's MCP setup, do not overwrite other servers. Reconnect if needed. No port or API key. The macOS app bundle holds the host helper, not the MCP server. A browser-only agent needs a client-supported local bridge. Windows MCP covers archive tools; workspace/task/note/job tools need the Unix host (run tokenstat or tokenstat-hostd on macOS/Linux).
- Save in this agent's global memory or user instructions: use tokenstat for work tracking and project notes; the server name, verified command path, args, stdio transport, platform limits, tokenstat://guide, and workspace_list -> workspace_context. Paths and workspace IDs are machine-specific, recheck per machine and project. Merge with existing instructions. No credentials or note bodies in memory. If memory is unavailable, say so and return a short note to save.

When I ask about tokenstat, usage, projects, tasks or notes, use the tokenstat MCP tools:

1. Call workspace_list, match this project's absolute folder path to its workspace ID. If missing, workspace_add the existing absolute path. Never invent an ID or use a path as workspaceId.
2. Read workspace_context with {id} for one project, or {} for all projects.
3. `projects` is historical usage, not folder discovery. workspace_context takes `id`; list tools take `workspaceId` (omit = all workspaces, "" = unassigned only on list). task_list and note_list accept includeArchived and query; use includeArchived=true for older cards.
4. Read tokenstat://guide and the tool descriptions when unsure.

What belongs in global memory

Remember the preference and the verified connection details, not the contents of your work. Store the MCP server name, command path, arguments, transport, platform limits, guide URI and workspace discovery sequence. Paths and workspace IDs are machine-specific. On a new computer, rediscover the executable and workspace.

Project decisions and handoff notes belong in tokenstat notes under their workspace ID. They do not need to be duplicated into the agent's global memory. Saving a memory note does not register an MCP server in a different client; each client still needs its own connection configuration.

How the agent learns what is available

MCP surface What it provides
initialize.instructions Startup guidance: discover folders, use exact IDs, distinguish tasks from notes, and separate tracking from execution.
tools/list All tool names, descriptions, input schemas and required arguments. Clients usually discover these automatically.
resources/list Advertises the agent guide.
resources/read with uri: "tokenstat://guide" Reads the guide inside the MCP client. This is an MCP resource URI, not a browser URL.
workspace_list Live registered workspace IDs, names, paths and Git status.
workspace_context A current memo of workspaces and their task/note cards, across all folders or one ID.
backend_list Installed agent backends and their advertised model and reasoning effort options.

The tool descriptions are the callable reference. Ask the agent to read them when it needs exact inputs. Workflows use host-shaped graph objects; use workflow_get before replacing a graph. Automation updates likewise use the complete job object from automation_list.

Find the right project before adding work

  1. Call workspace_list and match the intended folder's absolute path.
  2. If it is missing, call workspace_add with its existing absolute path. This registers a folder; it does not create a directory.
  3. Use the returned ID. Never put a display name or filesystem path in workspaceId.
  4. Call workspace_context with {"id":"WORKSPACE_ID"} to read that project's context. Call it with {} for all registered folders and all unassigned cards.
  5. Search existing tasks and notes before creating a duplicate.

The projects tool reports historical usage by project. It is not the registered workspace list and does not provide IDs for creating tasks.

Intent Arguments
Read context for every workspace workspace_context with {}
Read context for one workspace workspace_context with {"id":"WORKSPACE_ID"}
List tasks and notes in every workspace task_list with {}
List only executable task cards task_list with {"kind":"task"}
List notes in one workspace note_list with {"workspaceId":"WORKSPACE_ID"}
List only global/unassigned notes note_list with {"workspaceId":""}
Find older cards too Add "includeArchived": true to a list or context call.
Search card text Add "query":"release" to task_list or note_list.

Omitting workspaceId when creating a card makes it global/unassigned. Omitting it when listing means all workspaces. An empty string selects only unassigned cards on list tools. workspace_context uses id, not workspaceId.

Create a task or save a memo

Pass this object to task_create, replacing the workspace ID:

{
  "title": "Prepare the release",
  "notes": "Run checks and record remaining blockers.",
  "workspaceId": "REPLACE_WITH_WORKSPACE_ID"
}

Pass this object to note_create for project memory:

{
  "title": "Release handoff",
  "notes": "Decision: keep the current migration order. Remaining work: verify the import on a fresh archive.",
  "workspaceId": "REPLACE_WITH_WORKSPACE_ID"
}

Notes are board cards with kind: "note"; their body is the notes field. They cannot be delegated. task_list includes both kinds unless filtered. note_list always selects notes. task_get can read either kind, including archived cards. Note-specific read/update/remove tools reject task IDs.

Updates preserve omitted fields. To finish a task, call task_update with:

{
  "id": "REPLACE_WITH_TASK_ID",
  "column": "done"
}

Columns are backlog, doing, done and archive. Use includeArchived: true when a completed card is absent from a default list. Removal permanently deletes a card; moving it to archive keeps it available for later lookup.

Tool reference

All 49 tools are listed below. id means the record ID named in the description; workspaceId is a registered folder ID. Unless noted, optional inputs can be omitted.

Usage: 8 tools

Tool Purpose and inputs
totals Headline token counters. Optional since, until (YYYY-MM-DD), model, project.
models Usage grouped by model. Optional since, until, positive limit.
daily Usage by local calendar day. Optional since, until, positive limit.
weekly Usage by ISO week. Optional since, until, positive limit.
projects Historical usage grouped by project. Optional since, until, positive limit.
budget_status Today/month list-rate spend against soft budget caps, not billed money. No inputs.
doctor Archive health, counts, confidence, reconciliation and database path. No inputs.
scan Import new local tool-log records into the archive. No inputs; changes the archive.

Workspaces: 6 tools

Tool Purpose and inputs
workspace_list Registered folder IDs, names, paths and Git status. No inputs.
workspace_get Current status for one workspace. Required id.
workspace_add Register an existing folder. Required absolute path; returns the workspace ID.
workspace_rename Change the display label. Required id, name.
workspace_remove Forget the registration. Required id; does not delete the directory or files.
workspace_context Current workspace and card memo. Optional id, includeArchived.

Tasks: 7 tools

Tool Purpose and inputs
task_list List cards. Optional workspaceId, kind, column, includeArchived, query.
task_get Read one task or note, including archived cards and delegation state. Required card id.
task_create Create without running. Required title; optional notes, kind, column, priority (low, normal, high), workspaceId, backend, model, effort, budgetSeconds.
task_update Update a card. Required id; optional title, notes, kind, column, order, workspaceId, backend, model, effort, budgetSeconds.
task_remove Permanently delete a card. Required card id.
task_delegate Start an agent for a task. Required card id; the card must have a workspace and backend.
task_stop Stop a delegated task. Required card id, not run ID.

Notes: 5 tools

Tool Purpose and inputs
note_list Notes only. Optional workspaceId, column, includeArchived, query.
note_get Read a note, including archived notes. Required note id.
note_create Save a memo without execution. Required title; use notes for the body and optional workspaceId for its folder. Also accepts the task-create fields except kind, which is fixed to note.
note_update Update a note. Required note id; accepts task-update fields except kind. Omitted fields are preserved.
note_remove Permanently delete a note. Required note id.

Agent backends: 1 tool

Tool Purpose and inputs
backend_list Discover available backends, models and reasoning effort options before choosing them. No inputs.

Automations: 11 tools

Tool Purpose and inputs
automation_list Read saved scheduled job objects. No inputs.
automation_create Save a job. Required job object; its schema is described in tools/list.
automation_update Update a saved job. Required complete job object with its existing ID.
automation_enable Enable or disable a schedule. Required job id, boolean enabled.
automation_remove Delete a saved job. Required job id.
automation_run Queue a job now. Required job id.
automation_runs Read recent runs and their IDs/status. No inputs.
automation_transcript Read a run's output. Required run id; optional byte offset.
automation_kill Stop a live run. Required run id, not job ID.
automation_queue Read default time budget and concurrency settings. No inputs.
automation_set_queue Set optional defaultBudgetSeconds, maxConcurrent; zero means no time limit or no concurrency cap respectively.

A job requires id, name, backend, workspaceId, prompt, budgetSeconds and enabled. Use an empty id on creation to generate one. Optional model and effort come from backend discovery. An omitted schedule is manual-only. Schedule kinds are once, interval, daily, weekdays, weekly and custom. Intervals use everySeconds (at least 60); wall-clock schedules use local hour and minute. Weekly schedules use weekday (Monday = 0) or the weekdays bitmask (Monday = bit 0); custom schedules use that bitmask. Saving an enabled recurring schedule allows the scheduler to run it when due.

Workflows: 11 tools

Tool Purpose and inputs
workflow_list List global and workspace-bound saved graphs. No inputs.
workflow_get Read a saved graph. Required workflow id.
workflow_create Save a graph. Required workflow object in host format.
workflow_update Replace a graph. Required complete workflow object with its ID.
workflow_remove Delete a saved graph. Required workflow id.
workflow_run Start a graph. Required workflow id; optional input, workspaceId. A bound graph can use its saved workspace.
workflow_runs List recent workflow runs. No inputs.
workflow_continue Continue a run waiting at a gate. Required run id.
workflow_kill Stop a live workflow. Required run id.
workflow_transcript Read a step's transcript. Required run id, nodeId; optional offset.
workflow_design Ask a backend for a JSON draft, without saving or running the graph. Required prompt; optional workspaceId, backend, model, effort. The design request itself invokes an agent backend.

Run work deliberately

Creating a task or note does not execute it. To run a task, first discover a backend, bind the card to its workspace and backend with task_update, then call task_delegate. Read task_get for delegation state. Its delegate.runId is the ID to pass to automation_transcript. task_stop takes the card ID.

MCP results enter the calling agent's context and may be processed by its provider. Results can include project names, paths, task/note bodies and transcripts. A local connection does not make the calling agent offline.

Delegated tasks and automation/workflow runs may edit files, execute commands, contact services, incur provider charges or change Git state. Review these operations according to your client's approval settings. workflow_design invokes a backend to produce a draft; workflow_run is a separate action.

These tools do not expose account sync or public-profile publication. They do not provide general chat control, an arbitrary host-RPC tool, or a remote MCP HTTP endpoint.

Advanced setup and installation

Install the tokenstat CLI. Its mcp command starts the server. On macOS or Linux, find the installed executable:

command -v tokenstat

The installer uses ~/.local/bin/tokenstat on both macOS and Linux. Replace YOUR_USERNAME in the matching configuration below with your account's home folder name, or use the exact result of command -v tokenstat for a custom installation. Use a full absolute path: MCP clients may not expand ~ or $HOME in JSON.

macOS default installation

{
  "mcpServers": {
    "tokenstat": {
      "command": "/Users/YOUR_USERNAME/.local/bin/tokenstat",
      "args": [
        "mcp"
      ]
    }
  }
}

Linux default installation

{
  "mcpServers": {
    "tokenstat": {
      "command": "/home/YOUR_USERNAME/.local/bin/tokenstat",
      "args": [
        "mcp"
      ]
    }
  }
}

Windows default installation: archive tools

The Windows installer uses %LOCALAPPDATA%\tokenstat\tokenstat.exe. This usually expands to the path below. Use the actual LOCALAPPDATA location on your machine; JSON paths need escaped backslashes.

{
  "mcpServers": {
    "tokenstat": {
      "command": "C:\\Users\\YOUR_USERNAME\\AppData\\Local\\tokenstat\\tokenstat.exe",
      "args": [
        "mcp"
      ]
    }
  }
}

To locate it in PowerShell:

(Get-Command tokenstat -ErrorAction SilentlyContinue).Source
Join-Path $env:LOCALAPPDATA 'tokenstat\tokenstat.exe'

Archive tools are available on Windows. Workspace, task, note, automation and workflow tools need the Unix host and are not available through Windows MCP.

Add the entry to your agent client's MCP configuration, then restart or reconnect the client. The configuration file's location depends on the client. If it provides a setup form, enter the executable path as the command and mcp as its argument.

The macOS app in Applications bundles tokenstat-hostd, which is the host helper, not the CLI MCP server. Install the CLI as well; do not use the app's GUI executable or its bundled host helper as the MCP command.

Build the standalone server

The standalone tokenstat-mcp executable is another option. Set its absolute path as command and use "args": []. To build it from a tokenstat source checkout with the repository's Rust toolchain:

cargo build --release -p tokenstat-mcp

The executable is target/release/tokenstat-mcp inside that checkout.

Keep the tokenstat app or tokenstat-hostd running under the same user on the same Unix machine for workspace, task, note and job management. These tools communicate with the host through its local Unix socket. Windows host management is not supported by this MCP transport. Archive tools work without the host. Refresh the archive when needed:

tokenstat scan

Does it need a web port or API key?

No. The client launches a local process and exchanges newline-delimited JSON-RPC through stdin/stdout. There is no MCP HTTP endpoint to visit, no listening web port to configure, and no tokenstat API key needed for this local connection.

An agent cannot automatically find an executable that its client has not registered. A browser-only agent needs a client-supported bridge to local MCP; it cannot access your computer by visiting tokenstat.ai. The hosted read API is a separate interface for usage data, not a remote version of these 49 tools.

Troubleshooting

Symptom What to check
The client cannot find the executable Use an absolute executable path. A desktop client's PATH can differ from your shell. For the CLI, supply mcp; for tokenstat-mcp, supply no arguments.
No tokenstat tools appear Enable the configured server and reconnect the client. Ask it to list tokenstat tools; check its MCP connection log for startup errors.
The process appears to wait in a terminal It is waiting for MCP messages on stdin. Let an MCP client launch it. It is not a web server.
Usage works but management reports that the host is not running Start the tokenstat app or tokenstat-hostd under the same Unix user. Windows host management is unavailable through this transport.
Invalid or unavailable workspace ID Call workspace_list; match the exact path. Register a missing existing folder with workspace_add. Use the ID, not the path, in card workspaceId.
A card is in the wrong place Read its workspaceId; update it to the intended ID. An empty string is unassigned.
A task is missing from a list Check workspace/kind/column filters and set includeArchived: true; task_get reads an archived card by ID.
A note cannot be delegated Notes are reminders. Create an executable task or deliberately change its kind through task_update before configuring execution.
A tool rejects an argument Read its input schema. Names are case-sensitive: use workspaceId, not workspace_id; context lookup uses id.
Copy is unavailable Select the code or prompt and copy it manually. Clipboard support depends on the browser and page security context.

Human-led and verified · AI-assisted content · AI tools may help draft, edit, maintain, and improve grammar or clarity. Nothing is published automatically; every change is reviewed by the human maintainer.