Skip to content
19 changes: 19 additions & 0 deletions .changeset/34167-skill-mcp-opt-out.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
'@objectstack/spec': minor
'@objectstack/mcp': minor
---

feat(spec, mcp): a skill written for the in-product agents only opts out of MCP prompt projection with `mcpPrompt: false`

Clause-②: yes (widening)
Metadata-protocol: added

`SkillSchema` gains an optional boolean, `mcpPrompt`. A skill that sets `mcpPrompt: false` is never offered as an MCP prompt: `prompts/list` leaves it out and `prompts/get` answers it exactly as it answers an unknown prompt name. This holds on every MCP connection, the per-request HTTP endpoint and the long-lived stdio server alike, and whatever the skill's `tools` binding, including on a connection that serves every tool it binds.

The binding test (a skill is offered only where the connection serves every tool it binds) answers whether a connection can run a playbook. It cannot tell whether the playbook is written for MCP. A skill can bind tools MCP serves under the same names, such as `create_record` and `update_record`, or `action_*` through `run_action`, and still tell the model to call in-product tools and wait for the in-product approval card, which an MCP client does not have. The skill's owner now says so on the skill.

The stdio server takes its prompt list once, at boot. A skill saved with `mcpPrompt: false` while it runs stays on that list until restart, as any skill saved after boot is missing from it, but its `prompts/get` answers it as unknown at once.

A skill without the key, or with `mcpPrompt: true`, is offered exactly as before, and nothing parses differently: the key has no default. The key changes nothing on the in-product agent runtime, which resolves, binds and activates the skill as it did, and the authoring checks on `tools` and `surface` report the same findings. The skill form does not offer the key: unset means offered, and the form's boolean switch would draw every offered skill as off, so `mcpPrompt` is authored in source or through the metadata API.

Nothing to migrate.
14 changes: 13 additions & 1 deletion content/docs/ai/agents.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ itself (a different LLM-facing description, fewer exposed parameters).

