---
title: Mcp
description: Mcp protocol schemas
---

{/* ⚠️  AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs go in content/docs/guides/. */}

Model Context Protocol (MCP) — Reference & Binding Primitives

MCP itself is an external protocol defined by Anthropic

(https://modelcontextprotocol.io). The platform does NOT re-define

MCP's wire format, transport, or message shapes — that is the job

of the `@modelcontextprotocol/sdk` consumed by `@objectstack/mcp`.

This file defines only the two things the *platform* needs:

1. **MCPServerRef** — how a project references an external MCP

server (so an agent can mount its tools).

2. **MCPToolBinding** — how an MCP tool from a referenced server

is exposed as an ObjectStack [AIToolDefinition](AIToolDefinition) (alias,

visibility, approval policy).

Everything else (transport details, capability negotiation,

resource/prompt shapes, streaming, sampling) is handled by the SDK

at runtime and does not need a metadata representation.

<Callout type="info">
**Source:** `packages/spec/src/ai/mcp.zod.ts`
</Callout>

## TypeScript Usage

```typescript
import { MCPApprovalPolicy, MCPServerRef, MCPToolBinding, MCPTransport } from '@objectstack/spec/ai';
import type { MCPApprovalPolicy, MCPServerRef, MCPToolBinding, MCPTransport } from '@objectstack/spec/ai';

// Validate data
const result = MCPApprovalPolicy.parse(data);
```

---

## MCPApprovalPolicy

### Allowed Values

* `always`
* `never`
* `first_call`


---

## MCPServerRef

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **name** | `string` | ✅ | Machine name (snake_case) |
| **label** | `string` | ✅ | Display label |
| **transport** | `Enum<'stdio' \| 'http' \| 'websocket'>` | ✅ |  |
| **endpoint** | `string` | ✅ | Command (stdio) or URL (http/websocket) |
| **secretRef** | `string` | optional |  |
| **active** | `boolean` | ✅ |  |


---

## MCPToolBinding

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **server** | `string` | ✅ |  |
| **toolName** | `string` | ✅ |  |
| **aliasAs** | `string` | optional |  |
| **approval** | `Enum<'always' \| 'never' \| 'first_call'>` | ✅ |  |


---

## MCPTransport

### Allowed Values

* `stdio`
* `http`
* `websocket`


---

