@thinkrun/mcp 0.3.10 → 0.3.12

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 (39) hide show
  1. package/README.md +27 -3
  2. package/dist/bin/thinkrun-connector.d.ts +21 -0
  3. package/dist/bin/thinkrun-connector.d.ts.map +1 -0
  4. package/dist/bin/thinkrun-connector.js +96 -0
  5. package/dist/bin/thinkrun-connector.js.map +1 -0
  6. package/dist/bin/thinkrun-mcp.js +120 -34
  7. package/dist/bin/thinkrun-mcp.js.map +1 -1
  8. package/dist/src/client.d.ts +2 -1
  9. package/dist/src/client.d.ts.map +1 -1
  10. package/dist/src/connector/connector-server.d.ts +17 -0
  11. package/dist/src/connector/connector-server.d.ts.map +1 -0
  12. package/dist/src/connector/connector-server.js +116 -0
  13. package/dist/src/connector/connector-server.js.map +1 -0
  14. package/dist/src/connector/http-connector.d.ts +53 -0
  15. package/dist/src/connector/http-connector.d.ts.map +1 -0
  16. package/dist/src/connector/http-connector.js +352 -0
  17. package/dist/src/connector/http-connector.js.map +1 -0
  18. package/dist/src/connector/identity.d.ts +170 -0
  19. package/dist/src/connector/identity.d.ts.map +1 -0
  20. package/dist/src/connector/identity.js +227 -0
  21. package/dist/src/connector/identity.js.map +1 -0
  22. package/dist/src/connector/oauth-server.d.ts +64 -0
  23. package/dist/src/connector/oauth-server.d.ts.map +1 -0
  24. package/dist/src/connector/oauth-server.js +213 -0
  25. package/dist/src/connector/oauth-server.js.map +1 -0
  26. package/dist/src/connector/oauth-store.d.ts +127 -0
  27. package/dist/src/connector/oauth-store.d.ts.map +1 -0
  28. package/dist/src/connector/oauth-store.js +310 -0
  29. package/dist/src/connector/oauth-store.js.map +1 -0
  30. package/dist/src/connector/rate-limit.d.ts +48 -0
  31. package/dist/src/connector/rate-limit.d.ts.map +1 -0
  32. package/dist/src/connector/rate-limit.js +84 -0
  33. package/dist/src/connector/rate-limit.js.map +1 -0
  34. package/dist/src/local-client.js +1 -1
  35. package/dist/src/onboarding.d.ts +79 -0
  36. package/dist/src/onboarding.d.ts.map +1 -0
  37. package/dist/src/onboarding.js +407 -0
  38. package/dist/src/onboarding.js.map +1 -0
  39. package/package.json +1 -1
