Skip to content

Commit 9f347ee

Browse files
committed
docs(cli): Expand and improve the MCP server and dev CLI command
Depends on #3224
1 parent 7672e8d commit 9f347ee

File tree

7 files changed

+234
-7
lines changed

7 files changed

+234
-7
lines changed

docs/docs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@
323323
},
324324
{
325325
"group": "Query API",
326-
"pages": ["management/query/execute"]
326+
"pages": ["management/query/execute", "management/query/schema", "management/query/dashboards"]
327327
}
328328
]
329329
},
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
title: "List dashboards"
3+
openapi: "v3-openapi GET /api/v1/query/dashboards"
4+
---

docs/management/query/schema.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
title: "Get query schema"
3+
openapi: "v3-openapi GET /api/v1/query/schema"
4+
---

docs/mcp-introduction.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ The Trigger.dev MCP (Model Context Protocol) Server enables AI assistants to int
1414
- Get task information and trigger task runs
1515
- Deploy projects to different environments
1616
- Monitor run details and list runs with filtering options
17+
- Query your data with TRQL and run built-in dashboard metrics
1718

1819
## Installation
1920

@@ -306,6 +307,7 @@ The `install-mcp` command supports these options:
306307
- `-p, --project-ref <project ref>` — Scope the MCP server to a specific project
307308
- `-t, --tag <package tag>` — CLI package version to use (default: latest)
308309
- `--dev-only` — Restrict to the dev environment only
310+
- `--readonly` — Read-only mode. Hides write tools (`deploy`, `trigger_task`, `cancel_run`) so the AI cannot make changes to your account
309311
- `--yolo` — Install into all supported clients automatically
310312
- `--scope <scope>``user`, `project`, or `local`
311313
- `--client <clients...>` — Install into specific client(s)
@@ -336,6 +338,12 @@ Restrict to dev environment for a specific project:
336338
npx trigger.dev@latest install-mcp --dev-only --project-ref proj_abc123
337339
```
338340

341+
Read-only mode (prevents AI from deploying or triggering tasks):
342+
343+
```bash
344+
npx trigger.dev@latest install-mcp --readonly
345+
```
346+
339347
To add these options to a manual config, append them to the `args` array:
340348

341349
```json
@@ -358,6 +366,9 @@ Once installed, you can start using the MCP server by asking your AI assistant q
358366
- `"List all runs for my foobar task"`
359367
- `"Deploy my project to staging"`
360368
- `"Deploy my project to production"`
369+
- `"How many runs failed in the last 7 days?"`
370+
- `"Show me the overview dashboard metrics"`
371+
- `"What tables can I query?"`
361372

362373
## Next Steps
363374

docs/mcp-tools.mdx

Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,93 @@ List all preview branches in the project.
128128
- `"What preview branches exist?"`
129129
- `"Show me preview deployments"`
130130

