Skip to content

Commit f4b220a

Browse files
committed
test(connector-mcp): pin the credential path for an include a credentialed server hides, with docs and changeset
The three probes as permanent tests, on the real provider and materializer and the real credential store (ObjectQL over SQLite): an environment credential degrades the instance instead of failing the boot and recovers once the scopes cover the tools; a stored credential is marked rejected and held, and a better-scoped value recovers it without a restart; with no credential the boot still fails as a declaration fault. Claude-Session: https://claude.ai/code/session_017xRBcVBKAFk1ntXSjvPt7U Co-authored-by: Claude <noreply@anthropic.com>
1 parent 25af2c9 commit f4b220a

5 files changed

Lines changed: 394 additions & 6 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@objectstack/connector-mcp': patch
3+
---
4+
5+
fix(connector-mcp): when a server that was sent the instance's credential does not list an `include`d tool, the instance is degraded as a credential refusal instead of failing the boot as a declaration fault
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
Some MCP servers list only the tools the credential they are sent may use: GitHub's hides each tool a classic personal access token's scopes do not cover. Its `tools/list` answer says nothing about what it hid, so a tool missing from it may be hidden from this credential or may not exist on the server at all.
11+
12+
- **Before.** When `providerConfig.include` named a tool the server did not list, the `mcp` provider refused with a plain configuration fault in every case. With the credential in an environment variable, the whole boot failed. With a credential stored through the credential door, the instance was degraded with a reason telling the administrator to fix the app's declaration.
13+
- **Now.** When the handshake carried the instance's `auth` credential (an `http` transport, the credential sent as a header), the refusal is a `ConnectorCredentialRejectedError` with status `403`. Its message names the missing tools and the tools the server does list for that credential, and it names both causes with the fix for each: give the credential the scopes those tools need and set it again, or fix `providerConfig.include`. The materializer handles it as it handles a `401` / `403`: the instance is degraded and the boot does not fail. A stored credential is marked `rejected` and held until it is set again; an environment or vault credential is retried on the backoff, so widening the token's scopes where it was issued recovers the instance without a restart.
14+
- **Unchanged.** An instance whose handshake carried no credential (no `auth`, an `api-key` sent as a query parameter, or a `stdio` transport) keeps the plain configuration fault, fatal at boot, with the same message as before.