| Half | Keys | Where it runs |
|---|---|---|
| **Judgment** | `instructions` | **Both editions.** On the open framework `@objectstack/mcp` serves it as an MCP **prompt** — a connected client can `prompts/list` it by name and `prompts/get` the text ([Connect an MCP client](/docs/ai/connect-mcp#prompts-your-skills-served-to-the-client)), on a server that serves the tools the skill binds (below). On **ObjectOS** it is injected into the active agent's system prompt. |
| **Judgment** | `instructions`, `mcpPrompt` | **Both editions.** On the open framework `@objectstack/mcp` serves it as an MCP **prompt** — a connected client can `prompts/list` it by name and `prompts/get` the text ([Connect an MCP client](/docs/ai/connect-mcp#prompts-your-skills-served-to-the-client)), on a server that serves the tools the skill binds (below), unless the skill sets `mcpPrompt: false`. On **ObjectOS** it is injected into the active agent's system prompt. |
| **Wiring** | `tools`, `surface`, `triggerConditions` | **Bound on ObjectOS only.** Composing an agent's tool set and deciding when a skill activates are properties of an in-product agent loop. Over MCP the model lives in the client and drives one flat tool list, and your AI-exposed Actions already reach it through `list_actions` / `run_action`. `surface` and `triggerConditions` are inert there; `tools` is read, and decides whether the skill is offered. |

**Over MCP, `tools` decides whether the skill is offered.** The prompt surface
Expand All @@ -270,6 +270,18 @@ applies no such filter. So bind a skill only to tools its intended connections
serve: one that names a tool no MCP tool family serves is offered on no such
connection unless a host registers that tool.

**A skill written only for the in-product agents opts out of MCP with
`mcpPrompt: false`.** Its instructions may assume the in-product tool set or
the in-product approval card even when every tool it binds is one MCP serves
too. With `mcpPrompt: false` the skill is never listed by `prompts/list` and is
unknown to `prompts/get`, on every MCP connection, stdio included, whatever its
`tools`. The stdio server takes its list once, at boot: a skill switched to
`false` while it runs stays listed until restart, but `prompts/get` answers it
as unknown at once.
Absent or `true`, it is offered as described above. ObjectOS reads the
skill exactly as before: the key decides MCP projection and nothing else
([Connect an MCP client](/docs/ai/connect-mcp#prompts-your-skills-served-to-the-client)).

Both halves are still **validated everywhere** — a skill naming a tool that
does not exist is an authoring error in either distribution. So a skill written
against the open framework keeps its full meaning when the app runs on
Expand Down
25 changes: 25 additions & 0 deletions content/docs/ai/connect-mcp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,31 @@ offered as before. When a prompt you expect is missing, connect with a grant
that registers the skill's tools, or bind the skill only to tools its intended
connections serve.

**A skill written for the in-product agents opts out.** The binding answers
whether a connection *can* run a playbook, not whether the playbook is written
for MCP: a skill can bind tools MCP serves under the same names
(`create_record`, `action_*` through `run_action`) and still tell the model to
call in-product tools or wait for the in-product approval card. Set
`mcpPrompt: false` on such a skill and it is never offered as a prompt:
`prompts/list` leaves it out and `prompts/get` answers it as an unknown prompt
name, on every connection (HTTP and stdio) and whatever its `tools`. (The
stdio server lists its prompts once, at boot, so a skill switched to
`mcpPrompt: false` while it runs stays listed until restart; its `prompts/get`
answers unknown at once.) Leave the key out, or set `true`, and the skill is
offered as above. The key changes
nothing on the in-product runtime: the `ask` / `build` agents resolve, bind
and activate the skill exactly as before.

```typescript
export const RecordWritingSkill = defineSkill({
name: 'record_writing',
label: 'Record Writing',
instructions: 'Open the record, propose the change, and wait for the user to confirm on the card.',
tools: ['create_record', 'update_record'],
mcpPrompt: false, // written for the in-product agents only
});
```

**Only the instructions half projects.** A skill's `tools` / `surface` /
`triggerConditions` are bound by the **in-product agent runtime** (the `ask` /
`build` agents, cloud / Enterprise), which is the thing that composes a tool set
Expand Down
5 changes: 3 additions & 2 deletions content/docs/references/ai/skill.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ const result = SkillSchema.parse(data);
| **label** | `string` | ✅ | Skill display name |
| **description** | `string` | optional | Skill description |
| **surface** | `Enum<'ask' \| 'build' \| 'both'>` | optional (default: `"ask"`) | Agent surface this skill binds to ('ask' \| 'build' \| 'both') — ADR-0063 §3; read by the cloud agent runtime only |
| **instructions** | `string` | optional | LLM instructions when skill is active — also served as an MCP prompt |
| **tools** | `string[]` | ✅ | Tool names belonging to this skill (supports trailing wildcard, e.g. `action_*`) — bound by the cloud agent runtime; an MCP server whose prompts `registerSkillPrompts` installs offers the skill only when it serves every tool named here (an `action_` entry also through `run_action`) |
| **instructions** | `string` | optional | LLM instructions when skill is active — also served as an MCP prompt unless mcpPrompt is false |
| **tools** | `string[]` | ✅ | Tool names belonging to this skill (supports trailing wildcard, e.g. `action_*`) — bound by the cloud agent runtime; an MCP server whose prompts `registerSkillPrompts` installs offers the skill only when it serves every tool named here (an `action_` entry also through `run_action`); `mcpPrompt: false` withholds it from MCP whatever this binding |
| **triggerConditions** | `{ field: string; operator: Enum<'eq' \| 'neq' \| 'in' \| 'not_in' \| 'contains'>; value: string \| string[] }[]` | optional | Programmatic activation conditions — evaluated by the cloud agent runtime only |
| **active** | `boolean` | optional (default: `true`) | Whether the skill is enabled |
| **mcpPrompt** | `boolean` | optional | Whether this skill is offered as an MCP prompt. false = written for the in-product agents only: never listed by prompts/list and unknown to prompts/get on any MCP connection, whatever its tools binding. Absent or true = offered where the server serves its tools |
| **protection** | `{ lock: Enum<'none' \| 'no-overlay' \| 'no-delete' \| 'full'>; reason: string; docsUrl?: string }` | optional | Package author protection block — lock policy for this skill. |
| **_lock** | `Enum<'none' \| 'no-overlay' \| 'no-delete' \| 'full'>` | optional | Item-level lock — controls overlay & delete (ADR-0010). |
| **_lockReason** | `string` | optional | Human-readable reason shown when a write is refused by _lock. |
Expand Down
15 changes: 15 additions & 0 deletions packages/lint/src/validate-ai-surface-affinity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,21 @@ describe('validate-ai-surface-affinity', () => {
expect(findings[0].message).toContain("'build'");
});

it('reads a skill its owner keeps out of MCP (mcpPrompt: false) exactly as one without the key (#34167)', () => {
// The opt-out narrows MCP prompt projection only; the in-product binding
// this rule guards is the same either way.
const stack = (mcpPrompt?: boolean) => ({
agents: [{ name: 'helper', surface: 'ask', skills: ['metadata_authoring', 'record_writing'] }],
skills: [
{ name: 'metadata_authoring', surface: 'build', tools: [], ...(mcpPrompt === undefined ? {} : { mcpPrompt }) },
{ name: 'record_writing', surface: 'ask', tools: ['create_record'], ...(mcpPrompt === undefined ? {} : { mcpPrompt }) },
],
});
const undeclared = validateAiSurfaceAffinity(stack());
expect(undeclared).toHaveLength(1);
expect(validateAiSurfaceAffinity(stack(false))).toEqual(undeclared);
});

it("flags a 'build' agent referencing an 'ask' skill (symmetric)", () => {
const stack = {
agents: [{ name: 'builder', surface: 'build', skills: ['data_explorer'] }],
Expand Down
17 changes: 17 additions & 0 deletions packages/lint/src/validate-ai-tool-references.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,23 @@ describe('validate-ai-tool-references', () => {
]);
});

it('checks the tools of a skill its owner keeps out of MCP (mcpPrompt: false) exactly as without the key (#34167)', () => {
// The opt-out narrows MCP prompt projection only: the binding is still the
// in-product agent's tool set, and still checked in both distributions.
const stack = (mcpPrompt?: boolean) => ({
skills: [
{
name: 'record_writing',
tools: ['create_record', 'update_record', 'open_record_card'],
...(mcpPrompt === undefined ? {} : { mcpPrompt }),
},
],
});
const undeclared = validateAiToolReferences(stack());
expect(undeclared).toHaveLength(1);
expect(validateAiToolReferences(stack(false))).toEqual(undeclared);
});

it('resolves declared stack.tools records (the optional refinement layer)', () => {
const stack = {
tools: [{ name: 'quote_discount', label: 'Quote', description: 'x' }],
Expand Down
21 changes: 18 additions & 3 deletions packages/mcp/src/mcp-server-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import {
skillPromptListEntry,
skillPromptRefusalError,
skillPromptResult,
skillPromptWithdrawn,
type McpSkillBridge,
type SkillPrompt,
} from './skill-prompts.js';
Expand Down Expand Up @@ -2464,11 +2465,25 @@ export class MCPServerRuntime {
},
async () => {
// Re-read at call time so an edited skill serves fresh instructions.
const lookup = lookupSkillPrompt(await listSkillPrompts(skillBridge), entry.face);
// One read: the projection and the withdrawal check below see the same rows.
const rows = (await skillBridge.listSkills()) ?? [];
const lookup = lookupSkillPrompt(
await listSkillPrompts({ ...skillBridge, listSkills: async () => rows }),
entry.face,
);
if (lookup.status === 'refused') throw skillPromptRefusalError(lookup);
if (lookup.status === 'found') return skillPromptResult(lookup.prompt);
// Gone since the snapshot: the snapshot's one skill, as before.
if (entry.prompts.length === 1) return skillPromptResult(entry.prompts[0]);
if (entry.prompts.length === 1) {
// [#34167] Withdrawn since the snapshot (`mcpPrompt: false`):
// answered as the SDK answers a name it never registered. This
// server's list is a boot snapshot and keeps the name until
// restart; the get stops serving it at once.
if (skillPromptWithdrawn(rows, entry.prompts[0])) {
throw new McpError(ErrorCode.InvalidParams, `Prompt ${entry.face} not found`);
}
// Gone since the snapshot: the snapshot's one skill, as before.
return skillPromptResult(entry.prompts[0]);
}
throw skillPromptRefusalError({
status: 'refused',
message: duplicateSkillFaceMessage(entry),
Expand Down
Loading
Loading