131+
## Profile Tools
132+
133+
### whoami
134+
135+
Show the current authenticated user, active CLI profile, email, and API URL.
136+
137+
**Example usage:**
138+
- `"Who am I logged in as?"`
139+
- `"What profile am I using?"`
140+
141+
### list_profiles
142+
143+
List all configured CLI profiles and which one is currently active.
144+
145+
**Example usage:**
146+
- `"What profiles do I have?"`
147+
- `"Show me my Trigger.dev profiles"`
148+
149+
### switch_profile
150+
151+
Switch the active CLI profile for this MCP session. This changes which Trigger.dev account and API URL are used for all subsequent tool calls.
152+
153+
**Example usage:**
154+
- `"Switch to my production profile"`
155+
- `"Use the staging profile"`
156+
157+
## Query and Analytics Tools
158+
159+
### get_query_schema
160+
161+
Get the schema for TRQL queries, including all available tables, their columns, data types, descriptions, and allowed values. Call this before using the query tool to understand what data is available.
162+
163+
**Example usage:**
164+
- `"What tables and columns can I query?"`
165+
- `"Show me the query schema"`
166+
167+
### query
168+
169+
Execute a TRQL query against your Trigger.dev data. TRQL is a SQL-style query language for analyzing runs, metrics, and LLM usage.
170+
171+
**Example usage:**
172+
- `"How many runs failed in the last 7 days?"`
173+
- `"Show me the top 10 most expensive tasks"`
174+
- `"Query the average execution duration by task"`
175+
176+
### list_dashboards
177+
178+
List available built-in dashboards with their widgets. Each dashboard contains pre-built queries for common metrics.
179+
180+
**Example usage:**
181+
- `"What dashboards are available?"`
182+
- `"Show me the dashboard widgets"`
183+
184+
### run_dashboard_query
185+
186+
Execute a single widget query from a built-in dashboard. Use `list_dashboards` first to see available dashboards and widget IDs.
187+
188+
**Example usage:**
189+
- `"Run the total runs widget from the overview dashboard"`
190+
- `"Show me the LLM cost over time from the AI dashboard"`
191+
192+
## Dev Server Tools
193+
194+
### start_dev_server
195+
196+
Start the Trigger.dev dev server (`trigger dev`) in the background. Waits up to 30 seconds for the worker to be ready.
197+
198+
**Example usage:**
199+
- `"Start the dev server"`
200+
- `"Run trigger dev"`
201+
202+
### stop_dev_server
203+
204+
Stop the running Trigger.dev dev server.
205+
206+
**Example usage:**
207+
- `"Stop the dev server"`
208+
209+
### dev_server_status
210+
211+
Check the status of the dev server and view recent output. Shows whether it is stopped, starting, ready, or has errors.
212+
213+
**Example usage:**
214+
- `"Is the dev server running?"`
215+
- `"Show me the dev server logs"`
216+
- `"Are there any build errors?"`
217+
131218
<Callout type="warning">
132-
The deploy and list_preview_branches tools are not available when the MCP server is running with the `--dev-only` flag.
219+
The deploy and list_preview_branches tools are not available when the MCP server is running with the `--dev-only` flag. The `--readonly` flag hides deploy, trigger_task, and cancel_run.
133220
</Callout>

docs/observability/query.mdx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ description: "Query allows you to write custom queries against your data using T
77

88
- `runs`: contains all task run data including status, timing, costs, and task output. Run metadata (key-value set in your task) is not available on the Query page.
99
- `metrics`: contains metrics data for your runs including CPU, memory, and your custom metrics
10+
- `llm_metrics`: contains LLM/AI metrics including token usage, costs, latency, and model performance data from GenAI spans
1011

1112
### `metrics` table columns
1213

1314
| Column | Type | Description |
1415
| :--- | :--- | :--- |
1516
| `metric_name` | string | Metric identifier (e.g., `process.cpu.utilization`) |
1617
| `metric_type` | string | `gauge`, `sum`, or `histogram` |
17-
| `value` | number | The observed value |
18+
| `metric_value` | number | The observed value |
1819
| `bucket_start` | datetime | 10-second aggregation bucket start time |
1920
| `run_id` | string | Associated run ID |
2021
| `task_identifier` | string | Task slug |
@@ -34,7 +35,7 @@ Use `prettyFormat()` to format metric values for display:
3435
```sql
3536
SELECT
3637
timeBucket(),
37-
prettyFormat(avg(value), 'bytes') AS avg_memory
38+
prettyFormat(avg(metric_value), 'bytes') AS avg_memory_usage
3839
FROM metrics
3940
WHERE metric_name = 'process.memory.usage'
4041
GROUP BY timeBucket
@@ -225,7 +226,7 @@ Use `GROUP BY` with aggregate functions:
225226
```sql
226227
SELECT
227228
task_identifier,
228-
avg(value) AS avg_memory
229+
avg(metric_value) AS avg_memory
229230
FROM metrics
230231
WHERE metric_name = 'process.memory.usage'
231232
GROUP BY task_identifier
@@ -529,7 +530,7 @@ Track process CPU utilization bucketed over time.
529530
```sql
530531
SELECT
531532
timeBucket(),
532-
avg(value) AS avg_cpu
533+
avg(metric_value) AS avg_cpu
533534
FROM metrics
534535
WHERE metric_name = 'process.cpu.utilization'
535536
GROUP BY timeBucket
@@ -544,7 +545,7 @@ Average process memory usage per task identifier over the last 7 days.
544545
```sql
545546
SELECT
546547
task_identifier,
547-
avg(value) AS avg_memory
548+
avg(metric_value) AS avg_memory
548549
FROM metrics
549550
WHERE metric_name = 'process.memory.usage'
550551
GROUP BY task_identifier

