talous-mcp
v0.5.1Connect Claude to your Talous workspace: tasks, brands, ads approvals, CRM, leads, and a work log Claude keeps on your board
talous-mcp Stdio MCP server that puts the whole of Talous in front of Claude Code (or any MCP client) with one personal API key. /api/v1 is called with the key directly; every other app route — the ones behind each screen: brands, Meta and Google ads, approvals, autopilot, SEO, CRM, the WhatsApp bot, leads, reports, settings, admin — is reached through a one-hour session the server mints from that key (POST /api/v1/session), so the MCP sees and changes exactly what the key's user could in the browser. Tenant scoping, RBAC and the admin gate are the server's, not the client's.
Summary extracted from the README.
talous-mcp
Stdio MCP server that puts the whole of Talous in front of Claude Code (or
any MCP client) with one personal API key. /api/v1 is called with the key
directly; every other app route — the ones behind each screen: brands, Meta
and Google ads, approvals, autopilot, SEO, CRM, the WhatsApp bot, leads,
reports, settings, admin — is reached through a one-hour session the server
mints from that key (POST /api/v1/session), so the MCP sees and changes
exactly what the key's user could in the browser. Tenant scoping, RBAC and
the admin gate are the server's, not the client's.
Tools
What these tools change is recorded as the workspace's Claude account, not as the key's owner, so the board and the audit trail say Claude did what Claude did. The key still decides what may be done — see Security.
Everything else — the route catalogue
| Tool | Does | Notes |
|---|---|---|
list_api_routes |
Search the catalogue of every app route | search (terms matched against path + doc), method, auth, limit. 700+ routes, generated from src/app/api/**/route.ts at build time. |
describe_api_route |
One route in full | Methods, auth kind, doc, the query params and body keys the handler reads, and whether call_api may call it. Accepts a template (/api/brands/{id}) or a concrete path. |
call_api |
Call any app route as the key's user | method, path, query, body. Returns { status, ok, body } — a 4xx/5xx comes back, not thrown. Refuses /api/auth/*, /api/keys*, /api/v1/session, /api/v1/creative-sources*, /api/cron/*, /api/wh/*. A 401 carries a note saying whether the key, the session or the route refused. |
Brands, ads, autopilot
| Tool | Does |
|---|---|
list_brands / get_brand / update_brand |
Brands the user can see; rename, (de)activate, primary Meta account, config, feature toggles. |
get_brand_guardrails / set_brand_guardrails |
Per-tier threshold profiles (cplMax, roasMin, …) the judge enforces. |
list_meta_accounts / link_meta_accounts |
Meta ad accounts on a brand; attach more (one brand per account — a taken account is reported as skipped). |
list_approvals / decide_approval |
Pending judge decisions; approve (executes — spend can change) or reject, with note / remark / budget override / edited copy. |
meta_ad_action |
Pause or activate one Meta ad now. |
get_automation_settings / set_automation_settings |
Autopilot tier, confidence floor and the auto-approve action list per brand. |
brand_performance / insights_summary / ops_brief |
One brand's spend, results, cost per result and return over a window (default the last 7 complete days) against the window before it; the same brand's ad sets and ads with the Insights screen's verdict on each; the approvals waiting and the new leads. All three read what the key's user can open, through the routes the screens use. |
CRM and leads
| Tool | Does |
|---|---|
list_wacrm_conversations / get_wacrm_conversation / set_wacrm_control |
WhatsApp CRM conversations; hand one to a human or back to the bot. |
get_engage_gate / set_engage_gate |
Whether the bot may open conversations with people who did not come from an ad (true / false / null = inherit). |
wacrm_channel_status / list_wacrm_flows |
Line connection state; conversation flows. |
list_leads / get_lead / update_lead |
Leads with filters and cursor paging; change fields. |
The work log — Claude on the board
Five tools that put a Claude session's own work on the Talous task board as a
teammate, so the operator can watch it happen without asking. The task is
assigned to a real account named Claude, which the server finds on the
caller's own roster (TALOUS_CLAUDE_USER_ID overrides). There is no fallback
to unassigned: an unassigned task on this board reads as the operator's own.
Every session is told to keep the log at connection time — the briefing is the
MCP instructions field, so it arrives before the client has asked for
anything and applies to sessions whose operator never mentions it.
| Tool | Does | Notes |
|---|---|---|
work_start |
Open a job with the steps you expect | title, steps (plain English, checked), details (free text — paths and ids go here), project_name / project_id (default TALOUS_WORKLOG_PROJECT). Opens in_progress. |
work_add_step |
Add a step to an open job | For work that was not in the plan. |
work_step_done |
Tick one step | Named by its text, part of its text, or its id. Refuses an ambiguous match rather than ticking one. Writes both isDone and status. |
work_note |
Note what you found | Free text, not checked. |
work_finish |
Post the outcome and close | The comment lands before the task closes; any step still open is named back rather than ticked. |
Titles and steps are checked for plain English and a file path, identifier,
route or commit hash is refused, with a message naming the fragment and where
it may go instead. The check is on the SHAPE of the text, never its topic — a
word list would refuse "check the delivery receipts", which is exactly what a
person would say. details, note and the finishing outcome are free.
Scope is multi-step work: a one-line question or a quick lookup writes nothing, because a board of trivia is a board nobody reads.
Tasks and projects (/api/v1)
| Tool | Does | Notes |
|---|---|---|
list_tasks |
Open tasks, filtered | status (one or a list; default open = todo, in_progress, blocked), include_done, project_id or project_name, assignee_id or unassigned, due_before / due_after (inclusive, YYYY-MM-DD in the server timezone), limit (default 50, max 500). Sorted due date ascending with undated last, then priority, then newest. |
get_task |
One task with its subtasks | |
create_task |
New task | title and project_id or project_name required; optional description, status, priority, due_date, assignee_id. |
update_task |
Change fields | title, description, status, priority, due_date (null clears), assignee_id (null clears), project_id (move). Refuses an empty update. |
complete_task |
Status → done | Recurring tasks spawn their next instance server-side. |
list_projects |
Projects the key can see | |
list_task_comments / add_task_comment |
Comments on a task | A comment is signed as the workspace's Claude account, the same as a work-log note; on an instance that will not sign it, it is still posted under the key owner's name and the answer says so. Need /api/v1/tasks/:id/comments (added 2026-09-04). A server without it answers 404 and the tool says so. |
Dates: due_date comes back as YYYY-MM-DD in TALOUS_TZ (default
Asia/Kuala_Lumpur) and due_at as the full offset timestamp. Filters take
either a bare date or an ISO 8601 timestamp.
Setup
Nothing to build and nothing to clone, and no key to copy. Run this once, with your own instance's address:
npx -y talous-mcp login --url https://your-instance.talous.dev
It opens Talous in your browser on Settings → Integrations → API keys,
showing a short code. Check it matches the one in the terminal and press
Approve (you must be signed in). The terminal then saves a key for you to a
private file (~/.config/talous/<your-instance>.key, mode 600) and registers
the server with Claude Code and, when it is installed, Claude Desktop, pointing
at that file. Restart Claude and the tools are there. The key is never shown,
pasted or put on a command line.
You can also let Claude do it: Settings → Connect Claude has a one-message prompt to paste into Claude Code, which runs the same command and leaves the approval to you in the browser. Nothing lets Claude approve its own login.
Options: --name registers under another name, --key-file saves the key
elsewhere, --no-register only saves it. A login that began on a different
network from the browser asks you to tick "I started this login myself" before
Approve works, since a code phished out of someone arrives exactly that way.
With a key instead
For an instance older than browser login, or a machine with no browser: create a key under Settings → Integrations → API keys → Connect Claude, copy the command it shows (it already carries your instance's address), and run it once. By hand, it is:
claude mcp add --scope user talous \
--env TALOUS_API_KEY=ait_… \
--env TALOUS_BASE_URL=https://your-instance.talous.dev \
-- npx -y talous-mcp
--scope user registers it for every project on that machine. Point
TALOUS_BASE_URL at your own Talous — it defaults to the house instance, which
is not where a client's data lives.
The first connection also does the setup: the server asks your instance for the teammate account the work log files under, creates it and its project if this is the first Claude session to connect, and reuses them ever after. Nobody has to make a user by hand.
To keep the key out of the MCP registration, put it in a file instead and use
TALOUS_API_KEY_FILE:
mkdir -p ~/.config/talous && chmod 700 ~/.config/talous
printf '%s' 'ait_…' > ~/.config/talous/mcp-api-key && chmod 600 ~/.config/talous/mcp-api-key
Check it works: claude mcp get talous says Connected, and
TALOUS_API_KEY_FILE=$HOME/.config/talous/mcp-api-key node scripts/smoke.mjs list_tasks '{"limit":10}'
lists your open tasks.
From source, for working on the server itself
cd mcp && npm ci && npm run build && npm pack && npm install -g ./talous-mcp-*.tgz
Run npm pack from inside mcp/. With --prefix mcp from the repo root npm
packs the ROOT package instead — the whole application, thousands of files.
Environment
| Variable | Meaning |
|---|---|
TALOUS_API_KEY or TALOUS_API_KEY_FILE |
One is required. Inline wins when both are set. |
TALOUS_CLAUDE_USER_ID |
Optional. The user the work log assigns to. Unset ⇒ the teammate named "Claude" on this workspace, created on first connection if there is not one. |
TALOUS_WORKLOG_PROJECT |
Optional. Project work_start files into when it is not given one. Unset ⇒ the "Claude" project, created on first connection. |
TALOUS_BASE_URL |
Your own instance, e.g. https://your-company.talous.dev. Defaults to https://task.talous.dev, which is NOT where a client's data lives. |
TALOUS_TZ |
IANA zone for date rendering and day boundaries. Default Asia/Kuala_Lumpur. |
Security
- The server does what its key's user can do, nothing more.
/api/v1routes check the key (authenticateApiKey); every other route sees a normal Auth.js session for that user, minted byPOST /api/v1/sessionand sent as theCookie:the browser would send, sogetSessionUser, the proxy gate, RBAC, tenancy and the admin allowlist all apply unchanged. There is no cross-workspace path to add here. - The session lives one hour and is re-minted silently on a 401 or on the
proxy's redirect to
/login. It is signed with the app's own secret and cookie-name salt, so a password change or a rotated secret ends it exactly as it ends a browser session. call_apirefuses the routes that could widen the key's own grant (login, MFA and password flows, key minting, the session mint, the browser-login routes, which would let a session approve its own login, creative sources, whose create and rotate answers carry a bearer token) and the machine-secret routes (cron, webhooks) that would only ever 401.- Writes are RECORDED as Claude and AUTHORISED as the key. Every write
carries
x-talous-act-aswith the Claude account's id, and the instance accepts exactly one id there: its own lookup of the Claude teammate of the caller's workspace. Any other id is a 403 before anything runs, so a key cannot put a colleague's name on its work. The header moves the name on the row and nothing else — every access check still runs against the key, and the activity or audit row keeps the key's user beside it, so a change recorded as Claude's can always be traced to whose key made it. The routes that record a name honour it: tasks created and updated through/api/v1, comments, approval decisions, ad pause and activate, lead updates. A route that records no name ignores it, and anything else reached throughcall_apirecords the key's user. An instance too old to honour the header is not sent it, and the first write of the session says so. - Neither the key nor the session token appears in tool output or error text. A 401 says which of three things refused: the key itself (mint a new one), the session minted from a key that was accepted (a new key will not help), or a route that takes only another system's credential, such as a service token (no personal key can call it). Only the first is told to mint.
- Against a server that predates
/api/v1/session, the app tools fail with a message saying so; the/api/v1tools keep working. - Diagnostics go to stderr; stdout is the MCP transport.
Development
npm test runs the vitest suite against an in-memory fake of the API;
npm run build regenerates src/routes.generated.ts from the app's route
files (scripts/gen-routes.mjs — commit the result) and compiles to dist/; npm run smoke spawns the built server
the way Claude Code does and calls one tool. CI runs install, build and tests
in the deploy workflow's "MCP server (mcp/)" step.
Describing a route in that catalogue is opt-in. This package is public, so a
route's description is world-readable and permanent; the generator reads only an
explicit @mcp <one sentence> in a leading /** */ block and publishes nothing
for a route that has none. Source comments written for Talous developers stay
where they are. Add a line when a route is worth Claude finding on its own:
/**
* @mcp List or create tasks. Reads and writes are limited to the projects the
* calling key's user can reach.
*/
To ship a change: bump the version in package.json AND both version fields at
the top of package-lock.json, then npm publish from inside mcp/ —
--prefix mcp packs the repository root instead, which is a private 13 MB
package with the wrong name.