Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ The Model Context Protocol allows applications to provide context for LLMs in a
## Installation

```bash
npm install @modelcontextprotocol/sdk zod
npm install @modelcontextprotocol/sdk
# plus your preferred Standard Schema library, e.g.
npm install zod # if you follow the Zod examples below
```

This SDK has a **required peer dependency** on `zod` for schema validation. The SDK internally imports from `zod/v4`, but maintains backwards compatibility with projects using Zod v3.25 or later. You can use either API in your code by importing from `zod/v3` or `zod/v4`:
The SDK speaks [Standard Schema](https://standardschema.dev/) for validation. Bring any Standard Schema-compatible library (Zod, Valibot, ArkType, etc). Examples below use Zod, and the SDK still supports both Zod v3.25+ and v4.

## Quick Start

Expand Down Expand Up @@ -161,6 +163,8 @@ const server = new McpServer({
[Tools](https://modelcontextprotocol.io/specification/latest/server/tools) let LLMs take actions through your server. Tools can perform computation, fetch data and have side effects. Tools should be designed to be model-controlled - i.e. AI models will decide which tools to call,
and the arguments.

Tool schemas accept any Standard Schema validator. The SDK converts Standard Schemas to JSON Schema for clients (Zod, Valibot, ArkType, etc).

```typescript
// Simple tool with parameters
server.registerTool(
Expand Down
120 changes: 113 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@
"client": "tsx scripts/cli.ts client"
},
"dependencies": {
"@standard-schema/spec": "^1.0.0",
"@standard-schema/utils": "^0.3.0",
"@standard-community/standard-json": "^0.3.5",
"ajv": "^8.17.1",
"ajv-formats": "^3.0.1",
"content-type": "^1.0.5",
Expand All @@ -93,15 +96,11 @@
"zod-to-json-schema": "^3.25.0"
},
"peerDependencies": {
"@cfworker/json-schema": "^4.1.1",
"zod": "^3.25 || ^4.0"
"@cfworker/json-schema": "^4.1.1"
},
"peerDependenciesMeta": {
"@cfworker/json-schema": {
"optional": true
},
"zod": {
"optional": false
}
},
"devDependencies": {
Expand All @@ -116,13 +115,15 @@
"@types/supertest": "^6.0.2",
"@types/ws": "^8.5.12",
"@typescript/native-preview": "^7.0.0-dev.20251103.1",
"@valibot/to-json-schema": "^1.3.0",
"eslint": "^9.8.0",
"eslint-config-prettier": "^10.1.8",
"prettier": "3.6.2",
"supertest": "^7.0.0",
"tsx": "^4.16.5",
"typescript": "^5.5.4",
"typescript-eslint": "^8.0.0",
"valibot": "^1.1.0",
"vitest": "^4.0.8",
"ws": "^8.18.0"
},
Expand Down
Loading
Loading