Skip to content

Commit f19b308

Browse files
authored
Merge pull request #3039 from modelcontextprotocol/v2/feat/3032-events-cli-mcpdo-tui
feat(events): CLI, mcpdo and TUI support for the Events extension (#3032)
2 parents 2ca5059 + 15004f3 commit f19b308

31 files changed

Lines changed: 3869 additions & 22 deletions

‎clients/cli/README.md‎

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,15 @@ Options that specify the MCP server (catalog/config file, ad-hoc command/URL, en
133133

134134
| Option | Description |
135135
| ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
136-
| `--method <method>` | MCP method to invoke. Supports `initialize` (connect-only probe → `{serverInfo, protocolVersion, capabilities, instructions}`), `tools/list`, `tools/call`, `resources/list`, `resources/read`, `resources/templates/list`, `prompts/list`, `prompts/get`, `logging/setLevel`, `skills/list`, `skills/get`, `resources/directory/read`, plus catalog-only `servers/list` / `servers/show` and `servers/add` / `servers/edit` / `servers/remove` (no MCP connect; see [Editing the server catalog](#editing-the-server-catalog)). Stream / session-only methods (e.g. `logging/tail`) are rejected. |
136+
| `--method <method>` | MCP method to invoke. Supports `initialize` (connect-only probe → `{serverInfo, protocolVersion, capabilities, instructions}`), `tools/list`, `tools/call`, `resources/list`, `resources/read`, `resources/templates/list`, `prompts/list`, `prompts/get`, `logging/setLevel`, `skills/list`, `skills/get`, `resources/directory/read`, `events/list`, `events/poll` (see [Events](#events-eventslist-eventspoll)), plus catalog-only `servers/list` / `servers/show` and `servers/add` / `servers/edit` / `servers/remove` (no MCP connect; see [Editing the server catalog](#editing-the-server-catalog)). Stream / session-only methods (e.g. `logging/tail`) are rejected. |
137137
| `--rename <name>` | New name for the entry, with `--method servers/edit` only. Secrets stored under the old name move with it. |
138138
| `--tool-name <name>` | Tool name (for `tools/call`). |
139139
| `--tool-arg <key=value>` | Tool argument; repeat for multiple. Use `key='{"json":true}'` for JSON. Values are coerced (JSON-parsed, so `count=1` becomes a number). |
140140
| `--tool-args-json <json>` | Tool arguments as a single JSON object (e.g. `'{"zip":"10001"}'`). Passed verbatim — no `key=value` coercion, so `"012"` stays a string. Mutually exclusive with `--tool-arg`. |
141141
| `--uri <uri>` | Resource URI (`resources/read`), directory URI (`resources/directory/read`), or skill URI (`skills/get`). |
142-
| `--cursor <cursor>` | Opaque pagination cursor for `resources/directory/read` — pass back the `nextCursor` from the previous page. The listing is not recursive and pages are not aggregated: SEP-2640 gives the cursor to the client, and descending is the caller's job. |
142+
| `--cursor <cursor>` | Opaque pagination cursor for `resources/directory/read` — pass back the `nextCursor` from the previous page. The listing is not recursive and pages are not aggregated: SEP-2640 gives the cursor to the client, and descending is the caller's job. For `events/poll`, the subscription position: pass back the `cursor` the previous poll returned; omitted, the poll starts from now. |
143+
| `--event-name <name>` | Event type name (for `events/poll`). |
144+
| `--event-arg <key=value>` | Event subscription argument (for `events/poll`); repeat for multiple. Values are coerced like `--tool-arg`. An argument the event type annotates with `x-mcp-header` is also sent as its `Mcp-Param-*` header. |
143145
| `--prompt-name <name>` | Prompt name (for `prompts/get`). |
144146
| `--prompt-args <key=value>` | Prompt arguments; repeat for multiple. Values are sent verbatim as strings (`price=1.50` sends `"1.50"`; `q=` sends `""`). |
145147
| `--log-level <level>` | Logging level for `logging/setLevel` (e.g. `debug`, `info`). |
@@ -1257,6 +1259,37 @@ covers:
12571259
A read failure is recorded against the file it happened on and the walk
12581260
continues, so one unreadable file never hides the findings after it.
12591261

1262+
### Events (`events/list`, `events/poll`)
1263+
1264+
The [Events extension](https://modelcontextprotocol.io/extensions/events/overview)
1265+
(`io.modelcontextprotocol/events`, SEP-3415) lets a server publish event types a
1266+
client subscribes to. It exists only on the 2026-07-28 protocol and later, so it
1267+
needs `--protocol-era modern` (or a catalog entry with `protocolEra: "modern"`).
1268+
Against a server that does not advertise it, or on a legacy connection, both
1269+
methods fail with exit `1` and code `events_unsupported` without sending
1270+
anything.
1271+
1272+
```bash
1273+
# Every event type, across all pages. `excluded` names the types the CLI left
1274+
# out because their x-mcp-header annotations are invalid, with the reason.
1275+
mcp-inspector --cli https://example.com/mcp --protocol-era modern \
1276+
--method events/list
1277+
1278+
# One poll. The result is printed whole: `events`, the `cursor` to pass back
1279+
# next time, `hasMore` (poll again now) and `nextPollMs` (when to poll next).
1280+
mcp-inspector --cli https://example.com/mcp --protocol-era modern \
1281+
--method events/poll --event-name deploy.completed \
1282+
--event-arg region=us-west1 --cursor "$CURSOR"
1283+
```
1284+
1285+
`events/poll` is a single request, not a poll loop: a script drives the loop by
1286+
passing each result's `cursor` back as `--cursor`. Without `--cursor` the poll
1287+
starts from now (`cursor: null`), so it returns nothing that happened before it.
1288+
An unknown name, a type the CLI excluded, or a type that does not advertise
1289+
`poll` delivery is a usage error (exit `1`). Push delivery (`events/stream`) is a
1290+
long-lived subscription and is not a one-shot method; use
1291+
[`mcpdo events/stream`](../mcpdo/README.md) for it.
1292+
12601293
## Exit codes & error envelopes
12611294

12621295
Every non-zero exit maps to a stable failure class, so a programmatic caller

0 commit comments

Comments
 (0)