docs/v3-openapi.yaml

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,126 @@ paths:
11481148
"format": "json"
11491149
}'
11501150
1151+
"/api/v1/query/schema":
1152+
get:
1153+
operationId: get_query_schema_v1
1154+
summary: Get query schema
1155+
description: Get the schema for TRQL queries, including all available tables, their columns, data types, descriptions, and allowed values.
1156+
responses:
1157+
"200":
1158+
description: Schema retrieved successfully
1159+
content:
1160+
application/json:
1161+
schema:
1162+
type: object
1163+
properties:
1164+
tables:
1165+
type: array
1166+
items:
1167+
type: object
1168+
properties:
1169+
name:
1170+
type: string
1171+
description: Table name used in TRQL queries
1172+
description:
1173+
type: string
1174+
description: Description of the table
1175+
timeColumn:
1176+
type: string
1177+
description: The primary time column for this table
1178+
columns:
1179+
type: array
1180+
items:
1181+
type: object
1182+
properties:
1183+
name:
1184+
type: string
1185+
description: Column name
1186+
type:
1187+
type: string
1188+
description: ClickHouse data type
1189+
description:
1190+
type: string
1191+
description: Column description
1192+
example:
1193+
type: string
1194+
description: Example value
1195+
allowedValues:
1196+
type: array
1197+
items:
1198+
type: string
1199+
description: Allowed values for enum-like columns
1200+
coreColumn:
1201+
type: boolean
1202+
description: Whether this is a core column included in default queries
1203+
"401":
1204+
description: Unauthorized - API key is missing or invalid
1205+
tags:
1206+
- query
1207+
security:
1208+
- secretKey: []
1209+
x-codeSamples:
1210+
- lang: curl
1211+
label: cURL
1212+
source: |-
1213+
curl "https://api.trigger.dev/api/v1/query/schema" \
1214+
-H "Authorization: Bearer tr_dev_1234"
1215+
1216+
"/api/v1/query/dashboards":
1217+
get:
1218+
operationId: list_dashboards_v1
1219+
summary: List built-in dashboards
1220+
description: List available built-in dashboards with their widgets. Each dashboard contains pre-built TRQL queries for common metrics like run success rates, costs, and LLM usage.
1221+
responses:
1222+
"200":
1223+
description: Dashboards listed successfully
1224+
content:
1225+
application/json:
1226+
schema:
1227+
type: object
1228+
properties:
1229+
dashboards:
1230+
type: array
1231+
items:
1232+
type: object
1233+
properties:
1234+
key:
1235+
type: string
1236+
description: Dashboard identifier (e.g. "overview", "llm")
1237+
title:
1238+
type: string
1239+
description: Dashboard display title
1240+
widgets:
1241+
type: array
1242+
items:
1243+
type: object
1244+
properties:
1245+
id:
1246+
type: string
1247+
description: Widget identifier
1248+
title:
1249+
type: string
1250+
description: Widget display title
1251+
query:
1252+
type: string
1253+
description: The TRQL query this widget executes
1254+
type:
1255+
type: string
1256+
enum: [bignumber, chart, table]
1257+
description: Widget display type
1258+
"401":
1259+
description: Unauthorized - API key is missing or invalid
1260+
tags:
1261+
- query
1262+
security:
1263+
- secretKey: []
1264+
x-codeSamples:
1265+
- lang: curl
1266+
label: cURL
1267+
source: |-
1268+
curl "https://api.trigger.dev/api/v1/query/dashboards" \
1269+
-H "Authorization: Bearer tr_dev_1234"
1270+
11511271
"/api/v1/runs/{runId}/reschedule":
11521272
parameters:
11531273
- $ref: "#/components/parameters/runId"

0 commit comments

Comments
 (0)