@lostgradient/mcp 0.1.0 → 0.2.1

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 (84) hide show
  1. package/README.md +68 -8
  2. package/dist/chunk-3ek3knfm.js +73 -0
  3. package/dist/{chunk-v14p4gng.js → chunk-3rr24vhh.js} +4 -1
  4. package/dist/chunk-6ekjtvcq.js +273 -0
  5. package/dist/chunk-7dpts3r9.js +909 -0
  6. package/dist/chunk-88nhf6xt.js +449 -0
  7. package/dist/{chunk-psnez3q2.js → chunk-k6fm3cmk.js} +23 -2
  8. package/dist/chunk-rxnyn7tf.js +19 -0
  9. package/dist/{chunk-mf3t0afg.js → chunk-wfty87ws.js} +1 -1
  10. package/dist/{chunk-wmkqd45r.js → chunk-xcf742mf.js} +1 -1
  11. package/dist/chunk-yf4nw40e.js +1102 -0
  12. package/dist/conformance.d.ts +43 -0
  13. package/dist/env.d.ts +1 -1
  14. package/dist/env.js +2 -2
  15. package/dist/environment-schema.d.ts +1 -1
  16. package/dist/environment-schema.js +1 -1
  17. package/dist/http/authenticate.d.ts +35 -0
  18. package/dist/http/authorization-header.d.ts +5 -0
  19. package/dist/http/grant-revocation-channel.d.ts +24 -0
  20. package/dist/http/handler.d.ts +32 -0
  21. package/dist/http/index.d.ts +27 -0
  22. package/dist/http/index.js +813 -0
  23. package/dist/http/request-context.d.ts +17 -0
  24. package/dist/http/responses.d.ts +11 -0
  25. package/dist/http/serving-layer.d.ts +18 -0
  26. package/dist/http/user-handler-cache.d.ts +37 -0
  27. package/dist/http/user-server-event-bus.d.ts +35 -0
  28. package/dist/index.d.ts +5 -1
  29. package/dist/index.js +230 -940
  30. package/dist/logger.d.ts +20 -0
  31. package/dist/logger.js +9 -5
  32. package/dist/oauth/authorize-endpoint.d.ts +5 -0
  33. package/dist/oauth/canonicalize-ip-address.d.ts +20 -0
  34. package/dist/oauth/client-authentication.d.ts +10 -0
  35. package/dist/oauth/client-metadata-documents.d.ts +52 -0
  36. package/dist/oauth/client-metadata-documents.js +19 -0
  37. package/dist/oauth/discovery-metadata.d.ts +19 -0
  38. package/dist/oauth/endpoint-rate-limits.d.ts +10 -0
  39. package/dist/oauth/endpoint-responses.d.ts +10 -0
  40. package/dist/oauth/index.d.ts +214 -0
  41. package/dist/oauth/index.js +69 -0
  42. package/dist/oauth/network-identity.d.ts +32 -0
  43. package/dist/oauth/pkce-validation.d.ts +2 -0
  44. package/dist/oauth/postgres/client-store.d.ts +12 -0
  45. package/dist/oauth/postgres/code-store.d.ts +14 -0
  46. package/dist/oauth/postgres/database.d.ts +18 -0
  47. package/dist/oauth/postgres/index.d.ts +11 -0
  48. package/dist/oauth/postgres/index.js +584 -0
  49. package/dist/oauth/postgres/schema.d.ts +1455 -0
  50. package/dist/oauth/postgres/token-store.d.ts +16 -0
  51. package/dist/oauth/postgres/transaction-store.d.ts +14 -0
  52. package/dist/oauth/redirect-uri-matching.d.ts +2 -0
  53. package/dist/oauth/registration-endpoint.d.ts +2 -0
  54. package/dist/oauth/request-body.d.ts +14 -0
  55. package/dist/oauth/revocation-endpoint.d.ts +2 -0
  56. package/dist/oauth/safe-public-https-fetch.d.ts +28 -0
  57. package/dist/oauth/scope-utilities.d.ts +15 -0
  58. package/dist/oauth/security-utilities.d.ts +8 -0
  59. package/dist/oauth/stores.d.ts +225 -0
  60. package/dist/oauth/stores.js +0 -0
  61. package/dist/oauth/testing/contract-fixtures.d.ts +134 -0
  62. package/dist/oauth/testing/index.d.ts +56 -0
  63. package/dist/oauth/testing/index.js +330 -0
  64. package/dist/oauth/token-endpoint.d.ts +2 -0
  65. package/dist/oauth-scope-configuration.d.ts +3 -0
  66. package/dist/rate-limit/in-memory-sliding-window-store.d.ts +3 -0
  67. package/dist/rate-limit/index.d.ts +23 -0
  68. package/dist/rate-limit/index.js +29 -0
  69. package/dist/rate-limit/mcp-concurrency-limiter.d.ts +26 -0
  70. package/dist/rate-limit/rate-limit-response.d.ts +1 -0
  71. package/dist/rate-limit/redis-sliding-window-store.d.ts +2 -0
  72. package/dist/rate-limit/request-rate-limiter.d.ts +10 -0
  73. package/dist/rate-limit/sliding-window-rate-limiter.d.ts +16 -0
  74. package/dist/scopes.d.ts +1 -1
  75. package/dist/server.d.ts +1 -1
  76. package/dist/sveltekit-mount-state.d.ts +4 -0
  77. package/dist/sveltekit-mount.d.ts +43 -0
  78. package/dist/sveltekit-mount.js +332 -0
  79. package/dist/tool-response.d.ts +6 -0
  80. package/dist/types/primitives.d.ts +1 -1
  81. package/dist/ui-extension-support.d.ts +2 -2
  82. package/dist/version.d.ts +1 -1
  83. package/dist/version.js +1 -1
  84. package/package.json +56 -4
