conductor-node-mcp 14.24.3 → 15.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/README.md +2 -2
  2. package/agent-errors.d.mts +3 -0
  3. package/agent-errors.d.mts.map +1 -0
  4. package/agent-errors.d.ts +3 -0
  5. package/agent-errors.d.ts.map +1 -0
  6. package/agent-errors.js +97 -0
  7. package/agent-errors.js.map +1 -0
  8. package/agent-errors.mjs +93 -0
  9. package/agent-errors.mjs.map +1 -0
  10. package/code-tool-worker.d.mts.map +1 -1
  11. package/code-tool-worker.d.ts.map +1 -1
  12. package/code-tool-worker.js +3 -0
  13. package/code-tool-worker.js.map +1 -1
  14. package/code-tool-worker.mjs +3 -0
  15. package/code-tool-worker.mjs.map +1 -1
  16. package/code-tool.d.mts.map +1 -1
  17. package/code-tool.d.ts.map +1 -1
  18. package/code-tool.js +73 -14
  19. package/code-tool.js.map +1 -1
  20. package/code-tool.mjs +73 -14
  21. package/code-tool.mjs.map +1 -1
  22. package/http.d.mts.map +1 -1
  23. package/http.d.ts.map +1 -1
  24. package/http.js +38 -22
  25. package/http.js.map +1 -1
  26. package/http.mjs +37 -21
  27. package/http.mjs.map +1 -1
  28. package/local-docs-search.js +55 -55
  29. package/local-docs-search.js.map +1 -1
  30. package/local-docs-search.mjs +55 -55
  31. package/local-docs-search.mjs.map +1 -1
  32. package/oauth.d.mts +26 -0
  33. package/oauth.d.mts.map +1 -0
  34. package/oauth.d.ts +26 -0
  35. package/oauth.d.ts.map +1 -0
  36. package/oauth.js +446 -0
  37. package/oauth.js.map +1 -0
  38. package/oauth.mjs +433 -0
  39. package/oauth.mjs.map +1 -0
  40. package/package.json +32 -2
  41. package/server.d.mts +2 -1
  42. package/server.d.mts.map +1 -1
  43. package/server.d.ts +2 -1
  44. package/server.d.ts.map +1 -1
  45. package/server.js +7 -3
  46. package/server.js.map +1 -1
  47. package/server.mjs +7 -3
  48. package/server.mjs.map +1 -1
  49. package/src/agent-errors.ts +98 -0
  50. package/src/code-tool-worker.ts +3 -0
  51. package/src/code-tool.ts +78 -18
  52. package/src/http.ts +35 -30
  53. package/src/local-docs-search.ts +55 -55
  54. package/src/oauth.ts +540 -0
  55. package/src/server.ts +8 -3
  56. package/src/telemetry.ts +110 -0
  57. package/src/types.ts +4 -0
  58. package/telemetry.d.mts +18 -0
  59. package/telemetry.d.mts.map +1 -0
  60. package/telemetry.d.ts +18 -0
  61. package/telemetry.d.ts.map +1 -0
  62. package/telemetry.js +105 -0
  63. package/telemetry.js.map +1 -0
  64. package/telemetry.mjs +96 -0
  65. package/telemetry.mjs.map +1 -0
  66. package/types.d.mts +2 -0
  67. package/types.d.mts.map +1 -1
  68. package/types.d.ts +2 -0
  69. package/types.d.ts.map +1 -1
  70. package/types.js.map +1 -1
  71. package/types.mjs.map +1 -1