‎content/docs/automation/connectors.mdx‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,16 @@ keep a destructive tool away from your flows and agents. It must be an array of
237237
tool names; any other shape (a string such as `include: 'web_search'`, an
238238
object) fails the boot before connecting, and never falls back to exposing
239239
every tool. An entry the server's `tools/list` does not carry — a typo, or a
240-
tool the server renamed or dropped — fails the boot with an error naming the
241-
entry and listing the server's tools; it is never ignored. Leave `include` out
242-
to expose every tool.
240+
tool the server renamed or dropped — is never ignored: the refusal names the
241+
entry and lists the server's tools. On an instance that sends no credential it
242+
fails the boot. When the instance sends its `auth` credential, the entry may
243+
instead be a tool the server hides from that credential: some servers list
244+
only the tools a credential is allowed to use (GitHub's hides each tool a
245+
classic token's scopes do not cover), and the answer does not say what it hid.
246+
That instance is degraded as a credential the upstream refuses (below), never
247+
failing the boot, and its reason names both causes: a credential without the
248+
scopes those tools need, or a declaration naming a tool the server does not
249+
have. Leave `include` out to expose every tool.
243250

244251
<Callout type="warn">
245252
**Declarative stdio transports are denied by default.** Materializing one
@@ -365,7 +372,9 @@ plus a `credentialNote` naming the ones still to set.
365372

366373
**A credential the upstream refuses** (HTTP `401` / `403`) degrades the
367374
instance, with a reason quoting the upstream's message, never the value. An
368-
`mcp` instance finds this out when it connects. A `rest` or `openapi` instance
375+
`mcp` instance finds this out when it connects, and treats a server that
376+
accepts the credential but does not list a tool its `include` names the same
377+
way. A `rest` or `openapi` instance
369378
finds out on the first call answering `401` / `403`; that call returns its
370379
answer as usual, and the instance is degraded after it. What happens next
371380
depends on where the value came from:
@@ -591,11 +600,11 @@ retry):
591600
| `auth` is a grant-bearing kind (`oauth2`, `app-credential`) on a server that does not yet run its per-dispatch resolution | **Not fatal**: the instance registers **degraded**, naming the kind, and the upstream is never called without its credential; a datasource borrowing it is refused with `422` |
592601
| `auth` is `signed` on a provider that does not say it applies the request signer | **Hard boot error** naming the instance, the scheme and the provider: its calls would go out unsigned — declare it through `rest` or `openapi` |
593602
| `credentialRef` resolves to nothing | **Not fatal**: the instance registers **degraded**, naming the reference — set it (`PUT …/credential-refs/:ref`), and it materializes without a restart |
594-
| The upstream refuses the credential (`401` / `403`) | **Not fatal**: the instance registers **degraded**. A stored credential is marked `rejected` and waits until it is set again (or a restart); an environment or vault credential is retried on the backoff |
603+
| The upstream refuses the credential (`401` / `403`), or an `mcp` server sent the credential does not list a tool the instance's `include` names | **Not fatal**: the instance registers **degraded**. A stored credential is marked `rejected` and waits until it is set again (or a restart); an environment or vault credential is retried on the backoff |
595604
| Instance `name` collides with a plugin-registered connector | **Hard boot error** — there is no silent precedence between the two worlds |
596605
| stdio transport without host opt-in | **Hard boot error** with the `declarativeStdio` fix inline — a security rejection is never retried |
597606
| MCP server unreachable / `tools/list` fails; remote spec URL unreachable or transiently failing (408/429/5xx) | **Not fatal**: the instance registers **degraded** (visible on `GET /api/v1/automation/connectors` with the reason), dispatches fail with that reason, and the platform retries on a 5s→5min backoff — recovery is automatic |
598-
| A retry of a degraded instance reaches the upstream and meets a configuration fault (an `include` naming a tool or operation the upstream does not offer) | **Not fatal**: the instance stays **degraded**, now with the configuration reason, and is **not retried** — dispatches fail saying to edit its declaration; an edit of the entry (or a restart) re-attempts it |
607+
| A retry of a degraded instance reaches the upstream and meets a configuration fault (an `include` naming a tool or operation the upstream does not offer; on an `mcp` instance that sends a credential, the credential row above applies instead) | **Not fatal**: the instance stays **degraded**, now with the configuration reason, and is **not retried** — dispatches fail saying to edit its declaration; an edit of the entry (or a restart) re-attempts it |
599608
| Wrong spec URL (other 4xx) or unparseable document | Configuration fault — **hard boot error** |
600609
| A `connector_action` input that, once evaluated, breaks the action's `inputSchema` (a missing `required` parameter, a wrong `type`) | **The step fails before dispatch** with `VALIDATION_ERROR`, naming each parameter path, and nothing is sent; a `fault` edge or `try_catch` can route it. Supply the parameter or send the declared type: text is never converted, so cast it in a CEL envelope (`int()`, `double()`, `bool()`). `GET /api/v1/automation/connectors` lists the schema; `os validate` does not judge the input against the `inputSchema` yet |
601610
| A bad entry arrives via **runtime reload** (a Studio publish, a direct active save through `PUT /api/v1/meta/connector/:name`, or a delete, made on any replica — peers reconcile on [cluster lane 2](/docs/kernel/cluster#62-the-cluster-invalidation-family); or a dev reload) | Logged and **skipped**, never crashing the live server; a changed instance's old connector keeps serving until its replacement materializes |

‎packages/connectors/connector-mcp/package.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
"@objectstack/spec": "workspace:*"
3333
},
3434
"devDependencies": {
35+
"@objectstack/driver-sql": "workspace:*",
36+
"@objectstack/objectql": "workspace:*",
37+
"@objectstack/platform-objects": "workspace:*",
3538
"@objectstack/service-automation": "workspace:*",
3639
"@types/node": "^26.6.5",
3740
"typescript": "^6.0.3",

0 commit comments

Comments
 (0)