@@ -0,0 +1,332 @@
1
+ import {
2
+ handleOauthAuthorizationMetadataGet,
3
+ handleOauthAuthorizeApprove,
4
+ handleOauthAuthorizeDeny,
5
+ handleOauthAuthorizeGet,
6
+ handleOauthProtectedResourceMcpMetadataGet,
7
+ handleOauthProtectedResourceMetadataGet,
8
+ handleOauthRegisterPost,
9
+ handleOauthRevokePost,
10
+ handleOauthTokenPost,
11
+ oauthCorsHeaders
12
+ } from "./chunk-yf4nw40e.js";
13
+ import {
14
+ isValidCidr
15
+ } from "./chunk-88nhf6xt.js";
16
+ import"./chunk-3ek3knfm.js";
17
+ import {
18
+ getSupportedScopes
19
+ } from "./chunk-rxnyn7tf.js";
20
+ import"./chunk-k6fm3cmk.js";
21
+ import"./chunk-3rr24vhh.js";
22
+ import"./chunk-xcf742mf.js";
23
+
24
+ // src/sveltekit-mount-state.ts
25
+ var mountState = "available";
26
+ function getSvelteKitMountState() {
27
+ return mountState;
28
+ }
29
+ function setSvelteKitMountState(state) {
30
+ mountState = state;
31
+ }
32
+
33
+ // src/sveltekit-mount.ts
34
+ var primedIdentities = new WeakMap;
35
+ var requiredOauthSeamFunctions = [
36
+ "fetchClientIdMetadataDocument",
37
+ "resolveIdentityBinding",
38
+ "resolveUserProfile",
39
+ "handleUnauthenticatedAuthorization",
40
+ "renderConsent",
41
+ "hashCredential"
42
+ ];
43
+ function assertOauthSeamObject(value, path) {
44
+ if (!value || typeof value !== "object") {
45
+ throw new Error(`The SvelteKit MCP mount requires the OAuth host seam "${path}".`);
46
+ }
47
+ }
48
+ function assertOauthSeamFunctions(value, path, names) {
49
+ for (const name of names) {
50
+ if (typeof value[name] !== "function") {
51
+ throw new Error(`The SvelteKit MCP mount requires the OAuth host seam "${path}.${name}".`);
52
+ }
53
+ }
54
+ }
55
+ function assertOauthSeamNumber(value, path, minimumExclusive) {
56
+ if (typeof value !== "number" || !Number.isFinite(value) || value <= minimumExclusive) {
57
+ throw new Error(`The SvelteKit MCP mount requires the OAuth host seam "${path}".`);
58
+ }
59
+ }
60
+ function assertOauthStore(stores, name, requiredFunctions) {
61
+ assertOauthSeamObject(stores[name], `stores.${name}`);
62
+ assertOauthSeamFunctions(stores[name], `stores.${name}`, requiredFunctions);
63
+ }
64
+ function assertRequiredOauthSeams(seams) {
65
+ for (const name of requiredOauthSeamFunctions) {
66
+ if (typeof seams[name] !== "function") {
67
+ throw new Error(`The SvelteKit MCP mount requires the OAuth host seam "${name}".`);
68
+ }
69
+ }
70
+ if (seams.recordEvent !== undefined && typeof seams.recordEvent !== "function") {
71
+ throw new Error('The SvelteKit MCP mount requires the OAuth host seam "recordEvent".');
72
+ }
73
+ if (seams.crossInstanceMessaging !== undefined) {
74
+ assertOauthSeamObject(seams.crossInstanceMessaging, "crossInstanceMessaging");
75
+ assertOauthSeamFunctions(seams.crossInstanceMessaging, "crossInstanceMessaging", [
76
+ "publish",
77
+ "subscribe"
78
+ ]);
79
+ }
80
+ assertOauthSeamObject(seams.stores, "stores");
81
+ assertOauthStore(seams.stores, "transactions", [
82
+ "create",
83
+ "consume",
84
+ "unconsume",
85
+ "deleteByBinding",
86
+ "deleteAllForUser",
87
+ "purgeExpired"
88
+ ]);
89
+ assertOauthStore(seams.stores, "codes", [
90
+ "issue",
91
+ "findByHash",
92
+ "consume",
93
+ "unconsume",
94
+ "deleteAllForUser",
95
+ "purgeExpired"
96
+ ]);
97
+ assertOauthStore(seams.stores, "tokens", [
98
+ "issueAuthorizationGrant",
99
+ "findByHash",
100
+ "rotateRefreshToken",
101
+ "revokeAccessToken",
102
+ "revokeRefreshToken",
103
+ "revokeFamily",
104
+ "deleteAllForUser",
105
+ "purgeExpired"
106
+ ]);
107
+ assertOauthStore(seams.stores, "clients", ["register", "upsert", "findById", "update"]);
108
+ assertOauthSeamFunctions(seams.stores, "stores", ["deleteAllForUser"]);
109
+ assertOauthSeamObject(seams.scopes, "scopes");
110
+ assertOauthSeamObject(seams.scopes.vocabulary, "scopes.vocabulary");
111
+ assertOauthSeamFunctions(seams.scopes.vocabulary, "scopes.vocabulary", [
112
+ "isScope",
113
+ "defineTool",
114
+ "defineResource",
115
+ "definePrompt",
116
+ "defineRegistry"
117
+ ]);
118
+ if (!Array.isArray(seams.scopes.vocabulary.scopes)) {
119
+ throw new Error('The SvelteKit MCP mount requires the OAuth host seam "scopes.vocabulary.scopes".');
120
+ }
121
+ assertOauthSeamObject(seams.scopes.vocabulary.descriptions, "scopes.vocabulary.descriptions");
122
+ if (!Array.isArray(seams.scopes.supportedScopes)) {
123
+ throw new Error('The SvelteKit MCP mount requires the OAuth host seam "scopes.supportedScopes".');
124
+ }
125
+ for (const [index, scope] of seams.scopes.supportedScopes.entries()) {
126
+ if (typeof scope !== "string" || !seams.scopes.vocabulary.isScope(scope)) {
127
+ throw new Error(`The SvelteKit MCP mount requires the OAuth host seam "scopes.supportedScopes[${index}]".`);
128
+ }
129
+ }
130
+ assertOauthSeamObject(seams.configuration, "configuration");
131
+ const configuration = seams.configuration;
132
+ if (typeof configuration.issuer !== "string" || configuration.issuer.trim().length === 0) {
133
+ throw new Error('The SvelteKit MCP mount requires the OAuth host seam "configuration.issuer".');
134
+ }
135
+ for (const name of ["baseUrl", "resource"]) {
136
+ if (!(configuration[name] instanceof URL)) {
137
+ throw new Error(`The SvelteKit MCP mount requires the OAuth host seam "configuration.${name}".`);
138
+ }
139
+ }
140
+ for (const name of [
141
+ "accessTokenTtlSeconds",
142
+ "refreshTokenTtlSeconds",
143
+ "clientSecretTtlSeconds"
144
+ ]) {
145
+ assertOauthSeamNumber(configuration[name], `configuration.${name}`, 0);
146
+ }
147
+ assertOauthSeamFunctions(configuration, "configuration", ["isTrustedOrigin"]);
148
+ assertOauthSeamObject(configuration.trustedProxy, "configuration.trustedProxy");
149
+ if (!Array.isArray(configuration.trustedProxy.trustedProxyCidrs)) {
150
+ throw new Error('The SvelteKit MCP mount requires the OAuth host seam "configuration.trustedProxy.trustedProxyCidrs".');
151
+ }
152
+ for (const [index, cidr] of configuration.trustedProxy.trustedProxyCidrs.entries()) {
153
+ if (typeof cidr !== "string" || !isValidCidr(cidr)) {
154
+ throw new Error(`The SvelteKit MCP mount requires the OAuth host seam "configuration.trustedProxy.trustedProxyCidrs[${index}]".`);
155
+ }
156
+ }
157
+ if (configuration.trustedProxy.trustedProxyHeader !== undefined && !["x-forwarded-for", "forwarded", "cf-connecting-ip"].includes(configuration.trustedProxy.trustedProxyHeader)) {
158
+ throw new Error('The SvelteKit MCP mount requires the OAuth host seam "configuration.trustedProxy.trustedProxyHeader".');
159
+ }
160
+ assertOauthSeamNumber(configuration.trustedProxy.trustedProxyHopCount, "configuration.trustedProxy.trustedProxyHopCount", -1);
161
+ if (!Number.isInteger(configuration.trustedProxy.trustedProxyHopCount)) {
162
+ throw new Error('The SvelteKit MCP mount requires the OAuth host seam "configuration.trustedProxy.trustedProxyHopCount".');
163
+ }
164
+ assertOauthSeamObject(configuration.rateLimits, "configuration.rateLimits");
165
+ assertOauthSeamNumber(configuration.rateLimits.maximumConcurrent, "configuration.rateLimits.maximumConcurrent", 0);
166
+ assertOauthSeamObject(configuration.rateLimits.categories, "configuration.rateLimits.categories");
167
+ for (const category of [
168
+ "oauth_authorize",
169
+ "oauth_register",
170
+ "oauth_token_network",
171
+ "oauth_token_client",
172
+ "oauth_revoke",
173
+ "mcp_network",
174
+ "mcp_user",
175
+ "failed_authentication"
176
+ ]) {
177
+ const path = `configuration.rateLimits.categories.${category}`;
178
+ assertOauthSeamObject(configuration.rateLimits.categories[category], path);
179
+ assertOauthSeamNumber(configuration.rateLimits.categories[category].maximumRequests, `${path}.maximumRequests`, 0);
180
+ assertOauthSeamNumber(configuration.rateLimits.categories[category].windowSeconds, `${path}.windowSeconds`, 0);
181
+ }
182
+ assertOauthSeamObject(configuration.mcpUiExtension, "configuration.mcpUiExtension");
183
+ if (typeof configuration.mcpUiExtension.enabled !== "boolean") {
184
+ throw new Error('The SvelteKit MCP mount requires the OAuth host seam "configuration.mcpUiExtension.enabled".');
185
+ }
186
+ if (configuration.rateLimitStores !== undefined) {
187
+ assertOauthSeamObject(configuration.rateLimitStores, "configuration.rateLimitStores");
188
+ assertOauthSeamObject(configuration.rateLimitStores.slidingWindow, "configuration.rateLimitStores.slidingWindow");
189
+ assertOauthSeamFunctions(configuration.rateLimitStores.slidingWindow, "configuration.rateLimitStores.slidingWindow", ["consume", "peek"]);
190
+ if (configuration.rateLimitStores.concurrencySlots !== undefined) {
191
+ assertOauthSeamObject(configuration.rateLimitStores.concurrencySlots, "configuration.rateLimitStores.concurrencySlots");
192
+ assertOauthSeamFunctions(configuration.rateLimitStores.concurrencySlots, "configuration.rateLimitStores.concurrencySlots", ["acquire", "renew", "release"]);
193
+ }
194
+ }
195
+ }
196
+ function assertMountConfigurationAgreement(input) {
197
+ const expectedScopes = getSupportedScopes(input.registry);
198
+ const configuredScopes = [...input.oauthSeams.scopes.supportedScopes].sort((left, right) => left < right ? -1 : left > right ? 1 : 0);
199
+ if (expectedScopes.length !== configuredScopes.length || expectedScopes.some((scope, index) => scope !== configuredScopes[index])) {
200
+ throw new Error('The SvelteKit MCP mount requires "scopes.supportedScopes" to match the mounted registry.');
201
+ }
202
+ const oauthConfiguration = input.oauthSeams.configuration;
203
+ const discoveryConfiguration = input.discoveryConfiguration;
204
+ if (oauthConfiguration.baseUrl.href !== `${oauthConfiguration.baseUrl.origin}/`) {
205
+ throw new Error('The SvelteKit MCP mount requires "configuration.baseUrl" to be an origin-only URL.');
206
+ }
207
+ if (discoveryConfiguration.issuer !== oauthConfiguration.issuer) {
208
+ throw new Error('The SvelteKit MCP mount requires "discoveryConfiguration.issuer" to match the OAuth host seams.');
209
+ }
210
+ if (discoveryConfiguration.baseUrl.href !== oauthConfiguration.baseUrl.href) {
211
+ throw new Error('The SvelteKit MCP mount requires "discoveryConfiguration.baseUrl" to match the OAuth host seams.');
212
+ }
213
+ if (discoveryConfiguration.resource.href !== oauthConfiguration.resource.href) {
214
+ throw new Error('The SvelteKit MCP mount requires "discoveryConfiguration.resource" to match the OAuth host seams.');
215
+ }
216
+ if (discoveryConfiguration.mcpUiExtension.enabled !== oauthConfiguration.mcpUiExtension.enabled) {
217
+ throw new Error('The SvelteKit MCP mount requires "discoveryConfiguration.mcpUiExtension" to match the OAuth host seams.');
218
+ }
219
+ }
220
+ function primeSvelteKitMcpIdentity(event, identity) {
221
+ primedIdentities.set(event, identity);
222
+ }
223
+ function createStatelessSeams(seams, runtime) {
224
+ return {
225
+ scopes: seams.scopes,
226
+ configuration: seams.configuration,
227
+ crossInstanceMessaging: seams.crossInstanceMessaging,
228
+ recordEvent: seams.recordEvent,
229
+ stores: {
230
+ clients: seams.stores.clients,
231
+ codes: seams.stores.codes,
232
+ tokens: seams.stores.tokens
233
+ },
234
+ hashCredential: seams.hashCredential,
235
+ publishGrantRevocation: (subjectId) => runtime.publishGrantRevocation(subjectId)
236
+ };
237
+ }
238
+ function preflightResponse() {
239
+ return new Response(null, { status: 204, headers: oauthCorsHeaders });
240
+ }
241
+ async function createSvelteKitMcpMount(input) {
242
+ const mountState2 = getSvelteKitMountState();
243
+ if (mountState2 === "constructing" || mountState2 === "live") {
244
+ throw new Error("The SvelteKit MCP mount has already been constructed in this process.");
245
+ }
246
+ if (mountState2 === "disposed") {
247
+ throw new Error("The SvelteKit MCP mount cannot be constructed again after disposal or failure.");
248
+ }
249
+ setSvelteKitMountState("constructing");
250
+ try {
251
+ assertRequiredOauthSeams(input.oauthSeams);
252
+ assertMountConfigurationAgreement(input);
253
+ if (!input.longLivedProcess) {
254
+ throw new Error("The MCP mount requires a long-lived process; request-scoped edge and serverless runtimes cannot preserve subscription state.");
255
+ }
256
+ await input.mcp.start();
257
+ } catch (error) {
258
+ setSvelteKitMountState("disposed");
259
+ try {
260
+ await input.mcp.shutdown();
261
+ } catch (shutdownError) {
262
+ throw new AggregateError([error, shutdownError], "The SvelteKit MCP mount failed to start and its cleanup also failed.", { cause: shutdownError });
263
+ }
264
+ throw error;
265
+ }
266
+ setSvelteKitMountState("live");
267
+ const getStatelessSeams = () => createStatelessSeams(input.oauthSeams, input.mcp);
268
+ let disposed = false;
269
+ return {
270
+ async handle({ event, resolve }) {
271
+ if (disposed || getSvelteKitMountState() !== "live") {
272
+ throw new Error("The SvelteKit MCP mount is disposed.");
273
+ }
274
+ if (!primedIdentities.has(event)) {
275
+ throw new Error(`The SvelteKit MCP mount requires the prior ${input.identityHandleName} handle to prime identity for every request. Ensure it appears earlier in sequence() and does not skip conditional requests.`);
276
+ }
277
+ const context = {
278
+ request: event.request,
279
+ requestUrl: event.url,
280
+ requestId: input.getRequestId?.(event) ?? crypto.randomUUID(),
281
+ socketAddress: event.getClientAddress(),
282
+ identity: primedIdentities.get(event) ?? null
283
+ };
284
+ const method = event.request.method;
285
+ const path = event.url.pathname;
286
+ if (method === "OPTIONS" && (path.startsWith("/.well-known/") || path.startsWith("/oauth/"))) {
287
+ return preflightResponse();
288
+ }
289
+ if (method === "GET" && path === "/.well-known/oauth-authorization-server") {
290
+ return handleOauthAuthorizationMetadataGet(context, input.discoveryConfiguration, input.registry);
291
+ }
292
+ if (method === "GET" && path === "/.well-known/oauth-protected-resource") {
293
+ return handleOauthProtectedResourceMetadataGet(context, input.discoveryConfiguration, input.registry);
294
+ }
295
+ if (method === "GET" && path === "/.well-known/oauth-protected-resource/mcp") {
296
+ return handleOauthProtectedResourceMcpMetadataGet(context, input.discoveryConfiguration, input.registry);
297
+ }
298
+ if (method === "GET" && path === "/oauth/authorize") {
299
+ return handleOauthAuthorizeGet(context, input.oauthSeams);
300
+ }
301
+ if (method === "POST" && path === "/oauth/authorize/approve") {
302
+ return handleOauthAuthorizeApprove(context, input.oauthSeams);
303
+ }
304
+ if (method === "POST" && path === "/oauth/authorize/deny") {
305
+ return handleOauthAuthorizeDeny(context, input.oauthSeams);
306
+ }
307
+ if (method === "POST" && path === "/oauth/register") {
308
+ return handleOauthRegisterPost(context, getStatelessSeams());
309
+ }
310
+ if (method === "POST" && path === "/oauth/token") {
311
+ return handleOauthTokenPost(context, getStatelessSeams());
312
+ }
313
+ if (method === "POST" && path === "/oauth/revoke") {
314
+ return handleOauthRevokePost(context, getStatelessSeams());
315
+ }
316
+ if (path === "/mcp")
317
+ return input.mcp.handle(context);
318
+ return resolve(event);
319
+ },
320
+ async dispose() {
321
+ if (disposed)
322
+ return;
323
+ disposed = true;
324
+ setSvelteKitMountState("disposed");
325
+ await input.mcp.shutdown();
326
+ }
327
+ };
328
+ }
329
+ export {
330
+ createSvelteKitMcpMount,
331
+ primeSvelteKitMcpIdentity
332
+ };
@@ -53,6 +53,12 @@ export declare function createToolJsonResponse(data: unknown): {
53
53
  type: "text";
54
54
  text: string;
55
55
  }];
