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

# Module: mcp

> Reference for the bijection/mcp entry point.

## Type Aliases

### McpServerLimits

Ƭ **McpServerLimits**: `Object`

Limits one session may not exceed.

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `requestsPerMinute?` | `number` | Requests a session may make each minute. Default 60. |
| `pollsPerMinute?` | `number` | Status and recovery requests a session may make each minute. Default 30. |

***

### McpServerDefinition

Ƭ **McpServerDefinition**: `Object`

One MCP server: the tools it publishes and how its sessions start.

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `description` | `string` | What the server is for, as the console and `bijection mcp describe` show it. |
| `instructions?` | `string` | How to use the tools together, which every client receives when it connects and an agent reads before its own instructions: what to read first, which tool answers what, what never to do. At most 8 KiB. |
| `sessions` | [`SessionPolicy`](/api/modules/sessions#sessionpolicy) | - |
| `tools` | `Record`\<`string`, [`ToolDeclaration`](/api/modules/tools#tooldeclaration)> | - |
| `limits?` | [`McpServerLimits`](/api/modules/mcp#mcpserverlimits) | Request and poll bounds for every session, enforced by the engine. |

***

### McpServerDeclaration

Ƭ **McpServerDeclaration**: `Readonly`\<\{ `name`: `string` ; `description`: `string` ; `instructions`: `string` | `null` ; `sessions`: [`SessionPolicy`](/api/modules/sessions#sessionpolicy) ; `tools`: `Readonly`\<`Record`\<`string`, [`ToolDeclaration`](/api/modules/tools#tooldeclaration)>> ; `limits`: `Required`\<[`McpServerLimits`](/api/modules/mcp#mcpserverlimits)>  }>

A validated server declaration.

***

### McpModuleOptions

Ƭ **McpModuleOptions**: `Object`

What `mcpModule` needs beyond the servers themselves.

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `access` | [`AccessModel`](/api/interfaces/server.AccessModel) | The application's access model decides every session's authority. |
| `servers` | readonly [`McpServerDeclaration`](/api/modules/mcp#mcpserverdeclaration)\[] | - |
| `module?` | `string` | The module the bundle is the default export of. Default `mcp`, for `bijection/mcp.ts`. |
| `authorizationServers?` | readonly `string`\[] | For servers whose sessions are delegated: the identity providers a person's own client signs in with, by issuer URL. The deployment's auth configuration trusts them; the server advertises them as its authorization servers, and accepts their tokens issued for it. |

***

### McpSession

Ƭ **McpSession**: `Object`

What a function learns about the server session calling it.

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `id` | `string` | - |
| `server` | `string` | - |
| `actsFor` | \{ `type`: `string` ; `key`: `string`  } \| `null` | The object the session acts for, or null before verification and for a delegated session, which acts as its person. |
| `channel` | `string` | - |
| `expiresAt` | `number` | The session's stored cutoff, in epoch milliseconds. |

## Variables

### MAX\_INSTRUCTIONS

• `Const` **MAX\_INSTRUCTIONS**: `8192`

The longest a server's instructions may be, in characters.

## Functions

### mcpTables

▸ **mcpTables**(): `Object`

The session projection every server shares. Spread it into the
application's schema. It names who acts for what until when and
holds no business data or authority: what a session may do, and whether it
is live, is the engine's own record of it, decided by the access model on
every call.

#### Returns

`Object`

| Name | Type |
| :- | :- |
| `mcpSessions` | [`TableDefinition`](/api/classes/server.TableDefinition)\<[`VObject`](/api/classes/values.VObject)\<\{ `credential`: `string` ; `evidence`: `null` \| \{ reference?: string; method: string; } ; `expires_at`: `number` ; `principal`: `string` ; `tools`: \{ name: string; revision: string; }\[] ; `server`: `string` ; `channel`: `string` ; `audience`: `string` ; `acts_for`: `null` \| \{ type: string; key: string; } ; `started_at`: `number`  }, \{ `server`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `credential`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `principal`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `acts_for`: [`VUnion`](/api/classes/values.VUnion)\<`null` \| \{ `type`: `string` ; `key`: `string`  }, \[[`VNull`](/api/classes/values.VNull)\<`null`, `"required"`>, [`VObject`](/api/classes/values.VObject)\<\{ `type`: `string` ; `key`: `string`  }, \{ `type`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `key`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`>  }, `"required"`, `"type"` \| `"key"`>], `"required"`, `"type"` \| `"key"`> ; `audience`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `tools`: [`VArray`](/api/classes/values.VArray)\<\{ `name`: `string` ; `revision`: `string`  }\[], [`VObject`](/api/classes/values.VObject)\<\{ `name`: `string` ; `revision`: `string`  }, \{ `name`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `revision`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`>  }, `"required"`, `"name"` \| `"revision"`>, `"required"`> ; `channel`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `evidence`: [`VUnion`](/api/classes/values.VUnion)\<`null` \| \{ `reference`: `undefined` \| `string` ; `method`: `string`  }, \[[`VNull`](/api/classes/values.VNull)\<`null`, `"required"`>, [`VObject`](/api/classes/values.VObject)\<\{ `reference`: `undefined` \| `string` ; `method`: `string`  }, \{ `method`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `reference`: [`VString`](/api/classes/values.VString)\<`undefined` \| `string`, `"optional"`>  }, `"required"`, `"method"` \| `"reference"`>], `"required"`, `"method"` \| `"reference"`> ; `started_at`: [`VFloat64`](/api/classes/values.VFloat64)\<`number`, `"required"`> ; `expires_at`: [`VFloat64`](/api/classes/values.VFloat64)\<`number`, `"required"`>  }, `"required"`, `"credential"` \| `"evidence"` \| `"expires_at"` \| `"principal"` \| `"tools"` \| `"server"` \| `"channel"` \| `"audience"` \| `"acts_for"` \| `"started_at"` \| `"evidence.method"` \| `"evidence.reference"` \| `"acts_for.type"` \| `"acts_for.key"`>, \{ `by_principal`: \[`"principal"`, `"_creationTime"`] ; `by_server`: \[`"server"`, `"started_at"`, `"_creationTime"`]  }, \{}, \{}, `false`, \{}> |

***

### defineMcpServer

▸ **defineMcpServer**(`name`, `definition`): [`McpServerDeclaration`](/api/modules/mcp#mcpserverdeclaration)

Declare one MCP server, served at `/mcp/<name>`. Throws on an
inconsistent declaration.

#### Parameters

| Name | Type |
| :- | :- |
| `name` | `string` |
| `definition` | [`McpServerDefinition`](/api/modules/mcp#mcpserverdefinition) |

#### Returns

[`McpServerDeclaration`](/api/modules/mcp#mcpserverdeclaration)

***

### mcpSession

▸ **mcpSession**(`ctx`): `Promise`\<[`McpSession`](/api/modules/mcp#mcpsession) | `null`>

The server session calling this query or mutation, or null for every
other caller. A tool with no arguments learns its object here; the model
never names it. The engine admits a session's principal only while the
session is live, so a session read here is. This reads the session only:
the caller's rules still decide every row.

#### Parameters

| Name | Type |
| :- | :- |
| `ctx` | `any` |

#### Returns

`Promise`\<[`McpSession`](/api/modules/mcp#mcpsession) | `null`>

***

### mountMcp

▸ **mountMcp**(`http`, `servers`): `void`

Mount every server and its OAuth protected-resource metadata on
the application's router.

#### Parameters

| Name | Type |
| :- | :- |
| `http` | [`HttpRouter`](/api/classes/server.HttpRouter) |
| `servers` | `object` |

#### Returns

`void`

***

### mcpModule

▸ **mcpModule**(`options`): `Record`\<`string`, `unknown`> & \{ `isFunctionBundle`: `true`  }

The functions behind every declared server, as one function bundle: export
it as the default of `bijection/mcp.ts`.

#### Parameters

| Name | Type |
| :- | :- |
| `options` | [`McpModuleOptions`](/api/modules/mcp#mcpmoduleoptions) |

#### Returns

`Record`\<`string`, `unknown`> & \{ `isFunctionBundle`: `true`  }


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.