mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-12-04 21:16:05 +00:00
Publishes a JSON schema for `mcp.json` at `https://pi.dev/schemas/mcp.schema.json`, like the existing models/settings/keybindings/theme schemas. Closes #12563. ## What **pi-mcp** (owner of the shared `mcpServers` shape): - New `./config-schema` export: the shared fields as a JSON Schema built with pi-schema, following the pi-ai compat/model-schema pattern. Field-level constraints (loopback `callbackUrl`, non-blank `clientName`, port bounds, URL patterns, `protocol`) live here, next to the validator they mirror. - `McpStdioServerConfig`, `McpHttpServerConfig`, and `McpOAuthConfig` now derive from the schema (`Static`), so schema and types cannot drift. `McpHttpServerConfig.type` now includes `"streamable-http"`, which the validator always accepted. The validator itself is unchanged, and the root export does not load pi-schema (type-only imports). **coding-agent**: - `src/core/mcp-config-schema.ts` composes pi's fields (`exposure`, `toolExposure`, `auth`, `autoEnableCodemode`, project override entries) on top of pi-mcp's property maps, re-annotated with pi's behavior, and `generate-schemas.ts` emits the committed `schemas/mcp.schema.json`. - Entries, oauth, and the document root are closed objects: the loader deliberately keeps unknown fields, so a mistyped key (`exposur`, `mcpSevers`) changes behavior silently today; the schema flags it in the editor. - Docs: `$schema` line in `docs/mcp.md`, plus a section for the previously undocumented `auth` field (separate commit). ## Intentional schema/runtime differences Documented in the `mcp-config-schema.ts` header and asserted in the tests: cross-field rules stay prose (override/`auth` file scoping, cimd restrictions, port agreement), URL schemes must be lowercase, and entries mixing `url` with `command` are flagged although the runtime picks HTTP. ## Tests - `packages/mcp/test/config-schema.test.ts`: schema/validator agreement for the shared fields. - `packages/coding-agent/test/config-schemas.test.ts`: fifth artifact pinned, representative documents, a runtime-validator agreement test (accept and reject lists plus the documented asymmetries), and a compile-time key-parity guard against the runtime config types. - `npm run check` clean; pi-mcp suite 199/199; coding-agent config-schemas/documentation/references pass. This PR is AI-generated. |
||
|---|---|---|
| .. | ||
| generate-references.ts | ||
| generate-schemas.ts | ||
| migrate-sessions.sh | ||