> ## 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/node

> Reference for the bijection/mcp/node entry point.

## Classes

* [McpRequestError](/api/classes/mcp_node.McpRequestError)
* [McpRequestJournal](/api/classes/mcp_node.McpRequestJournal)

## Interfaces

* [McpRequestStore](/api/interfaces/mcp_node.McpRequestStore)

## Type Aliases

### McpOperationBinding

Ƭ **McpOperationBinding**: `Object`

Retain discovery's immutable binding with the request: reading the request
back names the operation contract it was made under, even after a
deployment changed the tool.

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `operation` | `string` | - |
| `contract_digest` | `string` | - |
| `args` | [`ValidatorJSON`](/api/modules/values#validatorjson) | - |
| `bound?` | `Record`\<`string`, `string`> | Arguments the session supplies and the model never does. The retained request carries them, so recovery names the same request. |

***

### McpRequestRecord

Ƭ **McpRequestRecord**: `Object`

Persisted before dispatch; contains no credential.

#### Type declaration

| Name | Type |
| :- | :- |
| `request_key` | `string` |
| `session_id` | `string` |
| `tool` | `string` |
| `args` | `Record`\<`string`, `unknown`> |
| `url` | `string` |
| `binding` | [`McpOperationBinding`](/api/modules/mcp_node#mcpoperationbinding) |

## Functions

### withMcpDeadline

▸ **withMcpDeadline**\<`T`>(`execute`, `callerSignal?`): `Promise`\<`T`>

Bound one attempt, including asynchronous credential providers.

#### Type parameters

| Name |
| :- |
| `T` |

#### Parameters

| Name | Type |
| :- | :- |
| `execute` | (`signal`: `AbortSignal`) => `Promise`\<`T`> |
| `callerSignal?` | `AbortSignal` |

#### Returns

`Promise`\<`T`>

***

### durableMcpFetch

▸ **durableMcpFetch**(`options`): typeof `fetch`

Wrap one host execution's fetch, not a shared mutable conversation client.
`callId` must already be persisted by the host before this wrapper is used.
Reads pass through; selected writes get request metadata outside model inputs.
Use with Mastra's custom fetch. Eve uses its durable providedArguments hook.

#### Parameters

| Name | Type |
| :- | :- |
| `options` | `Object` |
| `options.journal` | [`McpRequestStore`](/api/interfaces/mcp_node.McpRequestStore) |
| `options.callId` | `string` |
| `options.sessionId` | `string` |
| `options.operations` | `Readonly`\<`Record`\<`string`, [`McpOperationBinding`](/api/modules/mcp_node#mcpoperationbinding)>> |
| `options.fetch?` | (`input`: `URL` \| `RequestInfo`, `init?`: `RequestInit`) => `Promise`\<`Response`>(`input`: `string` \| `URL` \| `Request`, `init?`: `RequestInit`) => `Promise`\<`Response`> |

#### Returns

typeof `fetch`

***

### eveMcpRequest

▸ **eveMcpRequest**(`sessionId`): (`context`: \{ `session`: \{ `id`: `string`  } ; `callId`: `string` ; `toolName`: `string`  }) => \{ `session_id`: `string` = sessionId; `request_key`: `string`  }

Eve persists the call ID and arguments in its workflow before execution.
Configure this value as toolCall.providedArguments.\_\_bijection\_request;
Eve hides it from the model and injects it after argument generation. Pin
the connection instance to one session for its lifetime.

#### Parameters

| Name | Type |
| :- | :- |
| `sessionId` | `string` |

#### Returns

`fn`

▸ (`context`): `Object`

##### Parameters

| Name | Type |
| :- | :- |
| `context` | `Object` |
| `context.session` | `Object` |
| `context.session.id` | `string` |
| `context.callId` | `string` |
| `context.toolName` | `string` |

##### Returns

`Object`

| Name | Type |
| :- | :- |
| `session_id` | `string` |
| `request_key` | `string` |

***

### connectMcp

▸ **connectMcp**(`options`): `Object`

Bind one session of one MCP server to a host's durable store. Credentials
are refreshed for every HTTP request and never enter the journal. Discovery
obtains each operation tool's binding, so callers do not hand-copy them.
Every request, a retained request read back included, goes to the server's
one endpoint as the session: its tool list, limits and call log apply to
all of them.

#### Parameters

| Name | Type |
| :- | :- |
| `options` | `Object` |
| `options.url` | `string` |
| `options.sessionId` | `string` |
| `options.getToken` | (`signal?`: `AbortSignal`) => `Promise`\<`string`> |
| `options.store` | [`McpRequestStore`](/api/interfaces/mcp_node.McpRequestStore) |
| `options.fetch?` | (`input`: `URL` \| `RequestInfo`, `init?`: `RequestInit`) => `Promise`\<`Response`>(`input`: `string` \| `URL` \| `Request`, `init?`: `RequestInit`) => `Promise`\<`Response`> |

#### Returns

`Object`

| Name | Type |
| :- | :- |
| `discover` | (`options?`: \{ `signal?`: `AbortSignal`  }) => `Promise`\<`any`> |
| `fetchForCall` | (`callId`: `string`) => (`input`: `URL` \| `RequestInfo`, `init?`: `RequestInit`) => `Promise`\<`Response`>(`input`: `string` \| `URL` \| `Request`, `init?`: `RequestInit`) => `Promise`\<`Response`> |
| `recover` | (`callId`: `string`, `request?`: \{ `signal?`: `AbortSignal`  }) => `Promise`\<`any`> |
| `status` | (`callId`: `string`, `request?`: \{ `signal?`: `AbortSignal`  }) => `Promise`\<`any`> |


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