package/oauth.d.mts ADDED
@@ -0,0 +1,26 @@
1
+ import express from 'express';
2
+ export type OAuthResource = 'root' | 'read-only';
3
+ export interface OAuthResourceConfig {
4
+ authorizationServerUrl: string;
5
+ resourceUrl: string;
6
+ resourceMetadataUrl: string;
7
+ apiBaseUrl: string;
8
+ keyProbeEnabled: boolean;
9
+ }
10
+ export type CredentialShape = 'empty_bearer' | `scheme:${string}` | 'no_scheme:sk_conductor_' | 'no_scheme:other' | 'empty_custom_header';
11
+ type WwwAuthenticateError = 'invalid_token';
12
+ export declare function getOAuthResourceConfig(resource?: OAuthResource): OAuthResourceConfig;
13
+ export declare function buildProtectedResourceMetadata(config: OAuthResourceConfig): Record<string, unknown>;
14
+ export declare function mountProtectedResourceMetadata(app: express.Express): void;
15
+ export declare function buildWwwAuthenticate(config: OAuthResourceConfig, error?: WwwAuthenticateError, description?: string): string;
16
+ export declare function requireCredential(resource?: OAuthResource): express.RequestHandler;
17
+ export declare function authorizationShape(authorization: string): CredentialShape;
18
+ export type ClientPermissions = {
19
+ allow_http_gets?: boolean;
20
+ allowed_methods?: string[];
21
+ blocked_methods?: string[];
22
+ };
23
+ export declare function parseClientPermissions(header: string): ClientPermissions | null;
24
+ export declare function clearValidKeyCache(): void;
25
+ export {};
26
+ //# sourceMappingURL=oauth.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth.d.mts","sourceRoot":"","sources":["src/oauth.ts"],"names":[],"mappings":"AAgBA,OAAO,OAAO,MAAM,SAAS,CAAC;AAuC9B,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,WAAW,CAAC;AAEjD,MAAM,WAAW,mBAAmB;IAClC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAYD,MAAM,MAAM,eAAe,GACvB,cAAc,GACd,UAAU,MAAM,EAAE,GAClB,yBAAyB,GACzB,iBAAiB,GACjB,qBAAqB,CAAC;AAE1B,KAAK,oBAAoB,GAAG,eAAe,CAAC;AAO5C,wBAAgB,sBAAsB,CAAC,QAAQ,GAAE,aAAsB,GAAG,mBAAmB,CAgB5F;AAID,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQnG;AAED,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,GAAG,IAAI,CAezE;AAKD,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,mBAAmB,EAC3B,KAAK,CAAC,EAAE,oBAAoB,EAC5B,WAAW,CAAC,EAAE,MAAM,GACnB,MAAM,CAQR;AAKD,wBAAgB,iBAAiB,CAAC,QAAQ,GAAE,aAAsB,GAAG,OAAO,CAAC,cAAc,CAoD1F;AA0ED,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,eAAe,CAczE;AA0CD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAC;AAMF,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAkB/E;AAyDD,wBAAgB,kBAAkB,IAAI,IAAI,CAGzC"}
package/oauth.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ import express from 'express';
2
+ export type OAuthResource = 'root' | 'read-only';
3
+ export interface OAuthResourceConfig {
4
+ authorizationServerUrl: string;
5
+ resourceUrl: string;
6
+ resourceMetadataUrl: string;
7
+ apiBaseUrl: string;
8
+ keyProbeEnabled: boolean;
9
+ }
10
+ export type CredentialShape = 'empty_bearer' | `scheme:${string}` | 'no_scheme:sk_conductor_' | 'no_scheme:other' | 'empty_custom_header';
11
+ type WwwAuthenticateError = 'invalid_token';
12
+ export declare function getOAuthResourceConfig(resource?: OAuthResource): OAuthResourceConfig;
13
+ export declare function buildProtectedResourceMetadata(config: OAuthResourceConfig): Record<string, unknown>;
14
+ export declare function mountProtectedResourceMetadata(app: express.Express): void;
15
+ export declare function buildWwwAuthenticate(config: OAuthResourceConfig, error?: WwwAuthenticateError, description?: string): string;
16
+ export declare function requireCredential(resource?: OAuthResource): express.RequestHandler;
17
+ export declare function authorizationShape(authorization: string): CredentialShape;
18
+ export type ClientPermissions = {
19
+ allow_http_gets?: boolean;
20
+ allowed_methods?: string[];
21
+ blocked_methods?: string[];
22
+ };
23
+ export declare function parseClientPermissions(header: string): ClientPermissions | null;
24
+ export declare function clearValidKeyCache(): void;
25
+ export {};
26
+ //# sourceMappingURL=oauth.d.ts.map
package/oauth.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["src/oauth.ts"],"names":[],"mappings":"AAgBA,OAAO,OAAO,MAAM,SAAS,CAAC;AAuC9B,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,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Default = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getOAuthResourceConfig = getOAuthResourceConfig;
7
+ exports.buildProtectedResourceMetadata = buildProtectedResourceMetadata;
8
+ exports.mountProtectedResourceMetadata = mountProtectedResourceMetadata;
9
+ exports.buildWwwAuthenticate = buildWwwAuthenticate;
10
+ exports.requireCredential = requireCredential;
11
+ exports.authorizationShape = authorizationShape;
12
+ exports.parseClientPermissions = parseClientPermissions;
13
+ exports.clearValidKeyCache = clearValidKeyCache;
14
+ // Conductor patch: OAuth 2.1 resource-server behavior for the hosted MCP server
15
+ // (https://mcp.conductor.is/, its /mcp alias, and its read-only connector URL https://mcp.conductor.is/read-only). Claude, ChatGPT and other OAuth-capable MCP
16
+ // clients start sign-in only when a credential-less POST answers HTTP 401 with
17
+ // a WWW-Authenticate header that names this server's protected resource
18
+ // metadata (RFC 9728), which points at the authorization server (the
19
+ // dashboard). The server stays stateless and holds no secret: credentials pass
20
+ // through unchanged and the only validation is an upstream probe of the API on
21
+ // tools/call, which treats a key as dead only when the API's own JSON error
22
+ // envelope says so (api.conductor.is sits behind Cloudflare; an edge 401/403
23
+ // page must fail open). Every gate decision and every probe is logged as one
24
+ // structured line because http.ts redacts www-authenticate from Render logs.
25
+ // The URLs are hardcoded: every customer's connector stores them, so they
26
+ // never change. The rest of the config is read from non-MCP_SERVER_ env names
27
+ // (see code-tool.ts for why) with production defaults baked in.
28
+ const cors_1 = __importDefault(require("cors"));
29
+ const node_crypto_1 = require("node:crypto");
30
+ const logger_1 = require("./logger.js");
31
+ const methods_1 = require("./methods.js");
32
+ const telemetry_1 = require("./telemetry.js");
33
+ const util_1 = require("./util.js");
34
+ // A local end-to-end run edits these two temporarily (see the dashboard's src/lib/oauth/README.md).
35
+ const AUTHORIZATION_SERVER_URL = 'https://dashboard.conductor.is';
36
+ const RESOURCE_URL = 'https://mcp.conductor.is/';
37
+ const DEFAULT_API_BASE_URL = 'https://api.conductor.is/v1'; // conductor-node's own default (src/client.ts)
38
+ const PROTECTED_RESOURCE_METADATA_PATH = '/.well-known/oauth-protected-resource';
39
+ // The read-only connector URL. POST /read-only (Express also matches /read-only/) allows only reads (see
40
+ // forceReadOnlyPermissions; a guardrail, not a security boundary). Its identifier is
41
+ // `${origin}/read-only` with no trailing slash (hosted Claude strips one from a connector URL, and SDK 1.x
42
+ // clients refuse a metadata resource longer than the URL the user typed), and its RFC 9728 document sits at
43
+ // PROTECTED_RESOURCE_METADATA_PATH + READ_ONLY_PATH, which is what path insertion produces for it.
44
+ const READ_ONLY_PATH = '/read-only';
45
+ const KEY_PROBE_TIMEOUT_MS = 3000;
46
+ const KEY_PROBE_PATH = '/end-users/end_usr_oauth_probe'; // auth: "secret" route; 404 with a live key, 401 with a dead one
47
+ // The only codes apps/server emits as a 401/403 on the probe route for a presented non-empty Bearer key
48
+ // (context/auth-context.ts, services/api-key-service.ts, the SECRET_KEY_REQUIRED 403 for a publishable key).
49
+ // PAID_PLAN_REQUIRED applies only to QBD requests and HTTPS_REQUIRED only to http in production; neither reaches this route.
50
+ const KEY_PROBE_REJECTION_CODES = new Set(['API_KEY_INVALID', 'SECRET_KEY_REQUIRED']);
51
+ // A fixed, distinct User-Agent so the probe can be filtered by UA as well as by path (end_usr_oauth_probe) in Better Stack.
52
+ const KEY_PROBE_USER_AGENT = 'conductor-mcp-key-probe/1';
53
+ // Only tools/call is probed. initialize, tools/list, notifications and server/discover never contact the API, so the
54
+ // Betterstack initialize monitor keeps a dummy Bearer and connection checks stay instant. The guard test pins this line.
55
+ const PROBED_METHODS = new Set(['tools/call']);
56
+ // search_docs never contacts the API, so a call to it alone is not probed.
57
+ const UNPROBED_TOOLS = new Set(['search_docs']);
58
+ // A 'valid' verdict is reused for this long per key (keyed by its SHA-256, never the key), so a busy session
59
+ // pays one probe a minute instead of one per call. A key deleted in the dashboard keeps working here for up
60
+ // to a minute; 'invalid' and 'unknown' are never cached.
61
+ const VALID_KEY_CACHE_TTL_MS = 60_000;
62
+ const VALID_KEY_CACHE_MAX_ENTRIES = 10_000;
63
+ const validKeyCache = new Map(); // sha256(token) -> expiry, insertion-ordered
64
+ // Parallel calls with the same uncached key share one probe.
65
+ const inFlightProbes = new Map();
66
+ // Read per call (cheap), so tests set process.env between requests and http.ts's signature does not change.
67
+ // The read-only resource is derived from the root.
68
+ function getOAuthResourceConfig(resource = 'root') {
69
+ const isReadOnly = resource === 'read-only';
70
+ // Absolute paths resolved against the root, so the identifier and the path-inserted RFC 9728 metadata URL
71
+ // both come from READ_ONLY_PATH; http.ts's '/read-only' route literals must match it (the seal test pins them).
72
+ return {
73
+ authorizationServerUrl: AUTHORIZATION_SERVER_URL,
74
+ resourceUrl: isReadOnly ? new URL(READ_ONLY_PATH, RESOURCE_URL).href : RESOURCE_URL,
75
+ resourceMetadataUrl: new URL(PROTECTED_RESOURCE_METADATA_PATH + (isReadOnly ? READ_ONLY_PATH : ''), RESOURCE_URL).href,
76
+ apiBaseUrl: ((0, util_1.readEnv)('CONDUCTOR_BASE_URL') ?? DEFAULT_API_BASE_URL).replace(/\/+$/, ''),
77
+ keyProbeEnabled: !['off', 'false', '0', 'no'].includes(((0, util_1.readEnv)('CONDUCTOR_MCP_KEY_PROBE') ?? '').trim().toLowerCase()),
78
+ };
79
+ }
80
+ // No scopes_supported: read-only is decided by the URL the client POSTs to, never by the token, and listing
81
+ // none keeps Claude from requesting offline_access (a refresh token this server never issues).
82
+ function buildProtectedResourceMetadata(config) {
83
+ return {
84
+ resource: config.resourceUrl,
85
+ authorization_servers: [config.authorizationServerUrl],
86
+ bearer_methods_supported: ['header'],
87
+ resource_name: 'Conductor MCP server',
88
+ resource_documentation: 'https://docs.conductor.is/usage/mcp',
89
+ };
90
+ }
91
+ function mountProtectedResourceMetadata(app) {
92
+ // Preflight gets Access-Control-Allow-Origin: *. Each literal path also matches its trailing-slash form
93
+ // (strict routing is off), so the read-only document answers under the well-known prefix whether a client
94
+ // follows the 401 hint (no slash) or builds the path itself from the URL the user typed. No splat route:
95
+ // any other suffix is a 404.
96
+ for (const resource of ['root', 'read-only']) {
97
+ const path = PROTECTED_RESOURCE_METADATA_PATH + (resource === 'read-only' ? READ_ONLY_PATH : '');
98
+ app.options(path, (0, cors_1.default)());
99
+ app.get(path, (0, cors_1.default)(), (_req, res) => {
100
+ res
101
+ .status(200)
102
+ .set('Cache-Control', 'public, max-age=300')
103
+ .json(buildProtectedResourceMetadata(getOAuthResourceConfig(resource)));
104
+ });
105
+ }
106
+ }
107
+ // Descriptions are fixed ASCII strings with no double quotes. For a MISSING credential no error
108
+ // param is sent (RFC 6750 3.1), so the challenge is just the resource_metadata pointer and the
109
+ // description appears only in the JSON body.
110
+ function buildWwwAuthenticate(config, error, description) {
111
+ const params = [];
112
+ if (error !== undefined) {
113
+ params.push(`error="${error}"`);
114
+ if (description !== undefined)
115
+ params.push(`error_description="${description}"`);
116
+ }
117
+ params.push(`resource_metadata="${config.resourceMetadataUrl}"`);
118
+ return `Bearer ${params.join(', ')}`;
119
+ }
120
+ // Runs after express.json() (so req.body.method is readable) and before post(). A credential-less
121
+ // POST with invalid JSON is a 400 from the body parser, as today; real clients never send one.
122
+ // On the read-only route the gate also rewrites the client permissions header before http.ts parses it.
123
+ function requireCredential(resource = 'root') {
124
+ return async (req, res, next) => {
125
+ const config = getOAuthResourceConfig(resource);
126
+ const credential = extractCredential(req);
127
+ // Set by http.ts's session middleware (the request's own header or a fresh UUID), so the gate and probe
128
+ // lines join pino-http's request line even on a first-contact 401 that carried no mcp-session-id.
129
+ const mcpSessionId = req.mcpSessionId;
130
+ if (credential.kind === 'missing') {
131
+ return reject(req, res, config, resource, 'missing', undefined, 'Sign in to Conductor, or send your Conductor secret key in the Authorization header');
132
+ }
133
+ if (credential.kind === 'invalid') {
134
+ return reject(req, res, config, resource, 'invalid_scheme', 'invalid_token', credential.header === 'x-conductor-secret-key' ?
135
+ 'The x-conductor-secret-key header is empty. Set it to your Conductor secret key'
136
+ : 'The Authorization header must be the word Bearer, a space, and your Conductor secret key', credential.shape);
137
+ }
138
+ canonicalizeCredential(req, credential);
139
+ if (resource === 'read-only')
140
+ forceReadOnlyPermissions(req);
141
+ if (config.keyProbeEnabled && bodyHasProbedMethod(req.body)) {
142
+ const probe = await probeKeyCached(credential.token, config, mcpSessionId); // never throws
143
+ if (probe.verdict === 'invalid') {
144
+ return reject(req, res, config, resource, 'dead_key', 'invalid_token', probe.code === 'SECRET_KEY_REQUIRED' ?
145
+ 'This is a Conductor publishable key. Use a secret key instead'
146
+ : 'This Conductor key is invalid or was deleted. Sign in again, or create a new key on the MCP tab in the Conductor Dashboard');
147
+ }
148
+ }
149
+ next();
150
+ };
151
+ }
152
+ // The log line is load-bearing: http.ts's redactHeaders (/auth|cookie|key|token|x-stainless-mcp-client-envs/i,
153
+ // applied to RESPONSE headers too) writes www-authenticate as [REDACTED] and pino-http logs no body, so
154
+ // without it a first-contact 401 (expected), a wrong-scheme 401 (the misconfigured customer behind the
155
+ // 130-per-48h 500s) and a dead-key 401 are identical in Render logs. The body is advisory; Claude and the
156
+ // SDK clients read only the status and the header. The line also carries the credential's shape (never
157
+ // any part of its value), the JSON-RPC method, the client's User-Agent and the resource, so a keyless
158
+ // retry loop, a wrong-scheme connector and a first-contact sign-in are told apart without a join.
159
+ function reject(req, res, config, resource, gate, error, description, credentialShape) {
160
+ (0, logger_1.getLogger)().warn({
161
+ mcpSessionId: req.mcpSessionId,
162
+ oauthGate: gate,
163
+ ...(credentialShape !== undefined && { credentialShape }),
164
+ ...(0, telemetry_1.rpcMethodProps)(req.body),
165
+ userAgent: (0, telemetry_1.sanitizeUserAgent)(req.headers['user-agent'], 100),
166
+ resource,
167
+ }, 'OAuth gate rejected request');
168
+ res
169
+ .status(401)
170
+ .set('WWW-Authenticate', buildWwwAuthenticate(config, error, description))
171
+ .set('Cache-Control', 'no-store')
172
+ .json({ error: error ?? 'invalid_token', error_description: description });
173
+ }
174
+ // Precedence mirrors parseClientAuthHeaders (Authorization wins) so what the gate accepts is exactly what
175
+ // newServer uses. x-conductor-secret-key is always a string in Express: Node joins duplicate custom request
176
+ // headers with a comma and only set-cookie is an array; narrowed with typeof for the TypeScript type.
177
+ function extractCredential(req) {
178
+ const authorization = req.headers.authorization;
179
+ // Truthy, like parseClientAuthHeaders: an empty Authorization header falls through to the custom header.
180
+ if (authorization) {
181
+ const { scheme, token } = splitAuthorization(authorization);
182
+ if (scheme.toLowerCase() === 'bearer' && token !== '')
183
+ return { kind: 'bearer', token };
184
+ // Basic, Digest, 'Bearer' alone, 'Bearer ', a bare key
185
+ return { kind: 'invalid', header: 'authorization', shape: authorizationShape(authorization) };
186
+ }
187
+ const headerKey = req.headers['x-conductor-secret-key'];
188
+ if (typeof headerKey === 'string') {
189
+ const token = headerKey.trim();
190
+ return token === '' ?
191
+ { kind: 'invalid', header: 'x-conductor-secret-key', shape: 'empty_custom_header' }
192
+ : { kind: 'header', token };
193
+ }
194
+ return { kind: 'missing' };
195
+ }
196
+ // The one place an Authorization value is split: the first word and the trimmed rest (empty when there
197
+ // is no space), shared by the gate and the shape label so the two never disagree.
198
+ function splitAuthorization(authorization) {
199
+ const spaceIndex = authorization.indexOf(' ');
200
+ if (spaceIndex === -1)
201
+ return { scheme: authorization, token: '', hasSpace: false };
202
+ return {
203
+ scheme: authorization.slice(0, spaceIndex),
204
+ token: authorization.slice(spaceIndex + 1).trim(),
205
+ hasSpace: true,
206
+ };
207
+ }
208
+ // The shape of an Authorization value that is not `Bearer <key>`. Exported for its unit test; the value
209
+ // itself is never returned or logged. A scheme word is logged only when it is short and alphabetic, so a
210
+ // pasted secret can never become the label.
211
+ function authorizationShape(authorization) {
212
+ const { scheme, hasSpace } = splitAuthorization(authorization);
213
+ if (scheme.toLowerCase() === 'bearer')
214
+ return 'empty_bearer'; // 'Bearer' alone, 'Bearer ', 'bearer '
215
+ // The two paste mistakes a header-name-plus-value dialog invites (Copilot Studio's read-only connection,
216
+ // 2026-11-05, eight scheme:other rejections): a header line ("Authorization: Bearer x", "Bearer: x",
217
+ // "Bearer:x", '"Authorization": "Bearer x"') or a quoted value ('"Bearer x"').
218
+ if (!hasSpace) {
219
+ if (authorization.startsWith('sk_conductor_'))
220
+ return 'no_scheme:sk_conductor_';
221
+ return authorization.includes(':') ? 'scheme:colon' : 'no_scheme:other';
222
+ }
223
+ if (/^[A-Za-z]{1,12}$/.test(scheme))
224
+ return `scheme:${scheme.toLowerCase()}`;
225
+ if (scheme.includes(':'))
226
+ return 'scheme:colon';
227
+ if (authorization.startsWith('"') || authorization.startsWith("'"))
228
+ return 'scheme:quoted';
229
+ return 'scheme:other';
230
+ }
231
+ // The generated parseClientAuthHeaders switches on the literal 'Bearer' and throws otherwise, so the
232
+ // header is rewritten in canonical form ('bearer'/'BEARER' and 'Bearer x' with two spaces all become
233
+ // 'Bearer x'); the custom header is replaced by its trimmed value.
234
+ function canonicalizeCredential(req, credential) {
235
+ if (credential.kind === 'bearer') {
236
+ req.headers.authorization = `Bearer ${credential.token}`;
237
+ }
238
+ else {
239
+ req.headers['x-conductor-secret-key'] = credential.token;
240
+ }
241
+ }
242
+ // The read-only connector URL allows the client's own permissions minus every write: the HTTP GET methods,
243
+ // or only the GETs among a client's allowed_methods when it sent that list without allow_http_gets:true, less
244
+ // its blocked_methods. The header is REWRITTEN, not merged: http.ts spreads whatever it parses over
245
+ // mcpOptions, so a client {"allow_http_gets":false} would restore full access and an allowed_methods regexp
246
+ // would union writes back in; allowed_methods is therefore replaced by the exact names of the GETs it matches.
247
+ // A server started with its own --code-allowed-methods would still union those in; the hosted service sets
248
+ // none. A malformed value is left as sent, so http.ts refuses it with the same 400 as on the root.
249
+ function forceReadOnlyPermissions(req) {
250
+ const sent = req.headers['x-stainless-mcp-client-permissions'];
251
+ const client = typeof sent === 'string' ? parseClientPermissions(sent) : {};
252
+ if (client === null)
253
+ return;
254
+ const forced = { allow_http_gets: true };
255
+ if (client.allowed_methods !== undefined && client.allow_http_gets !== true) {
256
+ const allowed = client.allowed_methods.map((pattern) => new RegExp(pattern));
257
+ forced.allow_http_gets = false;
258
+ forced.allowed_methods = methods_1.sdkMethods
259
+ .filter((method) => method.httpMethod === 'get' && allowed.some((regexp) => regexp.test(method.fullyQualifiedName)))
260
+ .map((method) => `^${method.fullyQualifiedName.replace(/\./g, '\\.')}$`); // names are dotted identifiers
261
+ }
262
+ if (client.blocked_methods !== undefined)
263
+ forced.blocked_methods = client.blocked_methods;
264
+ req.headers['x-stainless-mcp-client-permissions'] = JSON.stringify(forced);
265
+ }
266
+ // The one parser for x-stainless-mcp-client-permissions, shared by http.ts and the read-only gate so both
267
+ // paths refuse the same values. Returns null unless the header is a JSON object holding only known keys of
268
+ // the right types with valid regexps, so a typo such as {"allow_http_gets":"true"} or {"read_only":true} is
269
+ // refused instead of ignored, and a bad pattern is a 400 instead of a 500 from the method filter.
270
+ function parseClientPermissions(header) {
271
+ let parsed;
272
+ try {
273
+ parsed = JSON.parse(header);
274
+ }
275
+ catch {
276
+ return null;
277
+ }
278
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
279
+ return null;
280
+ }
281
+ const isPatternArray = (value) => Array.isArray(value) && value.every((item) => typeof item === 'string' && isValidRegExp(item));
282
+ const isValid = Object.entries(parsed).every(([key, value]) => key === 'allow_http_gets' ? typeof value === 'boolean'
283
+ : key === 'allowed_methods' || key === 'blocked_methods' ? isPatternArray(value)
284
+ : false);
285
+ return isValid ? parsed : null;
286
+ }
287
+ function isValidRegExp(pattern) {
288
+ try {
289
+ new RegExp(pattern);
290
+ return true;
291
+ }
292
+ catch {
293
+ return false;
294
+ }
295
+ }
296
+ // body is an object with a string `method` in PROBED_METHODS, or an array with any such element (JSON-RPC
297
+ // batch), and the call is not only to a tool in UNPROBED_TOOLS.
298
+ function bodyHasProbedMethod(body) {
299
+ const messages = Array.isArray(body) ? body : [body];
300
+ return messages.some((message) => {
301
+ if (typeof message !== 'object' || message === null)
302
+ return false;
303
+ const { method, params } = message;
304
+ if (typeof method !== 'string' || !PROBED_METHODS.has(method))
305
+ return false;
306
+ const toolName = typeof params === 'object' && params !== null ? params.name : undefined;
307
+ return !(typeof toolName === 'string' && UNPROBED_TOOLS.has(toolName));
308
+ });
309
+ }
310
+ async function probeKeyCached(token, config, mcpSessionId) {
311
+ const cacheKey = (0, node_crypto_1.createHash)('sha256').update(token).digest('hex');
312
+ const expiresAt = validKeyCache.get(cacheKey);
313
+ if (expiresAt !== undefined && expiresAt > Date.now())
314
+ return { verdict: 'valid' };
315
+ validKeyCache.delete(cacheKey);
316
+ const pending = inFlightProbes.get(cacheKey);
317
+ if (pending !== undefined) {
318
+ // One line under this session too, so its gate line has a probe result next to it.
319
+ const shared = await pending;
320
+ (0, logger_1.getLogger)()[shared.verdict === 'unknown' ? 'warn' : 'info']({ mcpSessionId, keyProbe: { ...shared, shared: true } }, 'key probe');
321
+ return shared;
322
+ }
323
+ const probe = probeKey(token, config, mcpSessionId).finally(() => inFlightProbes.delete(cacheKey));
324
+ inFlightProbes.set(cacheKey, probe);
325
+ const result = await probe;
326
+ if (result.verdict === 'valid') {
327
+ if (validKeyCache.size >= VALID_KEY_CACHE_MAX_ENTRIES) {
328
+ const oldest = validKeyCache.keys().next().value;
329
+ if (oldest !== undefined)
330
+ validKeyCache.delete(oldest);
331
+ }
332
+ validKeyCache.set(cacheKey, Date.now() + VALID_KEY_CACHE_TTL_MS);
333
+ }
334
+ return result;
335
+ }
336
+ // Tests only: forget cached verdicts between cases.
337
+ function clearValidKeyCache() {
338
+ validKeyCache.clear();
339
+ inFlightProbes.clear();
340
+ }
341
+ // Why the envelope check: api.conductor.is answers through Cloudflare in front of Render (verified live
342
+ // 2026-10-20: server: cloudflare, cf-ray, x-render-origin-server: Render), so a WAF block, managed challenge,
343
+ // rate-limit rule or Under Attack page (text/html 403) or a Cloudflare Access page (text/html 401) would
344
+ // otherwise read as a deleted key and turn every tools/call from every client (hosted Claude, Claude Code,
345
+ // Cursor, VS Code, Codex, mcp-remote, the npx bridge) into a sign-in 401, with hosted Claude re-consenting and
346
+ // minting a key row per retry. The API's own rejection is always application/json with the envelope
347
+ // { "error": { "code": ... } } (middleware/global-error-formatter.ts). 'unknown' is treated as valid by the
348
+ // caller (fail open). The body is always consumed or cancelled (an unread body pins the undici socket until
349
+ // GC) and never logged. The token is never logged. After EVERY probe, one structured line; the warn on
350
+ // 'unknown' is what makes a silently broken probe path (route renamed, DNS, permanent timeout, edge block)
351
+ // visible instead of reading as "every key is valid" forever.
352
+ async function probeKey(token, config, mcpSessionId) {
353
+ const startedAt = Date.now();
354
+ let result = { verdict: 'unknown' };
355
+ let status = null;
356
+ let contentType = null;
357
+ let cfRay = null;
358
+ let conductorRequestId = null;
359
+ let error;
360
+ try {
361
+ const response = await fetch(`${config.apiBaseUrl}${KEY_PROBE_PATH}`, {
362
+ method: 'GET',
363
+ headers: {
364
+ Authorization: `Bearer ${token}`,
365
+ Accept: 'application/json',
366
+ 'User-Agent': KEY_PROBE_USER_AGENT,
367
+ },
368
+ signal: AbortSignal.timeout(KEY_PROBE_TIMEOUT_MS),
369
+ redirect: 'manual',
370
+ });
371
+ status = response.status;
372
+ contentType = mediaTypeOf(response.headers.get('content-type'));
373
+ cfRay = response.headers.get('cf-ray');
374
+ conductorRequestId = response.headers.get('conductor-request-id');
375
+ result = await classifyProbeResponse(response, contentType);
376
+ }
377
+ catch (thrown) {
378
+ // timeout, DNS, reset, ECONNREFUSED
379
+ // undici's message is always "fetch failed"; the cause says refused, DNS, reset or bad port.
380
+ const cause = thrown instanceof Error ? thrown.cause : undefined;
381
+ const causeText = cause instanceof Error ?
382
+ `${cause.code ?? cause.name}: ${cause.message}`
383
+ : undefined;
384
+ error = [thrown instanceof Error ? thrown.message : String(thrown), causeText]
385
+ .filter(Boolean)
386
+ .join(' / ');
387
+ }
388
+ const { verdict, code } = result;
389
+ error ??= result.error;
390
+ const keyProbe = {
391
+ verdict,
392
+ ...(code !== undefined && { code }),
393
+ status,
394
+ ms: Date.now() - startedAt,
395
+ contentType,
396
+ cfRay,
397
+ conductorRequestId,
398
+ ...(error !== undefined && { error }),
399
+ };
400
+ (0, logger_1.getLogger)()[verdict === 'unknown' ? 'warn' : 'info']({ mcpSessionId, keyProbe }, 'key probe');
401
+ return result;
402
+ }
403
+ // The probe reads a nonexistent end user, so the real API answers a live key 404 RESOURCE_MISSING and a dead or
404
+ // publishable key 401/403 with a code in KEY_PROBE_REJECTION_CODES, always application/json with Conductor's
405
+ // envelope. Anything else is 'unknown' (fail open, logged as a warning): a 2xx (the real API never sends one
406
+ // here, so CONDUCTOR_BASE_URL points somewhere else), another 404 (a moved route's UNRECOGNIZED_REQUEST_URL),
407
+ // an edge HTML page, another code, 3xx, 429 or 5xx. The body is read under the same 3 s abort signal.
408
+ async function classifyProbeResponse(response, contentType) {
409
+ const answersWithEnvelope = response.status === 404 || response.status === 401 || response.status === 403;
410
+ if (!answersWithEnvelope || contentType !== 'application/json') {
411
+ await discardBody(response);
412
+ return { verdict: 'unknown' };
413
+ }
414
+ let code;
415
+ try {
416
+ code = errorCodeOf(JSON.parse(await response.text()));
417
+ }
418
+ catch (thrown) {
419
+ // The 3 s abort firing mid-body, or a body that is not JSON.
420
+ return { verdict: 'unknown', error: thrown instanceof Error ? thrown.message : String(thrown) };
421
+ }
422
+ if (response.status === 404)
423
+ return { verdict: code === 'RESOURCE_MISSING' ? 'valid' : 'unknown' };
424
+ return code !== undefined && KEY_PROBE_REJECTION_CODES.has(code) ?
425
+ { verdict: 'invalid', code }
426
+ : { verdict: 'unknown' };
427
+ }
428
+ // error.code from Conductor's error envelope { "error": { "code": ... } }, if present.
429
+ function errorCodeOf(parsed) {
430
+ if (typeof parsed !== 'object' || parsed === null)
431
+ return undefined;
432
+ const error = parsed.error;
433
+ if (typeof error !== 'object' || error === null)
434
+ return undefined;
435
+ const code = error.code;
436
+ return typeof code === 'string' ? code : undefined;
437
+ }
438
+ async function discardBody(response) {
439
+ await response.body?.cancel().catch(() => undefined);
440
+ }
441
+ // content-type before ";", trimmed, lowercased
442
+ function mediaTypeOf(contentType) {
443
+ const mediaType = contentType?.split(';')[0]?.trim().toLowerCase();
444
+ return mediaType ? mediaType : null;
445
+ }
446
+ //# sourceMappingURL=oauth.js.map
package/oauth.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth.js","sourceRoot":"","sources":["src/oauth.ts"],"names":[],"mappings":";;;;;AAyFA,wDAgBC;AAID,wEAQC;AAED,wEAeC;AAKD,oDAYC;AAKD,8CAoDC;AA0ED,gDAcC;AAoDD,wDAkBC;AAyDD,gDAGC;AA1aD,gFAAgF;AAChF,+JAA+J;AAC/J,+EAA+E;AAC/E,wEAAwE;AACxE,qEAAqE;AACrE,+EAA+E;AAC/E,+EAA+E;AAC/E,4EAA4E;AAC5E,6EAA6E;AAC7E,6EAA6E;AAC7E,6EAA6E;AAC7E,0EAA0E;AAC1E,8EAA8E;AAC9E,gEAAgE;AAChE,gDAAwB;AACxB,6CAAyC;AAEzC,wCAAqC;AACrC,0CAAuC;AACvC,8CAAgE;AAChE,oCAAiC;AAEjC,oGAAoG;AACpG,MAAM,wBAAwB,GAAG,gCAAgC,CAAC;AAClE,MAAM,YAAY,GAAG,2BAA2B,CAAC;AACjD,MAAM,oBAAoB,GAAG,6BAA6B,CAAC,CAAC,+CAA+C;AAC3G,MAAM,gCAAgC,GAAG,uCAAuC,CAAC;AACjF,yGAAyG;AACzG,qFAAqF;AACrF,2GAA2G;AAC3G,4GAA4G;AAC5G,mGAAmG;AACnG,MAAM,cAAc,GAAG,YAAY,CAAC;AACpC,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAClC,MAAM,cAAc,GAAG,gCAAgC,CAAC,CAAC,iEAAiE;AAC1H,wGAAwG;AACxG,6GAA6G;AAC7G,6HAA6H;AAC7H,MAAM,yBAAyB,GAAwB,IAAI,GAAG,CAAC,CAAC,iBAAiB,EAAE,qBAAqB,CAAC,CAAC,CAAC;AAC3G,4HAA4H;AAC5H,MA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