@lostgradient/mcp 0.2.6 → 0.3.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 (123) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +15 -173
  3. package/dist/http.d.ts +35 -0
  4. package/dist/http.js +251 -0
  5. package/dist/internal/cryptography/encryption.d.ts +108 -0
  6. package/dist/internal/cryptography/encryption.js +241 -0
  7. package/dist/internal/cryptography/hash.d.ts +72 -0
  8. package/dist/internal/cryptography/hash.js +233 -0
  9. package/dist/internal/cryptography/index.d.ts +4 -0
  10. package/dist/internal/cryptography/index.js +2 -0
  11. package/dist/oauth/canonicalize-ip-address.d.ts +0 -6
  12. package/dist/oauth/canonicalize-ip-address.js +113 -0
  13. package/dist/oauth/client-metadata-documents.d.ts +2 -22
  14. package/dist/oauth/client-metadata-documents.js +205 -19
  15. package/dist/oauth/index.d.ts +9 -213
  16. package/dist/oauth/index.js +6 -69
  17. package/dist/oauth/issuer.d.ts +103 -0
  18. package/dist/oauth/issuer.js +564 -0
  19. package/dist/oauth/postgres.d.ts +12 -0
  20. package/dist/oauth/postgres.js +76 -0
  21. package/dist/oauth/safe-public-https-fetch.d.ts +3 -5
  22. package/dist/oauth/safe-public-https-fetch.js +114 -0
  23. package/dist/oauth/security-utilities.d.ts +0 -3
  24. package/dist/oauth/security-utilities.js +93 -0
  25. package/dist/oauth-store.d.ts +108 -0
  26. package/dist/oauth-store.js +321 -0
  27. package/package.json +50 -124
  28. package/dist/chunk-3ek3knfm.js +0 -73
  29. package/dist/chunk-3rr24vhh.js +0 -28
  30. package/dist/chunk-5444sx3n.js +0 -916
  31. package/dist/chunk-6ekjtvcq.js +0 -273
  32. package/dist/chunk-k6fm3cmk.js +0 -132
  33. package/dist/chunk-r9atew6b.js +0 -449
  34. package/dist/chunk-rxnyn7tf.js +0 -19
  35. package/dist/chunk-taxyscge.js +0 -67
  36. package/dist/chunk-tkn6m6az.js +0 -1107
  37. package/dist/chunk-xcf742mf.js +0 -14
  38. package/dist/chunk-zrrf78wj.js +0 -4
  39. package/dist/conformance-fixture-registration.d.ts +0 -30
  40. package/dist/conformance-server.d.ts +0 -1
  41. package/dist/conformance.d.ts +0 -43
  42. package/dist/env.d.ts +0 -59
  43. package/dist/env.js +0 -9
  44. package/dist/environment-schema.d.ts +0 -29
  45. package/dist/environment-schema.js +0 -6
  46. package/dist/golden-prompts.d.ts +0 -42
  47. package/dist/handler-context.d.ts +0 -16
  48. package/dist/http/authenticate.d.ts +0 -35
  49. package/dist/http/authorization-header.d.ts +0 -5
  50. package/dist/http/grant-revocation-channel.d.ts +0 -24
  51. package/dist/http/handler.d.ts +0 -32
  52. package/dist/http/index.d.ts +0 -27
  53. package/dist/http/index.js +0 -870
  54. package/dist/http/listen-inspection.d.ts +0 -11
  55. package/dist/http/request-context.d.ts +0 -17
  56. package/dist/http/responses.d.ts +0 -13
  57. package/dist/http/serving-layer.d.ts +0 -25
  58. package/dist/http/user-handler-cache.d.ts +0 -37
  59. package/dist/http/user-server-event-bus.d.ts +0 -35
  60. package/dist/index.d.ts +0 -29
  61. package/dist/index.js +0 -616
  62. package/dist/localhost-request-validation.d.ts +0 -2
  63. package/dist/logger.d.ts +0 -59
  64. package/dist/logger.js +0 -18
  65. package/dist/long-running-operation-support.d.ts +0 -34
  66. package/dist/metrics.d.ts +0 -64
  67. package/dist/metrics.js +0 -6
  68. package/dist/oauth/authorize-endpoint.d.ts +0 -5
  69. package/dist/oauth/client-authentication.d.ts +0 -10
  70. package/dist/oauth/discovery-metadata.d.ts +0 -19
  71. package/dist/oauth/endpoint-rate-limits.d.ts +0 -10
  72. package/dist/oauth/endpoint-responses.d.ts +0 -10
  73. package/dist/oauth/network-identity.d.ts +0 -32
  74. package/dist/oauth/pkce-validation.d.ts +0 -2
  75. package/dist/oauth/postgres/client-store.d.ts +0 -12
  76. package/dist/oauth/postgres/code-store.d.ts +0 -14
  77. package/dist/oauth/postgres/database.d.ts +0 -59
  78. package/dist/oauth/postgres/index.d.ts +0 -11
  79. package/dist/oauth/postgres/index.js +0 -616
  80. package/dist/oauth/postgres/schema.d.ts +0 -1476
  81. package/dist/oauth/postgres/token-store.d.ts +0 -16
  82. package/dist/oauth/postgres/transaction-store.d.ts +0 -14
  83. package/dist/oauth/redirect-uri-matching.d.ts +0 -2
  84. package/dist/oauth/registration-endpoint.d.ts +0 -2
  85. package/dist/oauth/request-body.d.ts +0 -14
  86. package/dist/oauth/revocation-endpoint.d.ts +0 -2
  87. package/dist/oauth/scope-utilities.d.ts +0 -15
  88. package/dist/oauth/stores.d.ts +0 -225
  89. package/dist/oauth/stores.js +0 -0
  90. package/dist/oauth/testing/contract-fixtures.d.ts +0 -134
  91. package/dist/oauth/testing/index.d.ts +0 -56
  92. package/dist/oauth/testing/index.js +0 -330
  93. package/dist/oauth/token-endpoint.d.ts +0 -2
  94. package/dist/oauth-scope-configuration.d.ts +0 -3
  95. package/dist/prompts/index.d.ts +0 -5
  96. package/dist/prompts/summarize.d.ts +0 -4
  97. package/dist/rate-limit/in-memory-sliding-window-store.d.ts +0 -3
  98. package/dist/rate-limit/index.d.ts +0 -23
  99. package/dist/rate-limit/index.js +0 -29
  100. package/dist/rate-limit/mcp-concurrency-limiter.d.ts +0 -26
  101. package/dist/rate-limit/rate-limit-response.d.ts +0 -1
  102. package/dist/rate-limit/redis-sliding-window-store.d.ts +0 -2
  103. package/dist/rate-limit/request-rate-limiter.d.ts +0 -10
  104. package/dist/rate-limit/sliding-window-rate-limiter.d.ts +0 -16
  105. package/dist/resources/index.d.ts +0 -4
  106. package/dist/resources/user-profile.d.ts +0 -1
  107. package/dist/scope-vocabulary.d.ts +0 -127
  108. package/dist/scopes.d.ts +0 -49
  109. package/dist/server.d.ts +0 -113
  110. package/dist/supported-scopes.d.ts +0 -25
  111. package/dist/sveltekit-mount-state.d.ts +0 -4
  112. package/dist/sveltekit-mount.d.ts +0 -43
  113. package/dist/sveltekit-mount.js +0 -344
  114. package/dist/template-registry.d.ts +0 -16
  115. package/dist/tool-response.d.ts +0 -100
  116. package/dist/tools/get-user-profile.d.ts +0 -8
  117. package/dist/tools/index.d.ts +0 -16
  118. package/dist/tools/list-audit-events.d.ts +0 -11
  119. package/dist/type-assertions.d.ts +0 -1
  120. package/dist/types/primitives.d.ts +0 -130
  121. package/dist/ui-extension-support.d.ts +0 -20
  122. package/dist/version.d.ts +0 -23
  123. package/dist/version.js +0 -6