@@ -0,0 +1,170 @@
1
+ /**
2
+ * Identity + delegated-credential seams for the connector (PRD 0110 tasks 3.0 / 4.0).
3
+ *
4
+ * Two boundaries, both keeping claude.ai's OAuth token from ever reaching the
5
+ * ThinkRun backend (RFC 8707 / confused-deputy):
6
+ *
7
+ * IdentityProvider — /authorize resolves WHICH ThinkRun user is consenting.
8
+ * dev: auto-approve a fixed user (proven against claude.ai).
9
+ * prod: redirect to the ThinkRun login + PRD-0107 grant page,
10
+ * then resume via completeAuthorization().
11
+ *
12
+ * DelegatedCredentialProvider — once a claude.ai token is validated, mint a short-lived,
13
+ * user-scoped delegated remote-agent credential (decision A,
14
+ * reusing the PRD-0109 /sessions pattern). The connector builds
15
+ * a CloudClient from it and calls the ThinkRun API as its OWN
16
+ * client — never forwarding the claude.ai token.
17
+ */
18
+ export interface AuthorizationRequest {
19
+ client_id: string;
20
+ redirect_uri: string;
21
+ state: string | null;
22
+ code_challenge: string;
23
+ resource: string | null;
24
+ scope: string;
25
+ }
26
+ export type AuthorizationDecision =
27
+ /** Consent granted inline (dev auto-approve). */
28
+ {
29
+ type: 'approved';
30
+ userId: string;
31
+ scope: string;
32
+ }
33
+ /** Send the user's browser to an external login/consent page (prod). */
34
+ | {
35
+ type: 'redirect';
36
+ location: string;
37
+ };
38
+ export interface IdentityProvider {
39
+ /**
40
+ * Called by GET /authorize. Either approves inline (dev) or returns a redirect
41
+ * to the ThinkRun login + grant-approval page (prod). The prod page, on success,
42
+ * calls completeAuthorization() to resume the OAuth code issuance.
43
+ */
44
+ beginAuthorization(req: AuthorizationRequest): Promise<AuthorizationDecision>;
45
+ }
46
+ /** Credential the connector uses to call the ThinkRun API on the user's behalf. */
47
+ export interface DelegatedCredential {
48
+ baseUrl: string;
49
+ apiKey: string;
50
+ remoteAgentId: string;
51
+ remoteAgentSecret: string;
52
+ }
53
+ export interface DelegatedCredentialProvider {
54
+ /**
55
+ * Mint (or fetch) a short-lived delegated remote-agent credential for the
56
+ * authenticated ThinkRun user. Prod implementation calls the ThinkRun
57
+ * delegated-session endpoint (0109 /sessions, behind OAuth instead of the HMAC
58
+ * broker assertion). Throws if the user has no active grant/link (fail closed).
59
+ */
60
+ mintForUser(userId: string, resource: string | null): Promise<DelegatedCredential>;
61
+ }
62
+ export declare class DevAutoApproveIdentity implements IdentityProvider {
63
+ private userId;
64
+ constructor(userId?: string);
65
+ beginAuthorization(req: AuthorizationRequest): Promise<AuthorizationDecision>;
66
+ }
67
+ export declare class StaticDelegatedCredential implements DelegatedCredentialProvider {
68
+ private cred;
69
+ constructor(cred: DelegatedCredential);
70
+ mintForUser(): Promise<DelegatedCredential>;
71
+ }
72
+ /**
73
+ * Interactive identity providers additionally resolve a login ticket after the user
74
+ * authenticates + consents on an external page. The connector detects this capability
75
+ * (`completeAuthorization` present) and drives the redirect + `/authorize/complete` flow.
76
+ */
77
+ export interface InteractiveIdentityProvider extends IdentityProvider {
78
+ /** Build the external login+consent URL the user is redirected to, carrying the ticket. */
79
+ buildLoginRedirect(ticket: string): string;
80
+ /**
81
+ * Resume after the external login page redirects back with a signed assertion.
82
+ * Returns the authenticated `userId`, or throws if the assertion is invalid/expired.
83
+ */
84
+ completeAuthorization(params: {
85
+ ticket: string;
86
+ assertion: string;
87
+ }): Promise<{
88
+ userId: string;
89
+ }>;
90
+ }
91
+ export declare function isInteractive(p: IdentityProvider): p is InteractiveIdentityProvider;
92
+ /**
93
+ * Prod login/consent bridge (task 3.0).
94
+ *
95
+ * `/authorize` → redirect the user to the ThinkRun login + PRD-0107 grant page at
96
+ * `${loginBaseUrl}/connector/authorize?ticket=<t>&return_to=<connector>/authorize/complete`.
97
+ * After login+consent, ThinkRun makes a **back-channel** (server-to-server) call:
98
+ * `POST <connector>/authorize/complete` body `{ticket, assertion}`
99
+ * where `assertion = <payloadB64url>.<hmacHex>`, payload = `base64url(JSON({userId, exp,
100
+ * ticket}))`, hmac = HMAC-SHA256(completionSecret, payloadB64url). The connector verifies
101
+ * the signature (constant-time), checks freshness, and checks that the signed `ticket`
102
+ * matches — binding the assertion to that one pending request. It returns `{redirect}`
103
+ * (the claude.ai callback URL with the OAuth code); ThinkRun then 302s the browser there.
104
+ * The signed assertion NEVER travels in a browser URL, so it can't leak via access
105
+ * logs / referer / APM and be replayed. Tickets are one-time (consumed before completion).
106
+ *
107
+ * Backend requirement (documented contract): ThinkRun serves the login+grant page, receives
108
+ * `ticket`, signs `{userId, exp, ticket}` on success, POSTs `{ticket, assertion}` to
109
+ * `/authorize/complete`, and redirects the browser to the returned `redirect` URL. The
110
+ * signed `ticket` MUST equal the one it received.
111
+ */
112
+ export declare class ThinkRunLoginIdentity implements InteractiveIdentityProvider {
113
+ private opts;
114
+ constructor(opts: {
115
+ loginBaseUrl: string;
116
+ connectorPublicUrl: string;
117
+ completionSecret: string;
118
+ /** max assertion age in seconds */
119
+ maxAgeSeconds?: number;
120
+ });
121
+ beginAuthorization(req: AuthorizationRequest): Promise<AuthorizationDecision>;
122
+ buildLoginRedirect(ticket: string): string;
123
+ completeAuthorization(params: {
124
+ ticket: string;
125
+ assertion: string;
126
+ }): Promise<{
127
+ userId: string;
128
+ }>;
129
+ }
130
+ /**
131
+ * Delegated-session credential provider (task 4.0/4.1).
132
+ *
133
+ * Mints a short-lived, user-scoped delegated remote-agent credential by calling the
134
+ * ThinkRun connector delegated-session endpoint (the OAuth-gated successor to the
135
+ * PRD-0109 HMAC-broker `/sessions`). Fail-closed: any non-2xx or missing field throws,
136
+ * so a user without an active grant/link cannot get a working session.
137
+ *
138
+ * Backend requirement (documented contract):
139
+ * POST {baseUrl}/api/connector/delegated-session
140
+ * headers: x-thinkrun-connector-service-key: <serviceApiKey>
141
+ * body: { userId, scopes?, resource? }
142
+ * 200 → { baseUrl?, apiKey, remoteAgentId, remoteAgentSecret, expiresAt? }
143
+ * (baseUrl defaults to the connector's configured ThinkRun baseUrl)
144
+ */
145
+ export declare class DelegatedSessionCredential implements DelegatedCredentialProvider {
146
+ private opts;
147
+ constructor(opts: {
148
+ baseUrl: string;
149
+ serviceApiKey: string;
150
+ scopes?: string[];
151
+ fetchImpl?: typeof fetch;
152
+ });
153
+ mintForUser(userId: string, resource: string | null): Promise<DelegatedCredential>;
154
+ }
155
+ /** Opaque, TTL'd store of pending OAuth authorization requests keyed by login ticket. */
156
+ export declare class PendingAuthStore {
157
+ private ttlMs;
158
+ private maxSize;
159
+ /** Per-client quota so one self-registered client can't monopolize the store. */
160
+ private maxPerClient;
161
+ private pending;
162
+ constructor(ttlMs?: number, maxSize?: number,
163
+ /** Per-client quota so one self-registered client can't monopolize the store. */
164
+ maxPerClient?: number);
165
+ private countForClient;
166
+ issue(req: AuthorizationRequest): string;
167
+ consume(ticket: string): AuthorizationRequest | undefined;
168
+ gc(): void;
169
+ }
170
+ //# sourceMappingURL=identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../src/connector/identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,qBAAqB;AAC/B,iDAAiD;AAC/C;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AACrD,wEAAwE;GACtE;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3C,M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AI;CAIX"}
@@ -0,0 +1,227 @@
1
+ /**
2
+ * Identity + delegated-credential seams for the connector (PRD 0110 tasks 3.0 / 4.0).
3
+ *
4
+ * Two boundaries, both keeping claude.ai's OAuth token from ever reaching the
5
+ * ThinkRun backend (RFC 8707 / confused-deputy):
6
+ *
7
+ * IdentityProvider — /authorize resolves WHICH ThinkRun user is consenting.
8
+ * dev: auto-approve a fixed user (proven against claude.ai).
9
+ * prod: redirect to the ThinkRun login + PRD-0107 grant page,
10
+ * then resume via completeAuthorization().
11
+ *
12
+ * DelegatedCredentialProvider — once a claude.ai token is validated, mint a short-lived,
13
+ * user-scoped delegated remote-agent credential (decision A,
14
+ * reusing the PRD-0109 /sessions pattern). The connector builds
15
+ * a CloudClient from it and calls the ThinkRun API as its OWN
16
+ * client — never forwarding the claude.ai token.
17
+ */
18
+ // ---------------------------------------------------------------------------
19
+ // Dev / spike implementations — auto-approve + static delegated credential.
20
+ // This is the exact behavior validated end-to-end against the real claude.ai
21
+ // client on 2026-07-07. Selectable only when THINKRUN_CONNECTOR_MODE=dev.
22
+ // ---------------------------------------------------------------------------
23
+ export class DevAutoApproveIdentity {
24
+ userId;
25
+ constructor(userId = 'dev-user') {
26
+ this.userId = userId;
27
+ }
28
+ async beginAuthorization(req) {
29
+ return { type: 'approved', userId: this.userId, scope: req.scope };
30
+ }
31
+ }
32
+ export class StaticDelegatedCredential {
33
+ cred;
34
+ constructor(cred) {
35
+ this.cred = cred;
36
+ }
37
+ async mintForUser() {
38
+ return this.cred;
39
+ }
40
+ }
41
+ // ---------------------------------------------------------------------------
42
+ // Prod seam — wire to ThinkRun login + delegated-session endpoint.
43
+ // Left as an explicit, fail-closed stub so a dev credential can never be used
44
+ // in prod by accident. Tasks 3.0 (login bridge) and 4.0 (delegated session).
45
+ // ---------------------------------------------------------------------------
46
+ import { createHmac, randomBytes, timingSafeEqual } from 'node:crypto';
47
+ export function isInteractive(p) {
48
+ return typeof p.completeAuthorization === 'function';
49
+ }
50
+ /**
51
+ * Prod login/consent bridge (task 3.0).
52
+ *
53
+ * `/authorize` → redirect the user to the ThinkRun login + PRD-0107 grant page at
54
+ * `${loginBaseUrl}/connector/authorize?ticket=<t>&return_to=<connector>/authorize/complete`.
55
+ * After login+consent, ThinkRun makes a **back-channel** (server-to-server) call:
56
+ * `POST <connector>/authorize/complete` body `{ticket, assertion}`
57
+ * where `assertion = <payloadB64url>.<hmacHex>`, payload = `base64url(JSON({userId, exp,
58
+ * ticket}))`, hmac = HMAC-SHA256(completionSecret, payloadB64url). The connector verifies
59
+ * the signature (constant-time), checks freshness, and checks that the signed `ticket`
60
+ * matches — binding the assertion to that one pending request. It returns `{redirect}`
61
+ * (the claude.ai callback URL with the OAuth code); ThinkRun then 302s the browser there.
62
+ * The signed assertion NEVER travels in a browser URL, so it can't leak via access
63
+ * logs / referer / APM and be replayed. Tickets are one-time (consumed before completion).
64
+ *
65
+ * Backend requirement (documented contract): ThinkRun serves the login+grant page, receives
66
+ * `ticket`, signs `{userId, exp, ticket}` on success, POSTs `{ticket, assertion}` to
67
+ * `/authorize/complete`, and redirects the browser to the returned `redirect` URL. The
68
+ * signed `ticket` MUST equal the one it received.
69
+ */
70
+ export class ThinkRunLoginIdentity {
71
+ opts;
72
+ constructor(opts) {
73
+ this.opts = opts;
74
+ if (!opts.completionSecret || opts.completionSecret.length < 16) {
75
+ throw new Error('ThinkRunLoginIdentity requires a completionSecret (>=16 chars) shared with ThinkRun');
76
+ }
77
+ }
78
+ async beginAuthorization(req) {
79
+ // The connector stashes the pending request under `state`-independent ticket and
80
+ // passes the ticket to us via the redirect it builds; here we only construct the URL.
81
+ // (The connector generates + stashes the ticket; see http-connector `/authorize`.)
82
+ void req;
83
+ throw new Error('ThinkRunLoginIdentity.beginAuthorization is driven by the connector interactive flow');
84
+ }
85
+ buildLoginRedirect(ticket) {
86
+ const returnTo = `${this.opts.connectorPublicUrl.replace(/\/$/, '')}/authorize/complete`;
87
+ const u = new URL(`${this.opts.loginBaseUrl.replace(/\/$/, '')}/connector/authorize`);
88
+ u.searchParams.set('ticket', ticket);
89
+ u.searchParams.set('return_to', returnTo);
90
+ return u.toString();
91
+ }
92
+ async completeAuthorization(params) {
93
+ const [payloadB64, mac] = params.assertion.split('.');
94
+ if (!payloadB64 || !mac)
95
+ throw new Error('malformed assertion');
96
+ const expected = createHmac('sha256', this.opts.completionSecret).update(payloadB64).digest('hex');
97
+ const a = Buffer.from(mac);
98
+ const b = Buffer.from(expected);
99
+ if (a.length !== b.length || !timingSafeEqual(a, b))
100
+ throw new Error('assertion signature mismatch');
101
+ let payload;
102
+ try {
103
+ payload = JSON.parse(Buffer.from(payloadB64, 'base64url').toString('utf8'));
104
+ }
105
+ catch {
106
+ throw new Error('assertion payload not decodable');
107
+ }
108
+ if (!payload.userId || typeof payload.exp !== 'number' || !payload.ticket)
109
+ throw new Error('assertion payload incomplete');
110
+ // Bind the assertion to THIS pending auth request — prevents replay against another ticket.
111
+ const t1 = Buffer.from(payload.ticket);
112
+ const t2 = Buffer.from(params.ticket);
113
+ if (t1.length !== t2.length || !timingSafeEqual(t1, t2))
114
+ throw new Error('assertion ticket mismatch');
115
+ const now = Math.floor(Date.now() / 1000);
116
+ const maxAge = this.opts.maxAgeSeconds ?? 300;
117
+ if (payload.exp < now)
118
+ throw new Error('assertion expired');
119
+ if (payload.exp > now + maxAge + 60)
120
+ throw new Error('assertion exp too far in the future');
121
+ return { userId: payload.userId };
122
+ }
123
+ }
124
+ /**
125
+ * Delegated-session credential provider (task 4.0/4.1).
126
+ *
127
+ * Mints a short-lived, user-scoped delegated remote-agent credential by calling the
128
+ * ThinkRun connector delegated-session endpoint (the OAuth-gated successor to the
129
+ * PRD-0109 HMAC-broker `/sessions`). Fail-closed: any non-2xx or missing field throws,
130
+ * so a user without an active grant/link cannot get a working session.
131
+ *
132
+ * Backend requirement (documented contract):
133
+ * POST {baseUrl}/api/connector/delegated-session
134
+ * headers: x-thinkrun-connector-service-key: <serviceApiKey>
135
+ * body: { userId, scopes?, resource? }
136
+ * 200 → { baseUrl?, apiKey, remoteAgentId, remoteAgentSecret, expiresAt? }
137
+ * (baseUrl defaults to the connector's configured ThinkRun baseUrl)
138
+ */
139
+ export class DelegatedSessionCredential {
140
+ opts;
141
+ constructor(opts) {
142
+ this.opts = opts;
143
+ }
144
+ async mintForUser(userId, resource) {
145
+ const doFetch = this.opts.fetchImpl ?? fetch;
146
+ const url = `${this.opts.baseUrl.replace(/\/$/, '')}/api/connector/delegated-session`;
147
+ let res;
148
+ try {
149
+ res = await doFetch(url, {
150
+ method: 'POST',
151
+ headers: {
152
+ 'content-type': 'application/json',
153
+ 'x-thinkrun-connector-service-key': this.opts.serviceApiKey,
154
+ },
155
+ body: JSON.stringify({ userId, scopes: this.opts.scopes, resource }),
156
+ });
157
+ }
158
+ catch (e) {
159
+ throw new Error(`delegated-session mint failed (network): ${e instanceof Error ? e.message : e}`);
160
+ }
161
+ if (!res.ok) {
162
+ throw new Error(`delegated-session mint rejected (${res.status}) — user likely has no active grant/link`);
163
+ }
164
+ const data = (await res.json().catch(() => ({})));
165
+ if (!data.apiKey || !data.remoteAgentId || !data.remoteAgentSecret) {
166
+ throw new Error('delegated-session mint returned incomplete credential');
167
+ }
168
+ return {
169
+ baseUrl: data.baseUrl ?? this.opts.baseUrl,
170
+ apiKey: data.apiKey,
171
+ remoteAgentId: data.remoteAgentId,
172
+ remoteAgentSecret: data.remoteAgentSecret,
173
+ };
174
+ }
175
+ }
176
+ /** Opaque, TTL'd store of pending OAuth authorization requests keyed by login ticket. */
177
+ export class PendingAuthStore {
178
+ ttlMs;
179
+ maxSize;
180
+ maxPerClient;
181
+ pending = new Map();
182
+ constructor(ttlMs = 5 * 60 * 1000, maxSize = 10_000,
183
+ /** Per-client quota so one self-registered client can't monopolize the store. */
184
+ maxPerClient = 50) {
185
+ this.ttlMs = ttlMs;
186
+ this.maxSize = maxSize;
187
+ this.maxPerClient = maxPerClient;
188
+ }
189
+ countForClient(clientId) {
190
+ let n = 0;
191
+ for (const v of this.pending.values())
192
+ if (v.req.client_id === clientId)
193
+ n++;
194
+ return n;
195
+ }
196
+ issue(req) {
197
+ // Fail CLOSED when full — pending tickets are in-flight logins; evicting the oldest
198
+ // would let an attacker flush legitimate users' in-progress logins (DoS). Drop expired
199
+ // first, cap per-client, then reject if still at global capacity. Per-IP rate limiting
200
+ // on /authorize + shared storage for multi-instance are the production complements
201
+ // (the connector can't see real client IPs reliably behind proxies).
202
+ this.gc();
203
+ if (this.countForClient(req.client_id) >= this.maxPerClient) {
204
+ throw new Error('too many pending authorizations for this client');
205
+ }
206
+ if (this.pending.size >= this.maxSize) {
207
+ throw new Error('pending authorization capacity reached — try again shortly');
208
+ }
209
+ const ticket = randomBytes(24).toString('base64url');
210
+ this.pending.set(ticket, { req, expires: Date.now() + this.ttlMs });
211
+ return ticket;
212
+ }
213
+ consume(ticket) {
214
+ const rec = this.pending.get(ticket);
215
+ this.pending.delete(ticket);
216
+ if (!rec || rec.expires < Date.now())
217
+ return undefined;
218
+ return rec.req;
219
+ }
220
+ gc() {
221
+ const now = Date.now();
222
+ for (const [k, v] of this.pending)
223
+ if (v.expires < now)
224
+ this.pending.delete(k);
225
+ }
226
+ }
227
+ //# sourceMappingURL=identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.js","sourceRoot":"","sources":["../../../src/connector/identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AA4CH,8EAA8E;AAC9E,4EAA4E;AAC5E,6EAA6E;AAC7E,0EAA0E;AAC1E,8EAA8E;AAE9E,MAAM,OAAO,sBAAsB;IACb;IAApB,YAAoB,SAAS,UAAU;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IAC3C,KAAK,CAAC,kBAAkB,CAAC,GAAyB;QAChD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC;IACrE,CA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AC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACrC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC5B,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE;YAAE,OAAO,SAAS,CAAC;QACvD,OAAO,GAAG,CAAC,GAAG,CAAC;IACjB,CAAC;IAED,EAAE;QACA,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO;YAAE,IAAI,CAAC,CAAC,OAAO,GAAG,GAAG;gBAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACjF,CAAC;CACF"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * OAuth 2.1 Authorization Server for the connector (PRD 0110 task 2.0).
3
+ *
4
+ * Framework-agnostic: every handler returns a plain {status, headers, body}
5
+ * so it can be unit-tested without a socket and adapted to node:http in
6
+ * http-connector.ts. Implements exactly what the live claude.ai client exercised
7
+ * on 2026-07-07: RFC 9728 PRM, RFC 8414 AS metadata, RFC 7591 DCR, OAuth 2.1
8
+ * authorization_code + refresh_token with PKCE S256 and RFC 8707 resource binding.
9
+ */
10
+ import type { ClientStore, CodeStore, TokenStore, AccessTokenRecord } from './oauth-store.js';
11
+ import type { IdentityProvider, AuthorizationRequest as AuthReq } from './identity.js';
12
+ export interface HttpResult {
13
+ status: number;
14
+ headers?: Record<string, string>;
15
+ body?: unknown;
16
+ }
17
+ export interface OAuthServerDeps {
18
+ publicUrl: string;
19
+ clients: ClientStore;
20
+ codes: CodeStore;
21
+ tokens: TokenStore;
22
+ identity: IdentityProvider;
23
+ defaultScope?: string;
24
+ }
25
+ export declare class OAuthServer {
26
+ private deps;
27
+ private readonly publicUrl;
28
+ private readonly scope;
29
+ constructor(deps: OAuthServerDeps);
30
+ get resourceId(): string;
31
+ /** RFC 9728 §5.1 challenge value for a 401 from the MCP endpoint. */
32
+ unauthorizedChallenge(): string;
33
+ protectedResourceMetadata(): HttpResult;
34
+ authorizationServerMetadata(): HttpResult;
35
+ register(body: any): HttpResult;
36
+ /**
37
+ * Validate an /authorize request (client, redirect_uri, response_type, PKCE) WITHOUT
38
+ * resolving identity. Used by the interactive login flow so the connector can stash the
39
+ * request and redirect to the ThinkRun login page before a userId exists.
40
+ */
41
+ prepareAuthorization(query: URLSearchParams): {
42
+ ok: true;
43
+ request: AuthReq;
44
+ } | {
45
+ ok: false;
46
+ result: HttpResult;
47
+ };
48
+ /** Issue an authorization code for a validated request + resolved userId → 302 to redirect_uri. */
49
+ issueCodeForRequest(request: AuthReq, userId: string): HttpResult;
50
+ private authError;
51
+ authorize(query: URLSearchParams): Promise<HttpResult>;
52
+ token(form: URLSearchParams): Promise<HttpResult>;
53
+ private tokenAuthCode;
54
+ private tokenRefresh;
55
+ /** Resource-server token check for the MCP endpoint (audience-bound). */
56
+ validateAccessToken(bearer: string | null): {
57
+ ok: true;
58
+ rec: AccessTokenRecord;
59
+ } | {
60
+ ok: false;
61
+ result: HttpResult;
62
+ };
63
+ }
64
+ //# sourceMappingURL=oauth-server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-server.d.ts","sourceRoot":"","sources":["../../../src/connector/oauth-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE9F,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,IAAI,OAAO,EAAE,MAAM,eAAe,CAAC;AAEvF,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,OAAO,CAAC;CA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