Skip to content

Commit 8af8c2e

Browse files
os-trumpclaude
andauthored
docs(mcp): correct MCPServerPlugin's docblock to the canonical stdio switch (#15067)
* docs(mcp): correct MCPServerPlugin's docblock to the canonical stdio switch The class docblock still taught the pre-split trigger: step 2 said the long-lived stdio transport starts "only when `autoStart` is enabled or `OS_MCP_SERVER_ENABLED` is explicitly `true`", and the Environment Variables block said explicit `true` "additionally auto-starts the stdio transport". Neither named `OS_MCP_STDIO_ENABLED` — the canonical switch `resolveMcpStdioAutoStart()` reads first — about 100 lines above a runtime warning telling the operator that exact trigger is DEPRECATED. Comments only; no behaviour change. The deprecation sentence is copied verbatim from the runtime warning below it so the two cannot drift into two phrasings of the same rule. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza * docs(mcp): add changeset for the MCPServerPlugin docblock correction The docblock is a published surface, measured rather than assumed: `MCPServerPlugin` is exported from the package entry, root tsup config has `dts` emit on, and packages/mcp's `files` ships `dist` — so the comment reaches consumers as `dist/index.d.ts` and renders in editor IntelliSense. That makes it user-visible, so a changeset is owed and `skip-changeset` does not apply. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent be41618 commit 8af8c2e

2 files changed

Lines changed: 47 additions & 3 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
"@objectstack/mcp": patch
3+
---
4+
5+
docs(mcp): correct `MCPServerPlugin`'s docblock to the canonical stdio switch (#14473)
6+
7+
The class docblock still taught the **pre-split** stdio trigger. Step 2 said the
8+
long-lived transport starts "only when `autoStart` is enabled or
9+
`OS_MCP_SERVER_ENABLED` is explicitly `true`", and the Environment Variables
10+
block said explicit `true` "additionally auto-starts the stdio transport".
11+
Neither named `OS_MCP_STDIO_ENABLED` — the canonical switch — anywhere.
12+
13+
About 100 lines below it, the code says the opposite. `resolveMcpStdioAutoStart()`
14+
reads `OS_MCP_STDIO_ENABLED` first and returns it clean; `OS_MCP_SERVER_ENABLED=true`
15+
falls through to a legacy branch flagged `viaDeprecatedAlias`, and `start()` warns
16+
that this trigger is DEPRECATED. So an author following the docblock got a working
17+
transport **plus a deprecation warning at every boot**, with no way from this file
18+
to learn the right spelling.
19+
20+
This is a published surface, not an internal note: `MCPServerPlugin` is exported
21+
from the package entry, `dts` emit is on, and `files` ships `dist` — so the
22+
docblock reaches consumers as `dist/index.d.ts` and renders in editor
23+
IntelliSense. It had already cost something once: the published
24+
`skills/objectstack-ai` MCP section was written from this docblock and inherited
25+
the same error, caught in contract review and fixed in PR #14463.
26+
27+
Now:
28+
29+
- **step 2** — starts "only when `autoStart` is enabled or `OS_MCP_STDIO_ENABLED`
30+
is truthy";
31+
- **Environment Variables**`OS_MCP_SERVER_ENABLED` is described as the
32+
default-on **HTTP** gate only; `OS_MCP_STDIO_ENABLED` is listed as the stdio
33+
transport's own switch (default OFF); and the legacy trigger is marked
34+
deprecated **in the runtime warning's own words**, copied verbatim from the
35+
`ctx.logger.warn` below rather than paraphrased, so the two cannot drift into
36+
two phrasings of one rule.
37+
38+
Comments only — no behaviour change.

packages/mcp/src/plugin.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,21 @@ export interface MCPServerPluginOptions {
111111
* 1. **init** — Creates {@link MCPServerRuntime} and registers as `'mcp'` service.
112112
* 2. **start** — Bridges ToolRegistry, MetadataService, DataEngine, and Agents
113113
* to the MCP server. Starts the long-lived transport (stdio) only when
114-
* `autoStart` is enabled or `OS_MCP_SERVER_ENABLED` is explicitly `true`
114+
* `autoStart` is enabled or `OS_MCP_STDIO_ENABLED` is truthy
115115
* the HTTP surface needs no start: the runtime dispatcher serves it
116116
* per-request at `/api/v1/mcp` (default-on; `OS_MCP_SERVER_ENABLED=false`
117117
* opts out — see `isMcpServerEnabled` in `@objectstack/types`).
118118
* 3. **destroy** — Stops the MCP transport.
119119
*
120120
* Environment Variables:
121-
* - `OS_MCP_SERVER_ENABLED` — HTTP surface default-on; `false` disables it,
122-
* explicit `true` additionally auto-starts the stdio transport
121+
* - `OS_MCP_SERVER_ENABLED` — gates the default-on HTTP surface only; `false`
122+
* disables it (see `isMcpServerEnabled` in `@objectstack/types`)
123+
* - `OS_MCP_STDIO_ENABLED` — the long-lived stdio transport's own switch,
124+
* default OFF (see `resolveMcpStdioAutoStart` in `@objectstack/types`).
125+
* Starting the stdio transport via `OS_MCP_SERVER_ENABLED=true` is
126+
* DEPRECATED — that var now only gates the default-on HTTP surface. Use
127+
* `OS_MCP_STDIO_ENABLED=true` (or the plugin `autoStart` option) for the
128+
* long-lived stdio transport.
123129
* - `OS_MCP_SERVER_NAME` — Override server name
124130
* - `OS_MCP_SERVER_TRANSPORT` — Override transport ('stdio' | 'http')
125131
* (legacy `MCP_SERVER_*` names still honoured with a deprecation warning)

0 commit comments

Comments
 (0)