@@ -1,14 +0,0 @@
1
- // src/environment-schema.ts
2
- import { z } from "zod";
3
- function strictBooleanEnvironmentFlag(defaultValue) {
4
- return z.enum(["true", "false"]).optional().default(defaultValue ? "true" : "false").transform((value) => value === "true");
5
- }
6
- var mcpServerEnvironmentSchema = {
7
- MCP_SERVER_NAME: z.string().min(1),
8
- MCP_CONFORMANCE_MODE: strictBooleanEnvironmentFlag(false),
9
- LOG_LEVEL: z.enum(["fatal", "error", "warn", "info", "debug", "trace"]).optional().default("info"),
10
- NODE_ENV: z.enum(["development", "production", "test"]),
11
- LOG_CONTENT_DIAGNOSTICS_UNTIL: z.iso.datetime({ offset: true }).optional()
12
- };
13
-
14
- export { mcpServerEnvironmentSchema };
@@ -1,4 +0,0 @@
1
- // src/version.ts
2
- var PACKAGE_VERSION = "0.2.6";
3
-
4
- export { PACKAGE_VERSION };
@@ -1,30 +0,0 @@
1
- import type { McpServer } from '@modelcontextprotocol/server';
2
- /**
3
- * PROTO-002: test-only observability for `test_cancellable_operation`
4
- * below. A response reaching (or failing to reach) the client proves the
5
- * HTTP exchange was torn down on abort — the SDK's transport does that
6
- * regardless of whether a handler's own operation actually observed
7
- * cancellation. Proving the operation ITSELF stopped (the actual SEC-004
8
- * bug this wiring fixes: a timeout/abort that only rejects a wrapper
9
- * promise while the real work keeps running unobserved) needs a side
10
- * channel outside the response — these counters are it.
11
- * `mcp-handler.test.ts` asserts `completedCount` stays `0` well past the
12
- * fixture's full delay once the request was aborted early, which is only
13
- * true if the underlying `setTimeout` was genuinely cleared, not merely
14
- * abandoned.
15
- */
16
- export declare const cancellableOperationTestHooks: {
17
- completedCount: number;
18
- abortedCount: number;
19
- reset(): void;
20
- };
21
- /**
22
- * PROTO-002 / S-11: `resources/subscribe` and `resources/unsubscribe` are
23
- * registered unconditionally by `server.ts` (spec-compliant ack; real
24
- * delivery happens on the `subscriptions/listen` stream against a per-user
25
- * event bus — see that file's comment). This fixture no longer needs its
26
- * own interest-tracking map: it publishes directly to whatever URI the
27
- * caller names, and the SDK's own listen-router filters delivery to
28
- * whichever open streams actually opted into that URI.
29
- */
30
- export declare function registerConformanceFixtures(server: McpServer, publishResourceUpdate?: (uri: string) => Promise<void>): void;
@@ -1 +0,0 @@
1
- export {};
@@ -1,43 +0,0 @@
1
- import type { McpRegistry, McpScopeVocabulary } from './scope-vocabulary.js';
2
- import type { McpUserProfile } from './types/primitives.js';
3
- export type McpConformanceEra = 'modern' | 'legacy';
4
- export type McpConformanceResult = {
5
- readonly era: McpConformanceEra;
6
- readonly name: string;
7
- readonly status: 'passed' | 'failed';
8
- readonly error?: string;
9
- };
10
- export type McpConformanceIdentity = {
11
- readonly userId: string;
12
- readonly user: McpUserProfile;
13
- };
14
- export type ConsumerConformanceOptions<Scope extends string> = {
15
- readonly registry: McpRegistry<Scope>;
16
- readonly scopeVocabulary: McpScopeVocabulary<Scope>;
17
- readonly enableConformanceMode?: boolean;
18
- /** Stable application identity used for every stateless request. */
19
- readonly identity?: McpConformanceIdentity;
20
- };
21
- export type RunMcpConformanceOptions<Scope extends string> = Omit<ConsumerConformanceOptions<Scope>, 'enableConformanceMode'> & {
22
- readonly era: McpConformanceEra;
23
- /** Valid arguments for the consumer tools the harness should invoke. */
24
- readonly toolProbes?: Readonly<Record<string, Record<string, unknown>>>;
25
- /** Registry resource URIs the harness should read. */
26
- readonly resourceProbes?: readonly string[];
27
- /** Valid arguments for the consumer prompts the harness should get. */
28
- readonly promptProbes?: Readonly<Record<string, Record<string, string>>>;
29
- };
30
- /**
31
- * Creates the same stateless MCP boundary used by the standalone conformance
32
- * server, but against a consumer-owned registry and scope vocabulary.
33
- * Localhost DNS-rebinding validation is intentionally outside every mode
34
- * branch so enabling or disabling conformance fixtures cannot disable it.
35
- */
36
- export declare function createConsumerConformanceHandler<Scope extends string>(options: ConsumerConformanceOptions<Scope>): {
37
- fetch(request: Request): Promise<Response>;
38
- };
39
- /**
40
- * Exercises one protocol era and returns independently actionable results.
41
- * A failed behavior never prevents later behaviors from running.
42
- */
43
- export declare function runMcpConformance<Scope extends string>(options: RunMcpConformanceOptions<Scope>): Promise<readonly McpConformanceResult[]>;
package/dist/env.d.ts DELETED
@@ -1,59 +0,0 @@
1
- import { z } from 'zod';
2
- declare const mcpServerEnvironmentObject: z.ZodObject<{
3
- MCP_SERVER_NAME: z.ZodString;
4
- MCP_CONFORMANCE_MODE: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodEnum<{
5
- true: "true";
6
- false: "false";
7
- }>>>, z.ZodTransform<boolean, "true" | "false">>;
8
- LOG_LEVEL: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
9
- error: "error";
10
- info: "info";
11
- fatal: "fatal";
12
- warn: "warn";
13
- debug: "debug";
14
- trace: "trace";
15
- }>>>;
16
- NODE_ENV: z.ZodEnum<{
17
- development: "development";
18
- production: "production";
19
- test: "test";
20
- }>;
21
- LOG_CONTENT_DIAGNOSTICS_UNTIL: z.ZodOptional<z.ZodISODateTime>;
22
- }, z.core.$strip>;
23
- /**
24
- * Inferred from the parser's own schema object rather than from a
25
- * separately reconstructed `z.ZodObject<typeof mcpServerEnvironmentSchema>`.
26
- * The reconstructed form names the shape a second time, so wrapping or
27
- * refining `mcpServerEnvironmentObject` later would change what
28
- * `parseMcpServerEnvironment` returns while leaving this type describing
29
- * the old shape. One source of truth instead.
30
- */
31
- export type McpServerEnvironment = z.infer<typeof mcpServerEnvironmentObject>;
32
- /**
33
- * Parses a raw environment record into a validated `McpServerEnvironment`.
34
- *
35
- * A function taking the environment as an argument, rather than a
36
- * module-scope side effect reading `process.env` on import. Importing this
37
- * package must not impose its environment contract on the host before the
38
- * host has decided it wants a server at all — a library that throws during
39
- * module evaluation takes the whole import graph down with it, and a
40
- * consumer has no way to catch that or to supply a different environment.
41
- *
42
- * CONFIG-001 / BUG-001: an empty string is treated as unset. Otherwise a
43
- * variable that is declared but left blank behaves differently from one
44
- * never set at all — it bypasses `.default()` and, for a numeric field,
45
- * coerces to `0` rather than `NaN`. This is why the environment is
46
- * filtered here rather than handed to Zod directly.
47
- */
48
- export declare function parseMcpServerEnvironment(env: Record<string, string | undefined>): McpServerEnvironment;
49
- /**
50
- * Lazily parses and memoizes `process.env` on first access.
51
- *
52
- * Every internal caller goes through this rather than through a
53
- * module-scope constant, so the first read happens when something actually
54
- * needs a value — not when the module is loaded. Callers that need a fresh
55
- * read against a mutated `process.env` (tests, primarily) should call
56
- * `parseMcpServerEnvironment(process.env)` directly.
57
- */
58
- export declare function getEnvironment(): McpServerEnvironment;
59
- export {};
package/dist/env.js DELETED
@@ -1,9 +0,0 @@
1
- import {
2
- getEnvironment,
3
- parseMcpServerEnvironment
4
- } from "./chunk-3rr24vhh.js";
5
- import"./chunk-xcf742mf.js";
6
- export {
7
- getEnvironment,
8
- parseMcpServerEnvironment
9
- };
@@ -1,29 +0,0 @@
1
- import { z } from 'zod';
2
- /**
3
- * The raw Zod shape backing `packages/mcp`'s environment schema, factored
4
- * out of `env.ts` so it can be introspected without importing `env.ts`
5
- * itself — see `applications/web/src/environment-schema.ts` for the full
6
- * rationale (that file and this one exist for the same reason). This file
7
- * has no side effects: it never reads `process.env` and never throws.
8
- */
9
- export declare const mcpServerEnvironmentSchema: {
10
- MCP_SERVER_NAME: z.ZodString;
11
- MCP_CONFORMANCE_MODE: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodEnum<{
12
- true: "true";
13
- false: "false";
14
- }>>>, z.ZodTransform<boolean, "true" | "false">>;
15
- LOG_LEVEL: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
16
- error: "error";
17
- info: "info";
18
- fatal: "fatal";
19
- warn: "warn";
20
- debug: "debug";
21
- trace: "trace";
22
- }>>>;
23
- NODE_ENV: z.ZodEnum<{
24
- development: "development";
25
- production: "production";
26
- test: "test";
27
- }>;
28
- LOG_CONTENT_DIAGNOSTICS_UNTIL: z.ZodOptional<z.ZodISODateTime>;
29
- };
@@ -1,6 +0,0 @@
1
- import {
2
- mcpServerEnvironmentSchema
3
- } from "./chunk-xcf742mf.js";
4
- export {
5
- mcpServerEnvironmentSchema
6
- };
@@ -1,42 +0,0 @@
1
- /**
2
- * DIST-002: the golden-prompt evaluation set the ChatGPT plugin review
3
- * process asks for — "a golden-prompt evaluation set covering intended and
4
- * disallowed tool use, parameter extraction, authentication interruption,
5
- * and safe handling of untrusted content" (`ROADMAP.local.md`, `DIST-002`).
6
- *
7
- * This is a *specification*, not a recorded transcript. Running each prompt
8
- * against a real ChatGPT developer-mode connection and recording the actual
9
- * model behavior is the manual step this file cannot perform on its own —
10
- * ChatGPT is a hosted product with no CLI or scriptable equivalent, and this
11
- * repository has no live deployment (see `CHATGPT-REVIEW.md`). What this
12
- * file — and its structural test, `golden-prompts.test.ts` — CAN prove
13
- * without a live host or a real model: every tool/resource/prompt this set
14
- * references genuinely exists in the production registry (never the
15
- * conformance-only `list_audit_events` fixture `CONTENT-001`/`META-001`
16
- * excluded from it), every scope named is real, and every input parameter
17
- * named genuinely exists on that operation's own input schema — so the set
18
- * itself cannot silently drift out of sync with the server it describes.
19
- *
20
- * `expectedBehavior` states what a correctly-behaving model and server
21
- * SHOULD do, in prose a human reviewer (or a future automated harness) can
22
- * check a real transcript against. It is never a claim that this behavior
23
- * has been observed.
24
- */
25
- export type GoldenPromptCategory = 'intended-tool-use' | 'disallowed-tool-use' | 'parameter-extraction' | 'authentication-interruption' | 'untrusted-content-handling';
26
- export interface GoldenPrompt {
27
- /** Stable id for referencing this case from a review write-up. */
28
- readonly id: string;
29
- readonly category: GoldenPromptCategory;
30
- /** The exact prompt a reviewer types into ChatGPT once connected. */
31
- readonly prompt: string;
32
- /**
33
- * The tool, resource, or prompt name this case exercises, or `null` when
34
- * the case's whole point is that nothing in the production registry
35
- * should be reachable for it.
36
- */
37
- readonly operation: string | null;
38
- /** Real parameter names this prompt should cause the model to extract. */
39
- readonly expectedParameters: readonly string[];
40
- readonly expectedBehavior: string;
41
- }
42
- export declare const goldenPrompts: readonly GoldenPrompt[];
@@ -1,16 +0,0 @@
1
- type NotificationSender = (notification: {
2
- method: string;
3
- params: Record<string, unknown>;
4
- }) => Promise<void>;
5
- type RequestSender = (request: {
6
- method: string;
7
- params: Record<string, unknown>;
8
- }) => Promise<unknown>;
9
- export declare function readProgressToken(ctx: unknown): string | number | undefined;
10
- export declare function readSessionIdentifier(ctx: unknown): string | undefined;
11
- export declare function readNotificationSender(ctx: unknown): NotificationSender | undefined;
12
- export declare function readRequestSender(ctx: unknown): RequestSender | undefined;
13
- export declare function stringifyUnknown(value: unknown): string;
14
- export declare function parseSampledText(result: unknown): string;
15
- export declare function assertSamplingSupport(ctx: unknown): void;
16
- export {};
@@ -1,35 +0,0 @@
1
- import type { AuthInfo } from '@modelcontextprotocol/server';
2
- import type { OAuthRequestContext, ResolveUserProfile, TrustedProxyConfiguration } from '../oauth/index.js';
3
- import type { AccessToken, TokenStore } from '../oauth/stores.js';
4
- import type { RequestRateLimiter } from '../rate-limit/index.js';
5
- export type McpAuthenticationOutcome = 'success' | 'expired_or_invalid_token' | 'invalid_resource';
6
- export type McpAuthenticationConfiguration = {
7
- resource: URL;
8
- protocolVersion: string;
9
- supportedScopes: readonly string[];
10
- allowedOrigins: ReadonlySet<string>;
11
- maximumBearerTokenLength: number;
12
- maximumFailedAuthenticationAttempts: number;
13
- dnsRebindingProtection: boolean;
14
- trustedProxy: TrustedProxyConfiguration;
15
- };
16
- export type McpAuthenticationSeams = {
17
- tokens: TokenStore;
18
- resolveUserProfile: ResolveUserProfile;
19
- findTokenAndUserProfileByHash?(tokenHash: string): Promise<{
20
- token: AccessToken;
21
- profile: NonNullable<Awaited<ReturnType<ResolveUserProfile>>>;
22
- } | null>;
23
- hashCredential(value: string): string;
24
- rateLimiter: Pick<RequestRateLimiter, 'consume' | 'peek'>;
25
- recordEvent(outcome: McpAuthenticationOutcome, requestId?: string): void;
26
- };
27
- /**
28
- * Authenticates in this fixed order: rebinding, origin, preflight, lockout,
29
- * bearer scheme, bearer bounds and lookup, then resource audience.
30
- */
31
- export declare function authenticateMcpUser(input: {
32
- context: OAuthRequestContext;
33
- configuration: McpAuthenticationConfiguration;
34
- seams: McpAuthenticationSeams;
35
- }): Promise<Response | AuthInfo>;
@@ -1,5 +0,0 @@
1
- /** Parses the case-insensitive HTTP authentication scheme and its verbatim credential. */
2
- export declare function parseAuthorizationHeader(header: string | null | undefined): {
3
- scheme: string | undefined;
4
- credential: string | undefined;
5
- };
@@ -1,24 +0,0 @@
1
- import type { CrossInstanceMessaging } from '../oauth/index.js';
2
- export type GrantRevocationRetryConfiguration = {
3
- initialDelayMilliseconds: number;
4
- maximumDelayMilliseconds: number;
5
- };
6
- /** Coordinates live-stream closure after a committed grant revocation. */
7
- export declare class GrantRevocationChannel {
8
- private readonly closeLocalUser;
9
- private readonly messaging?;
10
- private readonly onError;
11
- private readonly retryConfiguration;
12
- private unsubscribe;
13
- private startup;
14
- private closeRequested;
15
- private finishRetryDelay;
16
- private retryDelayMilliseconds;
17
- constructor(closeLocalUser: (userId: string) => void | Promise<unknown>, messaging?: CrossInstanceMessaging | undefined, onError?: (error: unknown, userId?: string) => void, retryConfiguration?: GrantRevocationRetryConfiguration);
18
- start(): Promise<void>;
19
- publish(userId: string): Promise<void>;
20
- close(): Promise<void>;
21
- private subscribe;
22
- private waitBeforeRetry;
23
- private runLocalCloser;
24
- }
@@ -1,32 +0,0 @@
1
- import type { AuthInfo } from '@modelcontextprotocol/server';
2
- import type { McpRegistry } from '../scope-vocabulary.js';
3
- import type { CrossInstanceMessaging } from '../oauth/index.js';
4
- export type McpHandlerConfiguration = {
5
- protocolVersion: string;
6
- maximumRequestBodyBytes: number;
7
- maximumSubscriptionsPerUser: number;
8
- userHandlerSweepIntervalMilliseconds: number;
9
- userHandlerIdleMilliseconds: number;
10
- enableUiExtension: boolean;
11
- enableConformanceMode: boolean;
12
- };
13
- export type McpHandlerSeams = {
14
- messaging?: CrossInstanceMessaging;
15
- markServerOnlyCloseableStream?(response: Response): Response;
16
- reportDegradation(degradation: 'single_instance_messaging_fallback'): void;
17
- recordEvent(outcome: 'transport_failure' | 'insufficient_scope'): void;
18
- onError(error: unknown, operation: string, userId?: string): void;
19
- };
20
- export type McpServingHandler = {
21
- start(): Promise<void>;
22
- handle(request: Request, authInfo: AuthInfo): Promise<Response>;
23
- publishUserResourceUpdate(userId: string, uri: string): void;
24
- publishGrantRevocation(userId: string): Promise<void>;
25
- closeUser(userId: string): Promise<boolean>;
26
- shutdown(): Promise<void>;
27
- };
28
- export declare function createMcpServingHandler<Scope extends string>(input: {
29
- registry: McpRegistry<Scope>;
30
- configuration: McpHandlerConfiguration;
31
- seams: McpHandlerSeams;
32
- }): McpServingHandler;
@@ -1,27 +0,0 @@
1
- import * as authorizationHeaderModule from './authorization-header.js';
2
- import * as grantRevocationModule from './grant-revocation-channel.js';
3
- import * as handlerModule from './handler.js';
4
- import * as requestContextModule from './request-context.js';
5
- import * as responsesModule from './responses.js';
6
- import * as servingLayerModule from './serving-layer.js';
7
- import * as userHandlerCacheModule from './user-handler-cache.js';
8
- import * as userServerEventBusModule from './user-server-event-bus.js';
9
- export declare const parseAuthorizationHeader: typeof authorizationHeaderModule.parseAuthorizationHeader;
10
- export declare const GrantRevocationChannel: typeof grantRevocationModule.GrantRevocationChannel;
11
- export declare const createMcpServingHandler: typeof handlerModule.createMcpServingHandler;
12
- export declare const buildMcpAuthInfo: typeof requestContextModule.buildMcpAuthInfo;
13
- export declare const readMcpRequestAuthExtra: typeof requestContextModule.readMcpRequestAuthExtra;
14
- export declare const createMcpCorsHeaders: typeof responsesModule.createMcpCorsHeaders;
15
- export declare const createMcpProtocolErrorResponse: typeof responsesModule.createMcpProtocolErrorResponse;
16
- export declare const isMcpOriginAllowed: typeof responsesModule.isMcpOriginAllowed;
17
- export declare const createMcpHttpServingLayer: typeof servingLayerModule.createMcpHttpServingLayer;
18
- export declare const McpUserHandlerCache: typeof userHandlerCacheModule.McpUserHandlerCache;
19
- export declare const createUserServerEventBus: typeof userServerEventBusModule.createUserServerEventBus;
20
- export declare const CrossInstanceUserServerEventBus: typeof userServerEventBusModule.CrossInstanceUserServerEventBus;
21
- export type { McpAuthenticationConfiguration, McpAuthenticationOutcome, McpAuthenticationSeams, } from './authenticate.js';
22
- export type { GrantRevocationRetryConfiguration } from './grant-revocation-channel.js';
23
- export type { McpHandlerConfiguration, McpHandlerSeams, McpServingHandler } from './handler.js';
24
- export type { McpRequestAuthExtra } from './request-context.js';
25
- export type { McpHttpServingLayer } from './serving-layer.js';
26
- export type { McpHandlerLifecycleError, McpUserHandlerEntry } from './user-handler-cache.js';
27
- export type { McpMessagingError, UserServerEventBus } from './user-server-event-bus.js';