56
+ } | {
57
+ content: {
58
+ type: "text";
59
+ text: string;
60
+ }[];
61
+ isError: true;
56
62
  } | {
57
63
  isError: boolean;
58
64
  content: [{
@@ -32,7 +32,7 @@ export type McpContext = {
32
32
  /**
33
33
  * PROTO-002 / S-11: publishes a `notifications/resources/updated` event
34
34
  * for `uri`, scoped to only the authenticated user this context was
35
- * built for (see `applications/web/src/lib/mcp-user-event-bus.ts`).
35
+ * built for (see the HTTP package's per-user event bus).
36
36
  * Undefined when no event bus is wired for this request (e.g. a
37
37
  * standalone test context) — nothing to publish to in that case.
38
38
  */
@@ -10,8 +10,8 @@ import type { McpRegistry } from './scope-vocabulary.js';
10
10
  * even if the flag is turned on by mistake.
11
11
  *
12
12
  * This is the single source of truth for that predicate. `server.ts`'s
13
- * real `/mcp` capabilities and `oauth-routes.ts`'s authorization-server
14
- * metadata `extensions` field both call this function rather than each
13
+ * real `/mcp` capabilities and the OAuth discovery metadata handler both
14
+ * call this function rather than each
15
15
  * re-deriving their own copy of it, so a client can never discover UI
16
16
  * extension support in OAuth metadata and then receive server capabilities
17
17
  * without it (or vice versa) -- the two advertisements are mechanically
package/dist/version.d.ts CHANGED
@@ -20,4 +20,4 @@
20
20
  * thing making this approach safe — do not delete it to silence a release
21
21
  * bump; update this constant instead.
22
22
  */
23
- export declare const PACKAGE_VERSION = "0.1.0";
23
+ export declare const PACKAGE_VERSION = "0.2.1";
package/dist/version.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PACKAGE_VERSION
3
- } from "./chunk-mf3t0afg.js";
3
+ } from "./chunk-wfty87ws.js";
4
4
  export {
5
5
  PACKAGE_VERSION
6
6
  };
package/package.json CHANGED
@@ -1,9 +1,16 @@
1
1
  {
2
2
  "name": "@lostgradient/mcp",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "A Model Context Protocol server engine: registries, scope vocabularies, and an OAuth-ready request boundary.",
5
5
  "license": "MIT",
6
6
  "author": "Steve Kinney <hello@stevekinney.net>",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/stevekinney/protokit.git",
10
+ "directory": "packages/mcp"
11
+ },
12
+ "homepage": "https://github.com/stevekinney/protokit/tree/main/packages/mcp#readme",
13
+ "bugs": "https://github.com/stevekinney/protokit/issues",
7
14
  "type": "module",
8
15
  "sideEffects": false,
9
16
  "files": [
@@ -46,27 +53,72 @@
46
53
  "import": "./dist/version.js",
47
54
  "default": "./dist/version.js"
48
55
  },
56
+ "./oauth": {
57
+ "types": "./dist/oauth/index.d.ts",
58
+ "import": "./dist/oauth/index.js",
59
+ "default": "./dist/oauth/index.js"
60
+ },
61
+ "./oauth/stores": {
62
+ "types": "./dist/oauth/stores.d.ts",
63
+ "import": "./dist/oauth/stores.js",
64
+ "default": "./dist/oauth/stores.js"
65
+ },
66
+ "./oauth/testing": {
67
+ "types": "./dist/oauth/testing/index.d.ts",
68
+ "import": "./dist/oauth/testing/index.js",
69
+ "default": "./dist/oauth/testing/index.js"
70
+ },
71
+ "./oauth/postgres": {
72
+ "types": "./dist/oauth/postgres/index.d.ts",
73
+ "import": "./dist/oauth/postgres/index.js",
74
+ "default": "./dist/oauth/postgres/index.js"
75
+ },
76
+ "./oauth/client-metadata-documents": {
77
+ "types": "./dist/oauth/client-metadata-documents.d.ts",
78
+ "import": "./dist/oauth/client-metadata-documents.js",
79
+ "default": "./dist/oauth/client-metadata-documents.js"
80
+ },
81
+ "./rate-limit": {
82
+ "types": "./dist/rate-limit/index.d.ts",
83
+ "import": "./dist/rate-limit/index.js",
84
+ "default": "./dist/rate-limit/index.js"
85
+ },
86
+ "./http": {
87
+ "types": "./dist/http/index.d.ts",
88
+ "import": "./dist/http/index.js",
89
+ "default": "./dist/http/index.js"
90
+ },
91
+ "./sveltekit": {
92
+ "types": "./dist/sveltekit-mount.d.ts",
93
+ "import": "./dist/sveltekit-mount.js",
94
+ "default": "./dist/sveltekit-mount.js"
95
+ },
49
96
  "./package.json": "./package.json"
50
97
  },
51
98
  "scripts": {
52
99
  "build": "bun run build.ts",
53
100
  "lint": "eslint src/",
54
- "test": "LOG_LEVEL=info NODE_ENV=test DATABASE_URL=postgresql://test:test@localhost/test bun test",
55
- "test:conformance": "NODE_ENV=test MCP_CONFORMANCE_PORT=3137 bun ./src/conformance-server.ts",
101
+ "test": "LOG_LEVEL=info NODE_ENV=test MCP_SERVER_NAME=protokit-mcp-server DATABASE_URL=postgresql://test:test@localhost/test bun test --path-ignore-patterns='src/oauth/postgres/index.test.ts'",
102
+ "test:postgres": "LOG_LEVEL=info NODE_ENV=test MCP_SERVER_NAME=protokit-mcp-server DATABASE_URL=postgresql://protokit:protokit@localhost:5432/protokit_test bun test src/oauth/postgres/index.test.ts",
103
+ "test:conformance": "NODE_ENV=test MCP_SERVER_NAME=protokit-mcp-server MCP_CONFORMANCE_PORT=3137 bun ./src/conformance-server.ts",
56
104
  "typecheck": "tsc --noEmit",
105
+ "verify:cimd-runtime": "bun run build && bun run verify-cimd-runtime.ts && node --experimental-strip-types verify-cimd-runtime.ts",
57
106
  "verify:package": "bun run verify-package.ts"
58
107
  },
59
108
  "dependencies": {
109
+ "@modelcontextprotocol/client": "^2.0.0",
60
110
  "@modelcontextprotocol/core": "^2.0.0",
61
111
  "@modelcontextprotocol/ext-apps": "^1.7.5",
62
112
  "@modelcontextprotocol/node": "^2.0.0",
63
113
  "@modelcontextprotocol/server": "^2.0.0",
114
+ "drizzle-orm": "^0.45.2",
64
115
  "pino": "^10.3.1",
65
116
  "zod": "^4.4.3"
66
117
  },
67
118
  "devDependencies": {
68
- "@modelcontextprotocol/client": "^2.0.0",
69
119
  "@types/node": "^26.2.0",
120
+ "@types/pg": "^8.16.0",
121
+ "pg": "^8.16.3",
70
122
  "pino-pretty": "^13.1.3",
71
123
  "typescript": "6.0.3"
72
124
  }