@modelcontextprotocol/core
Model Context Protocol for TypeScript — public Zod schemas (spec + OAuth/OpenID)
Last updated 2 months ago by GitHub Actions .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @modelcontextprotocol/core 
SYNC missed versions from official npm registry.

@modelcontextprotocol/core

Canonical public home for the Model Context Protocol specification and OAuth/OpenID Zod schemas.

These are the exact schema constants the SDK validates protocol and OAuth/OpenID payloads against internally. The @modelcontextprotocol/server and @modelcontextprotocol/client packages keep a Zod-free public surface, so this package exists as the supported place to import the raw schemas when you need to validate or parse MCP messages yourself.

Install

npm install @modelcontextprotocol/core

Usage

import { CallToolResultSchema } from '@modelcontextprotocol/core';

// Throws on invalid input; returns the typed result on success.
const result = CallToolResultSchema.parse(payload);

// Or non-throwing:
const parsed = CallToolResultSchema.safeParse(payload);
if (parsed.success) {
    // parsed.data is a fully typed CallToolResult
}

Scope

This package exports only Zod schema constants (*Schema), in two groups:

  • the MCP spec schemas — CallToolResultSchema, ListToolsResultSchema, …; and
  • the OAuth/OpenID auth schemas — OAuthTokensSchema, OAuthMetadataSchema, IdJagTokenExchangeResponseSchema, … (the schemas v1 exposed from @modelcontextprotocol/sdk/shared/auth.js).

The corresponding TypeScript types, error classes, enums, and type guards are part of the public API of @modelcontextprotocol/server and @modelcontextprotocol/client.

Migrating from v1? In v1 these schemas were imported from @modelcontextprotocol/sdk/types.js (spec schemas) and @modelcontextprotocol/sdk/shared/auth.js (OAuth/OpenID schemas). Point those *Schema imports at @modelcontextprotocol/core and your existing .parse() / .safeParse() calls keep working unchanged.

Current Tags

  • 2.4.0                                ...           latest (a month ago)

14 Versions

  • 2.4.0                                ...           a month ago
  • 2.3.1                                ...           2 months ago
  • 2.3.0                                ...           2 months ago
  • 2.2.0                                ...           2 months ago
  • 2.1.0                                ...           2 months ago
  • 2.0.0                                ...           4 months ago
  • 2.0.0-beta.5                                ...           4 months ago
  • 2.0.0-beta.4                                ...           4 months ago
  • 2.0.0-beta.3                                ...           5 months ago
  • 2.0.0-beta.2                                ...           5 months ago
  • 2.0.0-beta.1                                ...           5 months ago
  • 2.0.0-alpha.2                                ...           5 months ago
  • 2.0.0-alpha.1                                ...           5 months ago
  • 2.0.0-alpha.0                                ...           5 months ago
Downloads
Total 50
Today 1
This Week 1
This Month 34
Last Day 0
Last Week 5
Last Month 16
Dependencies (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE