UNPKG

notion-mcp-server

Version:

Notion MCP server with token auth: connect Claude Code, Claude Desktop, Cursor, VS Code, Codex and any MCP client to Notion. Search, create and edit pages, query databases, comment and upload files. Runs headless in CI and agents.

24 lines (23 loc) • 921 B
import { z } from "zod"; export const EXTERNAL_FILE_SCHEMA = z.object({ type: z.literal("external").describe("Type of file source"), external: z .object({ url: z.url({ protocol: /^https?$/ }).describe("URL of the external file"), }) .describe("External file source"), }); export const FILE_UPLOAD_SCHEMA = z.object({ type: z.literal("file_upload").describe("Type of file source"), file_upload: z .object({ id: z.string().describe("file_upload_id returned by upload_file"), }) .describe("A file already uploaded through upload_file"), }); // Both members stay exported because a discriminated union has no `.shape`. // A caller that adds a field to a file (an image block adds a caption) has to // extend each arm. export const FILE_SCHEMA = z .discriminatedUnion("type", [EXTERNAL_FILE_SCHEMA, FILE_UPLOAD_SCHEMA]) .describe("File schema");