MCP server grows from 14 to 25 tools with query, profile, and dev server controls

The MCP server now offers 25 tools — up from 14 — enabling AI assistants to query data directly, switch between CLI profiles per-project, and control the dev server. A nasty build directory leak that was hoarding 842MB on disk has also been fixed.
The MCP server for Trigger.dev just got a major upgrade. AI assistants can now execute TRQL queries directly against your Trigger.dev data, list and run dashboard widget queries, and manage CLI profiles — all without leaving the conversation.
Three profile-related tools solve a common pain point: developers working across multiple projects or accounts previously had to manually reconfigure their CLI. The new whoami, list_profiles, and switch_profile tools let AI agents switch profiles on the fly, with preferences persisted to in each project. This is particularly useful for agencies managing dozens of client projects.
A --readonly flag addresses a security concern for agents operating in sensitive environments. When enabled, it hides write tools (deploy, trigger_task, cancel_run) so agents can analyze and explore but can't make changes. Each tool now includes readOnlyHint and destructiveHint annotations for clients that support them.
The dev CLI had a disk space leak that was quietly accumulating build directories — up to 842MB observed in one case. Every rebuild created a new build-* directory in .trigger/tmp/ without cleaning up old ones. The fix adds three layers of protection: deprecated workers are pruned (capped at 2 retained) when no active runs reference them, the watchdog process cleans up temp directories when the CLI is killed ungracefully, and any orphans are wiped on next startup.
Bug fixes include list_deploys failing when deployments have null runtime or runtimeVersion fields (the Zod schema now uses .nullable()), search_docs breaking due to a Mintlify tool rename, and list_preview_branches crashing from incorrect response shape access.
These changes live primarily in the CLI package with new API routes in the webapp for schema discovery and dashboard listing.
View Original GitHub Description
Summary
Major expansion of the MCP server (14 → 25 tools), context efficiency optimizations, new API endpoints, and a fix for the dev CLI leaking build directories on disk.
New MCP tools
- Query & analytics:
get_query_schema,query,list_dashboards,run_dashboard_query— query your data using TRQL directly from AI assistants - Profile management:
whoami,list_profiles,switch_profile— see and switch CLI profiles per-project (persisted to.trigger/mcp.json) - Dev server control:
start_dev_server,stop_dev_server,dev_server_status— start/stoptrigger devand stream build output - Task introspection:
get_task_schema— get payload schema for a specific task (split out fromget_current_workerto reduce context)
New API endpoints
GET /api/v1/query/schema— discover TRQL tables and columns (server-driven, multi-table)GET /api/v1/query/dashboards— list built-in dashboard widgets and their queries
New features
--readonlyflag — hides write tools (deploy,trigger_task,cancel_run) so agents can't make changesread:queryJWT scope — new authorization scope for query endpoints, with per-table granularity (read:query:runs,read:query:llm_metrics, etc.)- Paginated trace output —
get_run_detailsnow paginates trace events via cursor, caching the full trace in a temp file so subsequent pages don't re-fetch - MCP tool annotations — all tools now have
readOnlyHint/destructiveHintannotations for clients that support them - Project-scoped profile persistence —
switch_profilesaves to.trigger/mcp.json(gitignored), automatically loaded on next MCP server start
Context optimizations
get_query_schemarequires a table name — returns one table's schema instead of all tables (60-80% fewer tokens)get_current_workerno longer inlines payload schemas — useget_task_schemafor specific tasks- Query results formatted as text tables instead of JSON (~50% fewer tokens for flat data)
cancel_run,list_deploys,list_preview_branchesformatted as text instead of rawJSON.stringify()- Schema and dashboard API responses cached (1hr and 5min respectively)
Bug fixes
- Fixed
search_docsfailing due to renamed upstream Mintlify tool (SearchTriggerDev→search_trigger_dev) - Fixed
list_deploysfailing when deployments have nullruntime/runtimeVersionfields (fixes #3139) - Fixed
list_preview_branchescrashing due to incorrect response shape access - Fixed
metricstable column documented asvalueinstead ofmetric_valuein query docs - Fixed
/api/v1/querynot accepting JWT auth (addedallowJWT: true)
Dev CLI build directory fix
The dev CLI was leaking build-* directories in .trigger/tmp/ on every rebuild, accumulating hundreds of MB over time (842MB observed). Three layers of protection added:
- During session: deprecated workers are pruned (capped at 2 retained) when no active runs reference them, preventing unbounded accumulation
- On SIGKILL/crash: the watchdog process now cleans up
.trigger/tmp/when it detects the parent CLI was killed - On next startup: existing
clearTmpDirs()wipes any remaining orphans
Test plan
-
pnpm run mcp:smoke— 17 automated smoke tests for all read-only MCP tools -
pnpm run mcp:test list— verify 25 tools registered (21 in--readonlymode) -
pnpm run mcp:test --readonly list— verify write tools hidden - Manual: start dev server, trigger task, rebuild multiple times, verify build dirs stay capped at 4
- Manual: SIGKILL the dev CLI, verify watchdog cleans up
.trigger/tmp/ - Verify new API endpoints return correct data:
GET /api/v1/query/schema,GET /api/v1/query/dashboards
🤖 Generated with Claude Code