> ## Documentation Index
> Fetch the complete documentation index at: https://fastmcp-ts.docs.prefect.io/llms.txt
> Use this file to discover all available pages before exploring further.

# FastMCP

Defined in: [server/FastMCP.ts:325](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/server/FastMCP.ts#L325)

## Constructors

### Constructor

```ts theme={null}
new FastMCP(options): FastMCP;
```

Defined in: [server/FastMCP.ts:374](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/server/FastMCP.ts#L374)

#### Parameters

##### options

[`FastMCPOptions`](/api/server/interfaces/FastMCPOptions)

#### Returns

`FastMCP`

## Properties

### name

```ts theme={null}
readonly name: string;
```

Defined in: [server/FastMCP.ts:326](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/server/FastMCP.ts#L326)

***

### version

```ts theme={null}
readonly version: string;
```

Defined in: [server/FastMCP.ts:327](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/server/FastMCP.ts#L327)

## Accessors

### address

#### Get Signature

```ts theme={null}
get address(): ServerAddress | null;
```

Defined in: [server/FastMCP.ts:1690](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/server/FastMCP.ts#L1690)

The bound address after run() resolves for the http transport. Null for stdio or before run().

##### Returns

[`ServerAddress`](/api/server/interfaces/ServerAddress) | `null`

## Methods

### \_addCloseCallback()

```ts theme={null}
_addCloseCallback(cb): void;
```

Defined in: [server/FastMCP.ts:1523](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/server/FastMCP.ts#L1523)

Register a callback invoked when this server is closed — used by proxy connections.

#### Parameters

##### cb

() => `Promise`\<`void`>

#### Returns

`void`

***

### \_dispatchPrompt()

```ts theme={null}
_dispatchPrompt(
   name, 
   args, 
   ctx): Promise<
  | InputRequiredResult
  | {
  description?: string;
  messages: PromptMessage[];
}>;
```

Defined in: [server/FastMCP.ts:1400](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/server/FastMCP.ts#L1400)

Dispatch a prompt render through this server's middleware chain using an inherited context.

#### Parameters

##### name

`string`

##### args

`Record`\<`string`, `string`>

##### ctx

[`McpContext`](/api/server/interfaces/McpContext)

#### Returns

`Promise`\<
\| `InputRequiredResult`
\| \{
`description?`: `string`;
`messages`: [`PromptMessage`](/api/server/interfaces/PromptMessage)\[];
}>

***

### \_dispatchResource()

```ts theme={null}
_dispatchResource(
   uri, 
   params, 
   ctx): Promise<unknown>;
```

Defined in: [server/FastMCP.ts:1360](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/server/FastMCP.ts#L1360)

Run a resource read through this server's middleware chain using an inherited context.
Returns the raw handler result so the parent can apply convertResourceResult with the
actual requested URI (important for template resources).

#### Parameters

##### uri

`string`

##### params

`Record`\<`string`, `string`> | `undefined`

##### ctx

[`McpContext`](/api/server/interfaces/McpContext)

#### Returns

`Promise`\<`unknown`>

***

### \_dispatchTool()

```ts theme={null}
_dispatchTool(
   name, 
   rawArgs, 
   ctx): Promise<
  | {
[key: string]: unknown;
}
  | InputRequiredResult>;
```

Defined in: [server/FastMCP.ts:1308](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/server/FastMCP.ts#L1308)

Dispatch a tool call through this server's middleware chain using an inherited context.
Used by parent servers to honour child-level middleware when routing mounted tool calls.

#### Parameters

##### name

`string`

##### rawArgs

`unknown`

##### ctx

[`McpContext`](/api/server/interfaces/McpContext)

#### Returns

`Promise`\<
\| \{
\[`key`: `string`]: `unknown`;
}
\| `InputRequiredResult`>

***

### \_modernFetch()

```ts theme={null}
_modernFetch(request, options?): Promise<Response>;
```

Defined in: [server/FastMCP.ts:1711](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/server/FastMCP.ts#L1711)

Modern-era (2026-07-28) in-process fetch entrypoint — the `McpServerLike`
duck-type hook `fastmcp-ts/client`'s `Client` looks for when a caller pins
modern era for an in-process server (`versionNegotiation: { mode: { pin:
'2026-07-28' } } }`). Delegates directly to the same `createMcpHandler`
instance the real HTTP modern path uses (`_getModernHandler`), so this is
the identical dispatch a real network connection would get — no sockets,
same code. Modern-only (`legacy: 'reject'`): a client using `'auto'` or
`'legacy'` negotiation instead goes through `connect()` + `InMemoryTransport`
(2025-era only), unaffected by this method.

#### Parameters

##### request

`Request`

##### options?

`McpHandlerRequestOptions`

#### Returns

`Promise`\<`Response`>

***

### \_removePrompt()

```ts theme={null}
_removePrompt(name): boolean;
```

Defined in: [server/FastMCP.ts:1291](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/server/FastMCP.ts#L1291)

#### Parameters

##### name

`string`

#### Returns

`boolean`

***

### \_removeResource()

```ts theme={null}
_removeResource(uri): boolean;
```

Defined in: [server/FastMCP.ts:1277](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/server/FastMCP.ts#L1277)

#### Parameters

##### uri

`string`

#### Returns

`boolean`

***

### \_removeTool()

```ts theme={null}
_removeTool(name): boolean;
```

Defined in: [server/FastMCP.ts:1270](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/server/FastMCP.ts#L1270)

#### Parameters

##### name

`string`

#### Returns

`boolean`

***

### addProvider()

```ts theme={null}
addProvider(provider): this;
```

Defined in: [server/FastMCP.ts:1532](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/server/FastMCP.ts#L1532)

Register a provider (FastMCPApp or FastMCP) on this server.
All tools, resources, and prompts from the provider are mounted without a prefix.
For FastMCPApp, pass provider.server; for FastMCP, pass directly.

#### Parameters

##### provider

\| `FastMCP`
\| \{
`server`: `FastMCP`;
}

#### Returns

`this`

***

### close()

```ts theme={null}
close(): Promise<void>;
```

Defined in: [server/FastMCP.ts:2018](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/server/FastMCP.ts#L2018)

#### Returns

`Promise`\<`void`>

***

### connect()

```ts theme={null}
connect(transport): Promise<void>;
```

Defined in: [server/FastMCP.ts:1694](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/server/FastMCP.ts#L1694)

#### Parameters

##### transport

`Transport`

#### Returns

`Promise`\<`void`>

***

### getContext()

```ts theme={null}
getContext(): McpContext;
```

Defined in: [server/FastMCP.ts:1683](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/server/FastMCP.ts#L1683)

#### Returns

[`McpContext`](/api/server/interfaces/McpContext)

***

### mount()

```ts theme={null}
mount(child, prefix?): this;
```

Defined in: [server/FastMCP.ts:1499](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/server/FastMCP.ts#L1499)

Mount a child server onto this server. All tools, resources, and prompts from the child become accessible via this server. Pass a prefix to namespace names and prevent collisions.

#### Parameters

##### child

`FastMCP`

##### prefix?

`string`

#### Returns

`this`

***

### notifyResourceUpdated()

```ts theme={null}
notifyResourceUpdated(uri): void;
```

Defined in: [server/FastMCP.ts:1164](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/server/FastMCP.ts#L1164)

Signal that a resource changed and any subscriber should re-read it. This is
the SINGLE change signal for resource updates across both eras — the legacy
per-session push and the modern subscriptions/listen bus are driven from here:

* Legacy connections (primary / stdio / legacy HTTP sessions) that called
  `resources/subscribe` for `uri` are pushed `notifications/resources/updated`
  directly on their live session (subscription set kept in per-session state).
* The modern handler's bus (W3) is published to as well; it does its own
  per-stream filtering, delivering only to `subscriptions/listen` streams that
  opted in to this URI. Optional chaining keeps it a no-op until the first
  modern HTTP request has actually built the handler.

Unsubscribed sessions (and the modern streams that never opted in) receive
nothing, so calling this for a URI with no subscribers is safe and cheap.

#### Parameters

##### uri

`string`

#### Returns

`void`

***

### prompt()

```ts theme={null}
prompt(config, handler): void;
```

Defined in: [server/FastMCP.ts:1248](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/server/FastMCP.ts#L1248)

#### Parameters

##### config

[`PromptConfig`](/api/server/interfaces/PromptConfig)

##### handler

(`args?`) => `unknown`

#### Returns

`void`

***

### resource()

```ts theme={null}
resource(config, handler): void;
```

Defined in: [server/FastMCP.ts:1259](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/server/FastMCP.ts#L1259)

#### Parameters

##### config

[`ResourceConfig`](/api/server/interfaces/ResourceConfig)

##### handler

(`params?`) => `unknown`

#### Returns

`void`

***

### run()

```ts theme={null}
run(options?): Promise<void>;
```

Defined in: [server/FastMCP.ts:1715](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/server/FastMCP.ts#L1715)

#### Parameters

##### options?

[`RunOptions`](/api/server/interfaces/RunOptions)

#### Returns

`Promise`\<`void`>

***

### tool()

#### Call Signature

```ts theme={null}
tool<S>(config, handler): void;
```

Defined in: [server/FastMCP.ts:1233](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/server/FastMCP.ts#L1233)

##### Type Parameters

###### S

`S` *extends* `StandardSchemaV1`\<`unknown`, `unknown`>

##### Parameters

###### config

`Omit`\<[`ToolConfig`](/api/server/interfaces/ToolConfig), `"input"`> & \{
`input`: `S`;
}

###### handler

(`args`) => `unknown`

##### Returns

`void`

#### Call Signature

```ts theme={null}
tool(config, handler): void;
```

Defined in: [server/FastMCP.ts:1238](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/server/FastMCP.ts#L1238)

##### Parameters

###### config

[`ToolConfig`](/api/server/interfaces/ToolConfig)

###### handler

(`args`) => `unknown`

##### Returns

`void`

***

### transform()

```ts theme={null}
transform(t): this;
```

Defined in: [server/FastMCP.ts:1299](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/server/FastMCP.ts#L1299)

Add a transform to the pipeline. Applied to list responses in registration order.

#### Parameters

##### t

[`Transform`](/api/server/interfaces/Transform)

#### Returns

`this`

***

### use()

```ts theme={null}
use(mw): this;
```

Defined in: [server/FastMCP.ts:1677](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/server/FastMCP.ts#L1677)

Add a middleware to the pipeline.

Can be called at any point before the first request arrives. `setup()` is
called immediately on the primary server so that notification handlers and
other server-level side-effects are active before `connect()` / `run()` is
called. HTTP sessions created after `use()` will also have `setup()` called
via `_makeServer()`.

#### Parameters

##### mw

[`Middleware`](/api/server/interfaces/Middleware)

#### Returns

`this`
