Skip to content

Commit 9990f97

Browse files
committed
docs(spec, service-automation): the credential-rejected marker and the rejected row also cover an mcp listing that withholds an included tool
ConnectorCredentialRejectedError's TSDoc and its status member, and the sys_connector_credential status description, named only a 401 / 403. The mcp provider now also raises the marker (status 403) for a server that accepted the credential and did not list a tool the instance's include names, so each text names that case too. Comments only in spec. Claude-Session: https://claude.ai/code/session_017xRBcVBKAFk1ntXSjvPt7U Co-authored-by: Claude <noreply@anthropic.com>
1 parent f4b220a commit 9990f97

3 files changed

Lines changed: 19 additions & 5 deletions

File tree

‎.changeset/28311-mcp-include-scope-hidden-tools.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
'@objectstack/connector-mcp': patch
3+
'@objectstack/service-automation': patch
34
---
45

56
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
@@ -12,3 +13,4 @@ Some MCP servers list only the tools the credential they are sent may use: GitHu
1213
- **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.
1314
- **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.
1415
- **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.
16+
- **Where it reads.** The `sys_connector_credential.status` field description (`@objectstack/service-automation`) now names this second way a stored credential becomes `rejected`.

‎packages/services/service-automation/src/sys-connector-credential.object.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export const SysConnectorCredential = ObjectSchema.create({
104104
required: true,
105105
defaultValue: 'set',
106106
description:
107-
"`set` when a value is stored; `rejected` when an upstream refused it (an instance's materialization or call answered 401 / 403). Back to `set` only when the value is set again or a provider proves it while materializing (mcp); a call answered 2xx does not, since the endpoint may not check the credential. A reference no source answers for is `missing` in the listing and has no row.",
107+
"`set` when a value is stored; `rejected` when an upstream refused it (an instance's materialization or call answered 401 / 403, or an MCP server it was sent to did not list a tool the instance's `include` names). Back to `set` only when the value is set again or a provider proves it while materializing (mcp); a call answered 2xx does not, since the endpoint may not check the credential. A reference no source answers for is `missing` in the listing and has no row.",
108108
}),
109109

110110
status_reason: Field.textarea({

‎packages/spec/src/integration/connector-provider-errors.ts‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,30 @@ export function isConnectorUpstreamUnavailable(err: unknown): boolean {
7878
* message — never the value. A value from an environment variable or the
7979
* host's resolver can change where the process cannot see it, so its instance
8080
* is retried on the backoff.
81+
*
82+
* An upstream that accepts the credential but answers it with less than the
83+
* instance declares is the same outcome: an MCP server that lists only the
84+
* tools a credential may use, and so leaves out a tool the instance's
85+
* `include` names, is answered with this marker by the `mcp` provider.
8186
*/
8287
export const CONNECTOR_CREDENTIAL_REJECTED = 'CONNECTOR_CREDENTIAL_REJECTED' as const;
8388

8489
/**
8590
* Thrown by a connector provider factory when the upstream it contacted to
86-
* materialize an instance refused the credential it sent (HTTP 401 / 403).
87-
* Carries {@link CONNECTOR_CREDENTIAL_REJECTED} as its `code` and the HTTP
88-
* status. ⛔ The message must not carry the credential.
91+
* materialize an instance refused the credential it sent (HTTP 401 / 403), or
92+
* accepted it and withheld what the instance declares (see
93+
* {@link CONNECTOR_CREDENTIAL_REJECTED}). Carries
94+
* {@link CONNECTOR_CREDENTIAL_REJECTED} as its `code` and the HTTP status.
95+
* ⛔ The message must not carry the credential.
8996
*/
9097
export class ConnectorCredentialRejectedError extends Error {
9198
readonly code = CONNECTOR_CREDENTIAL_REJECTED;
92-
/** The upstream's HTTP status: 401 or 403. */
99+
/**
100+
* The upstream's HTTP status: 401 or 403. For an upstream that answered
101+
* `2xx` and withheld what the instance declares, 403: the status a
102+
* credential short of the scopes a resource needs is answered with
103+
* (RFC 6750 §3.1, `insufficient_scope`).
104+
*/
93105
readonly status: number;
94106
/** The underlying failure, kept for diagnostics. */
95107
readonly cause?: unknown;

0 commit comments

Comments
 (0)