@prefecthq/fastmcp-ts 1.2.1 → 1.4.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.
@@ -1172,7 +1172,7 @@ var init_version = __esm({
1172
1172
  async run({ args }) {
1173
1173
  if (args.json) setJsonMode(true);
1174
1174
  const data = {
1175
- fastmcp: "1.2.1",
1175
+ fastmcp: "1.4.0",
1176
1176
  "mcp-sdk": "2.0.0",
1177
1177
  node: process.version,
1178
1178
  platform: `${process.platform} ${process.arch}`
@@ -33404,7 +33404,7 @@ var init_inspect = __esm({
33404
33404
  // only case Python's inspect supports); over --url/--command the
33405
33405
  // generation is unknowable from the wire.
33406
33406
  generation: mode.kind === "inprocess" ? 2 : null,
33407
- fastmcpVersion: "1.2.1",
33407
+ fastmcpVersion: "1.4.0",
33408
33408
  mcpVersion: "2.0.0",
33409
33409
  tools: tools2,
33410
33410
  prompts: prompts2,
@@ -46908,7 +46908,7 @@ init_format();
46908
46908
  var main = defineCommand({
46909
46909
  meta: {
46910
46910
  name: "fastmcp",
46911
- version: "1.2.1",
46911
+ version: "1.4.0",
46912
46912
  description: "FastMCP CLI \u2014 build, run, and manage MCP servers"
46913
46913
  },
46914
46914
  args: {
package/dist/server.d.ts CHANGED
@@ -1,11 +1,61 @@
1
1
  import * as _modelcontextprotocol_server from '@modelcontextprotocol/server';
2
2
  import { InputResponses, Server, CacheHint, ServerContext, ServerEventBus, Transport, McpHandlerRequestOptions, CallToolResult, OAuthClientInformationFull, AuthInfo } from '@modelcontextprotocol/server';
3
- export { InputRequest, InputRequests, InputRequiredResult, InputRequiredSpec, InputResponse, InputResponseView, InputResponses, ServerEventBus, acceptedContent, inputRequired, inputResponse, isInputRequiredResult } from '@modelcontextprotocol/server';
3
+ export { AuthInfo, InputRequest, InputRequests, InputRequiredResult, InputRequiredSpec, InputResponse, InputResponseView, InputResponses, McpHandlerRequestOptions, ServerEventBus, acceptedContent, inputRequired, inputResponse, isInputRequiredResult } from '@modelcontextprotocol/server';
4
4
  import { OAuthServerProvider, AuthorizationParams } from '@modelcontextprotocol/server-legacy/auth';
5
5
  import { StandardSchemaV1 } from '@standard-schema/spec';
6
6
  import { Readable, Writable } from 'node:stream';
7
7
  import { Response as Response$1 } from 'express';
8
8
 
9
+ /**
10
+ * Read-only, per-request snapshot of the HTTP request that carried the current
11
+ * MCP message. Present wherever the server is reached over an HTTP transport;
12
+ * `undefined` on stdio.
13
+ *
14
+ * REDACTION: credential headers (see {@link DEFAULT_SENSITIVE_HEADERS}, tuned
15
+ * by `FastMCPOptions.http`) are withheld from `headers` and listed in
16
+ * `redactedHeaderNames`, so a `null` lookup is never silent. The redaction
17
+ * guards accidental egress: tool results and logs flow into model context by
18
+ * design. A `RequestVerifier` receives the FULL wire headers instead (its
19
+ * `redactedHeaderNames` is empty): the verifier is the credential-handling
20
+ * code.
21
+ *
22
+ * TRUST: every value here is client-controlled input. Nothing in this object
23
+ * is authenticated. Do not derive authorization from it in handlers. For
24
+ * header-established identity (trusted reverse proxy), configure
25
+ * `FastMCPOptions.auth` with a `RequestVerifier` so identity flows through
26
+ * `ctx.auth` like every other authenticated request. See docs:
27
+ * servers/auth/trusted-proxy.
28
+ */
29
+ interface HttpRequestContext {
30
+ /** Headers of the carrying HTTP request, minus the sensitive set. A per-request copy; mutations affect nothing. */
31
+ readonly headers: Headers;
32
+ /** Names (lowercase, sorted) that were present on the wire but withheld from `headers`. */
33
+ readonly redactedHeaderNames: readonly string[];
34
+ /** HTTP method of the carrying request (e.g. 'POST'). */
35
+ readonly method: string;
36
+ /**
37
+ * Origin-form request target (path + query, e.g. '/mcp?tenant=a'). Scheme and
38
+ * authority are deliberately absent: behind a proxy this server cannot know
39
+ * the external URL. Reconstruct it from your proxy's forwarded headers if you
40
+ * need it.
41
+ */
42
+ readonly url: string;
43
+ }
44
+ /**
45
+ * Copy of `headers` that is safe to attach to an outbound request to another
46
+ * service. Drops credentials (authorization, cookie, proxy-*), hop-by-hop
47
+ * headers, message-framing headers (host, content-length, content-type,
48
+ * expect), and every `mcp-*` protocol header. Deployment-specific credential
49
+ * headers are covered by `FastMCPOptions.http.redactHeaders`: they are already
50
+ * absent from `ctx.http.headers`. `include` re-admits specific names.
51
+ * Re-admitting 'authorization' forwards the caller's credential; the MCP spec
52
+ * forbids passing the inbound token to upstream APIs, so mint your own
53
+ * upstream credential instead.
54
+ */
55
+ declare function forwardableHeaders(headers: Headers, options?: {
56
+ include?: string[];
57
+ }): Headers;
58
+
9
59
  interface AccessToken {
10
60
  /** The raw bearer token string. */
11
61
  token: string;
@@ -21,6 +71,34 @@ interface AccessToken {
21
71
  interface TokenVerifier {
22
72
  verify(token: string): Promise<AccessToken>;
23
73
  }
74
+ /**
75
+ * Request-level verifier for HTTP deployments where identity does not arrive
76
+ * as a bearer token. The typical case is a trusted reverse proxy that
77
+ * authenticates the caller and forwards the resolved identity as request
78
+ * headers.
79
+ *
80
+ * Called once per HTTP request, before dispatch, with that request's own FULL
81
+ * wire headers (no redaction; `request.redactedHeaderNames` is empty here —
82
+ * the verifier is the credential-handling code). Return an AccessToken to
83
+ * admit the request. The result becomes `ctx.auth`, feeds per-item `auth`
84
+ * checks and list filtering, and its `token` (hashed) keys response-cache
85
+ * partitioning. `token` MUST therefore be a stable, non-empty, per-identity
86
+ * value, such as the verified user id. The server rejects an empty `token`
87
+ * with HTTP 500. Throw `AuthorizationError` to produce 403; any other throw
88
+ * produces 401.
89
+ *
90
+ * SECURITY: request headers are forgeable by anyone who can reach this server
91
+ * directly. Trust them only after verifying provenance: a shared secret the
92
+ * proxy injects, mTLS, or network isolation. Add your provenance-secret
93
+ * header to `FastMCPOptions.http.redactHeaders` so it never surfaces in
94
+ * `ctx.http`. See docs: servers/auth/trusted-proxy.
95
+ *
96
+ * HTTP transports only. On stdio there is no HTTP request; configure a
97
+ * TokenVerifier if you need `FASTMCP_CLI_AUTH_TOKEN` support.
98
+ */
99
+ interface RequestVerifier {
100
+ verifyRequest(request: HttpRequestContext): Promise<AccessToken>;
101
+ }
24
102
  /**
25
103
  * Thrown by authorization checks to produce a 403 response.
26
104
  * Any other error thrown during verification produces a 401.
@@ -225,6 +303,16 @@ interface McpContext {
225
303
  auth: AccessToken | undefined;
226
304
  /** The MCP request ID for the current call. */
227
305
  requestId: string | undefined;
306
+ /**
307
+ * The HTTP request carrying the current MCP message, when serving over an
308
+ * HTTP transport; `undefined` on stdio. Fresh per request: on a sessionful
309
+ * connection each request's own headers appear here, never the
310
+ * initialize-time ones. Credential headers are withheld by default and
311
+ * listed in `http.redactedHeaderNames` (tune with `FastMCPOptions.http`).
312
+ * Untrusted input; see HttpRequestContext's docs before deriving any
313
+ * authorization from it.
314
+ */
315
+ http: HttpRequestContext | undefined;
228
316
  /** Send a log message to the client at the specified RFC 5424 severity level. */
229
317
  log(level: LogLevel, message: string, loggerName?: string): Promise<void>;
230
318
  debug(message: string, loggerName?: string): Promise<void>;
@@ -642,7 +730,7 @@ interface ResourceConfig {
642
730
  /** Arbitrary tags for server-side filtering. */
643
731
  tags?: string[];
644
732
  auth?: AuthCheck;
645
- /** Apps extension metadata. Included in _meta.ui in resources/list for UI-capable clients. */
733
+ /** Apps extension metadata. Included as `_meta.ui` on resources/list entries and on every resources/read content item for UI-capable clients. */
646
734
  ui?: ResourceUiMeta;
647
735
  /**
648
736
  * Autocompletion callbacks for this resource template's RFC 6570 variables,
@@ -663,12 +751,14 @@ declare class ResourceResult {
663
751
  mimeType?: string;
664
752
  text?: string;
665
753
  blob?: string;
754
+ _meta?: Record<string, unknown>;
666
755
  }>;
667
756
  constructor(contents: Array<{
668
757
  uri: string;
669
758
  mimeType?: string;
670
759
  text?: string;
671
760
  blob?: string;
761
+ _meta?: Record<string, unknown>;
672
762
  }>);
673
763
  }
674
764
 
@@ -688,10 +778,30 @@ interface OAuthConfig {
688
778
  interface FastMCPOptions {
689
779
  name: string;
690
780
  version?: string;
691
- /** Simple bearer-token verifier for non-OAuth auth scenarios. */
692
- auth?: TokenVerifier;
781
+ /**
782
+ * Bearer-token verifier, or a RequestVerifier for header-based
783
+ * (trusted-proxy) deployments. See each type's docs. A RequestVerifier
784
+ * applies to HTTP transports only; stdio's FASTMCP_CLI_AUTH_TOKEN needs a
785
+ * TokenVerifier. When both `oauth` and `auth` are set, `oauth` serves the
786
+ * endpoint and `auth` is ignored.
787
+ */
788
+ auth?: TokenVerifier | RequestVerifier;
693
789
  /** Full OAuth 2.1 server with Dynamic Client Registration support. */
694
790
  oauth?: OAuthConfig;
791
+ /**
792
+ * HTTP request context tuning for `ctx.http`. `redactHeaders` adds names to
793
+ * the sensitive set withheld from `ctx.http.headers` (defaults:
794
+ * authorization, cookie, proxy-authorization, mcp-session-id); use it for
795
+ * deployment-specific credentials such as a proxy shared-secret header.
796
+ * `exposeHeaders` removes names from the set; it is the explicit, greppable
797
+ * opt-out. Withheld names are listed in `ctx.http.redactedHeaderNames`.
798
+ * Redaction applies to `ctx.http` only; a RequestVerifier always sees the
799
+ * full wire headers.
800
+ */
801
+ http?: {
802
+ redactHeaders?: string[];
803
+ exposeHeaders?: string[];
804
+ };
695
805
  /** Maximum number of tools returned per listTools page. Default: 50. */
696
806
  toolsPageSize?: number;
697
807
  /** Maximum number of resources (or templates) returned per page. Default: 50. */
@@ -761,11 +871,14 @@ interface FastMCPOptions {
761
871
  */
762
872
  eventBus?: ServerEventBus;
763
873
  /**
764
- * DNS-rebinding protection for the HTTP transport: validates the `Host` and
765
- * `Origin` request headers (port-agnostic, by hostname) and rejects mismatches
766
- * with `403`. Defends localhost servers against a malicious web page whose DNS
767
- * rebinds to `127.0.0.1` (MCP transport security best practice). Only affects the
768
- * HTTP transport — stdio is unaffected.
874
+ * DNS-rebinding protection for the HTTP listener started by `run()`: validates
875
+ * the `Host` and `Origin` request headers (port-agnostic, by hostname) and rejects
876
+ * mismatches with `403`. Defends localhost servers against a malicious web page
877
+ * whose DNS rebinds to `127.0.0.1` (MCP transport security best practice).
878
+ *
879
+ * This option does not apply to `fetch()`, which has no bind address from which
880
+ * to infer a trusted host. A framework embedding `fetch()` owns Host/Origin
881
+ * validation at its HTTP boundary. stdio is unaffected.
769
882
  *
770
883
  * Default posture (option omitted): protection auto-enables when, and only when,
771
884
  * `run()` binds the HTTP server to a loopback host (`127.0.0.1`, `::1`,
@@ -853,6 +966,7 @@ declare class FastMCP {
853
966
  readonly version: string;
854
967
  private _auth;
855
968
  private _oauth;
969
+ private _sensitiveHeaders;
856
970
  private _toolsPageSize;
857
971
  private _resourcesPageSize;
858
972
  private _tools;
@@ -1138,6 +1252,19 @@ declare class FastMCP {
1138
1252
  */
1139
1253
  get isRunning(): boolean;
1140
1254
  connect(transport: Transport): Promise<void>;
1255
+ /**
1256
+ * Serve an MCP request through a web-standard, fetch-native HTTP entrypoint.
1257
+ *
1258
+ * This entrypoint is always stateless and does not require `run()`: legacy
1259
+ * (2025-era) requests use a fresh server instance per request, while modern
1260
+ * (2026-07-28) requests share the instance's modern handler and event bus.
1261
+ * Authentication is deliberately external — `options.authInfo` is trusted and
1262
+ * passed unchanged into the protocol handler, where it is exposed as `ctx.auth`.
1263
+ * The embedding framework also owns Host/Origin validation and should abort its
1264
+ * carrying requests during shutdown; stateless legacy response streams follow
1265
+ * that request lifecycle, while `close()` terminates modern exchanges and streams.
1266
+ */
1267
+ fetch(request: Request, options?: McpHandlerRequestOptions): Promise<Response>;
1141
1268
  /**
1142
1269
  * Modern-era (2026-07-28) in-process fetch entrypoint — the `McpServerLike`
1143
1270
  * duck-type hook `fastmcp-ts/client`'s `Client` looks for when a caller pins
@@ -1154,9 +1281,9 @@ declare class FastMCP {
1154
1281
  /** Lazily builds the modern (2026-07-28) HTTP handler. One per FastMCP instance;
1155
1282
  * builds a fresh Server (via _makeServer) per request, matching createMcpHandler's
1156
1283
  * per-request-factory model. Modern-only (legacy: 'reject') — legacy (2025-era)
1157
- * traffic is routed to the existing sessionful transport by _dispatchHttp instead
1158
- * of createMcpHandler's own stateless legacy fallback, so session state and the
1159
- * legacy server-initiated-request shim keep working for 2025-era clients. */
1284
+ * traffic is routed separately: to the existing sessionful transport by
1285
+ * _dispatchHttp, or to the stateless fallback by fetch(). This preserves the
1286
+ * session state and server-initiated-request shim for run()'s default HTTP path. */
1160
1287
  private _getModernHandler;
1161
1288
  /** Lazily builds the stateless legacy (2025-era) HTTP handler. One per FastMCP
1162
1289
  * instance, mirroring _getModernHandler's per-instance, per-request-factory model.
@@ -1165,8 +1292,9 @@ declare class FastMCP {
1165
1292
  * built with `sessionIdGenerator: undefined`, and answers GET and DELETE with 405
1166
1293
  * because both are session operations that mean nothing per request.
1167
1294
  *
1168
- * Only reachable when `_stateless` is on. The sessionful transport in
1169
- * _dispatchLegacyHttp is untouched and still serves every other deployment. */
1295
+ * Used unconditionally by fetch(), and by run() only when `_stateless` is on.
1296
+ * The sessionful transport in _dispatchLegacyHttp is untouched and remains the
1297
+ * default for listener-based HTTP deployments. */
1170
1298
  private _getStatelessLegacyHandler;
1171
1299
  /**
1172
1300
  * Dual-era HTTP dispatch shared by the OAuth and non-OAuth serve paths. Assumes CORS
@@ -1307,6 +1435,203 @@ type ProxyTransport = StdioTransport | HttpTransport;
1307
1435
  */
1308
1436
  declare function createProxy(config: ProxyTransport, name?: string): Promise<FastMCP>;
1309
1437
 
1438
+ /**
1439
+ * Shared types for the OpenAPI integration.
1440
+ *
1441
+ * The intermediate representation (HTTPRoute and friends) is a direct port of
1442
+ * Python FastMCP's `fastmcp.utilities.openapi.models` so the two
1443
+ * implementations generate identical MCP components from the same spec. The
1444
+ * parity contract is pinned by the snapshots in `tests/fixtures/openapi/`.
1445
+ */
1446
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' | 'HEAD' | 'TRACE';
1447
+ type ParameterLocation = 'path' | 'query' | 'header' | 'cookie';
1448
+ type JsonSchema = Record<string, unknown>;
1449
+ /** A single parameter of an HTTP operation. */
1450
+ interface ParameterInfo {
1451
+ name: string;
1452
+ location: ParameterLocation;
1453
+ required: boolean;
1454
+ schema: JsonSchema;
1455
+ description?: string;
1456
+ /** OpenAPI explode property for array/object serialization. */
1457
+ explode?: boolean;
1458
+ /** OpenAPI style property (form, spaceDelimited, pipeDelimited, deepObject, ...). */
1459
+ style?: string;
1460
+ }
1461
+ /** The request body of an HTTP operation, keyed by media type. */
1462
+ interface RequestBodyInfo {
1463
+ required: boolean;
1464
+ contentSchema: Record<string, JsonSchema>;
1465
+ description?: string;
1466
+ }
1467
+ /** The primary success response of an HTTP operation, keyed by media type. */
1468
+ interface ResponseInfo {
1469
+ description?: string;
1470
+ contentSchema: Record<string, JsonSchema>;
1471
+ }
1472
+ /** Where a flattened tool argument goes when the HTTP request is built. */
1473
+ interface ParameterMapping {
1474
+ location: ParameterLocation | 'body';
1475
+ openapiName: string;
1476
+ }
1477
+ /** Intermediate representation of a single OpenAPI operation. */
1478
+ interface HTTPRoute {
1479
+ path: string;
1480
+ method: HttpMethod;
1481
+ operationId?: string;
1482
+ summary?: string;
1483
+ description?: string;
1484
+ tags: string[];
1485
+ parameters: ParameterInfo[];
1486
+ requestBody?: RequestBodyInfo;
1487
+ /** Only the primary success response, keyed by its status code string. */
1488
+ responses: Record<string, ResponseInfo>;
1489
+ /** Schema definitions needed by the input (parameters + request body). */
1490
+ requestSchemas: Record<string, JsonSchema>;
1491
+ /** Schema definitions needed by the output (responses). */
1492
+ responseSchemas: Record<string, JsonSchema>;
1493
+ /** `x-` extension fields found on the operation. */
1494
+ extensions: Record<string, unknown>;
1495
+ openapiVersion?: string;
1496
+ /** Pre-calculated flat input schema advertised on the MCP tool. */
1497
+ flatParamSchema: JsonSchema;
1498
+ /** Maps flat argument names back to their OpenAPI locations. */
1499
+ parameterMap: Record<string, ParameterMapping>;
1500
+ }
1501
+ /** Type of FastMCP component to create from a route. */
1502
+ type MCPType = 'tool' | 'resource' | 'resourceTemplate' | 'exclude';
1503
+ /** Mapping rule from HTTP routes to FastMCP component types. */
1504
+ interface RouteMap {
1505
+ /** HTTP methods to match. `'*'` (default) matches every method. */
1506
+ methods?: HttpMethod[] | '*';
1507
+ /** Pattern searched (unanchored) against the route path. Default matches all. */
1508
+ pattern?: RegExp | string;
1509
+ /** Tags that must ALL be present on the route for the map to match. */
1510
+ tags?: string[];
1511
+ /** The component type to create for matching routes. */
1512
+ mcpType: MCPType;
1513
+ /** Extra tags applied to components created by this map. */
1514
+ mcpTags?: string[];
1515
+ }
1516
+ /**
1517
+ * Advanced route-type hook, run after the route maps on every non-excluded
1518
+ * route. Return a new MCPType to override, or null/undefined to keep the
1519
+ * mapped type. Exceptions are swallowed with a warning.
1520
+ */
1521
+ type RouteMapFn = (route: HTTPRoute, mcpType: MCPType) => MCPType | null | undefined;
1522
+ /** Mutable pre-registration view of a generated tool. */
1523
+ interface OpenAPIToolComponent {
1524
+ kind: 'tool';
1525
+ name: string;
1526
+ description: string;
1527
+ inputSchema: JsonSchema;
1528
+ outputSchema?: JsonSchema;
1529
+ tags: string[];
1530
+ }
1531
+ /** Mutable pre-registration view of a generated resource. */
1532
+ interface OpenAPIResourceComponent {
1533
+ kind: 'resource';
1534
+ uri: string;
1535
+ name: string;
1536
+ description: string;
1537
+ mimeType: string;
1538
+ tags: string[];
1539
+ }
1540
+ /** Mutable pre-registration view of a generated resource template. */
1541
+ interface OpenAPIResourceTemplateComponent {
1542
+ kind: 'resourceTemplate';
1543
+ uriTemplate: string;
1544
+ name: string;
1545
+ description: string;
1546
+ mimeType: string;
1547
+ parameters: JsonSchema;
1548
+ tags: string[];
1549
+ }
1550
+ type OpenAPIComponent = OpenAPIToolComponent | OpenAPIResourceComponent | OpenAPIResourceTemplateComponent;
1551
+ /**
1552
+ * Component customization hook, called with each generated component before
1553
+ * registration. Mutate the component in place (rename, edit description,
1554
+ * adjust tags or schemas). Exceptions are swallowed with a warning.
1555
+ */
1556
+ type ComponentFn = (route: HTTPRoute, component: OpenAPIComponent) => void;
1557
+
1558
+ /**
1559
+ * HTTP execution for generated components.
1560
+ *
1561
+ * Port of Python FastMCP's `OpenAPITool.run` / `OpenAPIResource.read`
1562
+ * (`fastmcp.server.providers.openapi.components`): bare fetch with a timeout,
1563
+ * Python-compatible error messages (they surface as tool errors, so clients
1564
+ * may match on them), JSON responses as structuredContent with the
1565
+ * `x-fastmcp-wrap-result` unwrap applied, non-JSON as text.
1566
+ */
1567
+
1568
+ /** HTTP client configuration for a generated OpenAPI server. */
1569
+ interface OpenAPIClientOptions {
1570
+ /**
1571
+ * Base URL for requests. Defaults to the spec's first `servers` entry
1572
+ * (with server variables filled from their defaults). Required when the
1573
+ * spec has no absolute server URL.
1574
+ */
1575
+ baseUrl?: string;
1576
+ /** Default headers sent on every request. Request-specific headers win. */
1577
+ headers?: Record<string, string>;
1578
+ /** Async header provider, resolved per request (e.g. a token refresher). */
1579
+ auth?: {
1580
+ getHeaders(): Promise<Record<string, string>>;
1581
+ };
1582
+ /** Custom fetch implementation. Defaults to the global fetch. */
1583
+ fetch?: typeof globalThis.fetch;
1584
+ /** Per-request timeout in milliseconds. Default 30 000. */
1585
+ timeoutMs?: number;
1586
+ }
1587
+
1588
+ /**
1589
+ * createOpenAPIServer: build a FastMCP server from an OpenAPI 3.x spec.
1590
+ *
1591
+ * TypeScript port of Python FastMCP's `FastMCP.from_openapi` /
1592
+ * `OpenAPIProvider`. Components are generated eagerly: parse the spec into
1593
+ * routes, map each route to a component type, name it, derive its schemas,
1594
+ * and register it on a plain FastMCP with a forwarding handler that calls the
1595
+ * described HTTP API. Generated names and schemas match the Python
1596
+ * implementation byte for byte; the snapshots under `tests/fixtures/openapi/`
1597
+ * pin that contract.
1598
+ */
1599
+
1600
+ interface OpenAPIServerOptions {
1601
+ /** The OpenAPI 3.0/3.1 spec: a parsed object, or YAML/JSON text. */
1602
+ spec: Record<string, unknown> | string;
1603
+ /** Server name. Default 'OpenAPI Server'. */
1604
+ name?: string;
1605
+ /** Server version. Defaults to FastMCP's own default. */
1606
+ version?: string;
1607
+ /** HTTP client configuration (base URL, headers, auth, fetch, timeout). */
1608
+ client?: OpenAPIClientOptions;
1609
+ /** Route maps checked in order before the default (everything → tool). */
1610
+ routeMaps?: RouteMap[];
1611
+ /** Route-type hook, run after the route maps on every route. */
1612
+ routeMapFn?: RouteMapFn;
1613
+ /** Component customization hook, called before each registration. */
1614
+ componentFn?: ComponentFn;
1615
+ /** Overrides mapping operationId → component name. */
1616
+ names?: Record<string, string>;
1617
+ /** Tags added to every generated component. */
1618
+ tags?: string[];
1619
+ /**
1620
+ * When true (default), tools advertise the output schema extracted from
1621
+ * the spec. When false, a permissive schema is advertised instead (the
1622
+ * wrap-result marker is preserved).
1623
+ */
1624
+ validateOutput?: boolean;
1625
+ /** Remaining FastMCP options (auth, middleware, page sizes, ...). */
1626
+ serverOptions?: Omit<FastMCPOptions, 'name' | 'version'>;
1627
+ }
1628
+ /**
1629
+ * Create a FastMCP server from an OpenAPI 3.0/3.1 specification. Every
1630
+ * operation becomes an MCP component (tool by default; see `routeMaps`)
1631
+ * whose handler calls the described HTTP endpoint.
1632
+ */
1633
+ declare function createOpenAPIServer(options: OpenAPIServerOptions): FastMCP;
1634
+
1310
1635
  interface Component {
1311
1636
  type: string;
1312
1637
  props?: Record<string, unknown>;
@@ -1445,4 +1770,4 @@ declare class FormInput {
1445
1770
  constructor(options: FormInputOptions);
1446
1771
  }
1447
1772
 
1448
- export { type AccessToken, Approval, Area, type AuthCheck, AuthorizationError, type BackendToolConfig, Badge, Bar, type BrowserPermissions, Button, type CacheKeyFn, CachingMiddleware, CancellationMiddleware, type CatalogEntry, Choice, Column, type CompleteCallback, type CompletionContext, type CompletionResult, type Component, type CspPolicy, type ElicitationResult, type ElicitationSchema, type EntrypointConfig, ErrorNormalizationMiddleware, FastMCP, FastMCPApp, type FastMCPAppOptions, type FastMCPOptions, File, type FileHandle, type FileStorageAdapter, FileUpload, type FileUploadOptions, FilterTransform, ForEach, FormInput, type FormInputOptions, GenerativeUI, Grid, If, type IfNode, Image, Input, Line, type LogLevel, LoggingMiddleware, type McpContext, type Middleware, type MiddlewareContext, NamespaceTransform, type Next, type OAuthConfig, type OAuthProviderOptions, type OAuthProxyOptions, Pie, type PromptArgument, type PromptConfig, type PromptContent, type PromptMessage, PromptResult, type PromptView, PromptsAsTools, type ProxyTransport, RateLimitingMiddleware, type ResourceAnnotations, type ResourceConfig, ResourceResult, type ResourceUiMeta, type ResourceView, ResourcesAsTools, type Root, Row, type RunOptions, Rx, type SamplingMessage, type SamplingParams, type SamplingResult, Select, type ServerAddress, SizeLimitingMiddleware, type SynthesizedTool, Table, Text, type TokenVerifier, type ToolConfig, ToolResult, type ToolView, type Transform, type UiToolMeta, VersionFilter, type Visibility, actionRef, createProxy, debugTokenVerifier, introspectionVerifier, jwtVerifier, multiAuth, oauthProvider, oauthProxy, redescribeTool, renameTool, requireScopes, staticTokenVerifier };
1773
+ export { type AccessToken, Approval, Area, type AuthCheck, AuthorizationError, type BackendToolConfig, Badge, Bar, type BrowserPermissions, Button, type CacheKeyFn, CachingMiddleware, CancellationMiddleware, type CatalogEntry, Choice, Column, type CompleteCallback, type CompletionContext, type CompletionResult, type Component, type ComponentFn, type CspPolicy, type ElicitationResult, type ElicitationSchema, type EntrypointConfig, ErrorNormalizationMiddleware, FastMCP, FastMCPApp, type FastMCPAppOptions, type FastMCPOptions, File, type FileHandle, type FileStorageAdapter, FileUpload, type FileUploadOptions, FilterTransform, ForEach, FormInput, type FormInputOptions, GenerativeUI, Grid, type HTTPRoute, type HttpMethod, type HttpRequestContext, If, type IfNode, Image, Input, Line, type LogLevel, LoggingMiddleware, type MCPType, type McpContext, type Middleware, type MiddlewareContext, NamespaceTransform, type Next, type OAuthConfig, type OAuthProviderOptions, type OAuthProxyOptions, type OpenAPIClientOptions, type OpenAPIComponent, type OpenAPIResourceComponent, type OpenAPIResourceTemplateComponent, type OpenAPIServerOptions, type OpenAPIToolComponent, type ParameterInfo, Pie, type PromptArgument, type PromptConfig, type PromptContent, type PromptMessage, PromptResult, type PromptView, PromptsAsTools, type ProxyTransport, RateLimitingMiddleware, type RequestBodyInfo, type RequestVerifier, type ResourceAnnotations, type ResourceConfig, ResourceResult, type ResourceUiMeta, type ResourceView, ResourcesAsTools, type ResponseInfo, type Root, type RouteMap, type RouteMapFn, Row, type RunOptions, Rx, type SamplingMessage, type SamplingParams, type SamplingResult, Select, type ServerAddress, SizeLimitingMiddleware, type SynthesizedTool, Table, Text, type TokenVerifier, type ToolConfig, ToolResult, type ToolView, type Transform, type UiToolMeta, VersionFilter, type Visibility, actionRef, createOpenAPIServer, createProxy, debugTokenVerifier, forwardableHeaders, introspectionVerifier, jwtVerifier, multiAuth, oauthProvider, oauthProxy, redescribeTool, renameTool, requireScopes, staticTokenVerifier };