
Openapi Sync Mcp
io.github.akintomiwa-fisayoPublished by GitHub account akintomiwa-fisayov6.4.2Updated Oct 24, 2026
Type-safe MCP server for OpenAPI Sync to inspect, validate, and synchronize OpenAPI specs.
Overview
Lets an assistant inspect, validate, and synchronize OpenAPI specs and generate typed API clients and validation schemas.
- What you can do
- Wraps the openapi-sync CLI as MCP tools so an assistant can list endpoints with filtering and pagination, inspect a single endpoint's details, and read generated TypeScript type declarations without reloading the spec. It can validate configuration and specs, run diagnostic health checks, sync specs from remote URLs, generate typed clients (fetch, axios, react-query, swr, rtk-query, next-fetch) and Zod, Yup, or Joi schemas, and purge stale generated files. Commands are non-interactive and emit machine-readable JSON.
- When to use it
- Useful when a project keeps an OpenAPI specification and wants an assistant to explore its endpoints, check spec or config health, or regenerate types, clients, and validation schemas as part of a development workflow.
- Requirements
- Runs locally over stdio as an npm package (openapi-sync-mcp, backed by openapi-sync); Node.js and npx are needed. A configuration file (openapi.sync.json, .ts, or .js) or equivalent CLI flags supply the spec URL or local file. Network access is needed to fetch remote specs. Protected specs need credentials, which must be referenced through environment variables in a TypeScript or JavaScript config file.
Installation
In SourceWeft
- Open Openapi Sync Mcp in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
[NPM Version] [License] [Tests]
OpenAPI Sync
OpenAPI Sync is a powerful developer tool that automates the synchronization of your API documentation with your codebase using OpenAPI (formerly Swagger) specifications. It generates TypeScript types, fully-typed API clients (Fetch, Next.js Fetch, Axios, React Query, SWR, RTK Query), endpoint definitions, runtime validation schemas (Zod, Yup, Joi), and comprehensive documentation from your OpenAPI schema—ensuring type safety from API specification through client implementation to runtime validation.
Core Features
- ⚡ Zero-Config Presets - 10 pre-configured framework presets (React Query, SWR, Axios, Fetch, RTK Query, Next.js, Python) for instant setup
- 🔄 Real-time API Synchronization - Automatically syncs OpenAPI specs from remote URLs with configurable intervals
- 📝 Automatic Type Generation - Generates TypeScript interfaces for all endpoints with full nested support
- 🔐 Runtime Validation - Generate Zod, Yup, or Joi schemas from OpenAPI specs with all constraints preserved
- 🎯 Interactive Setup Wizard - Streamlined configuration with auto-enabled tag-based folder splitting
- 🛡️ Enterprise Ready - Error handling, validation, state persistence, and custom code preservation
- 📦 Folder Splitting - Organize code by tags or custom logic with aggregator files for easy imports
- 📚 Rich Documentation - JSDoc comments with cURL examples and inline usage guides
- 🤖 Agent-Ready Endpoints - Browse endpoints with pagination and path filtering, inspect deep endpoint details, and read generated types without reloading the spec
- 🩺 Diagnostic Doctor - Diagnostic health checks for config validity, spec accessibility, peer dependencies, cache, and folder write permissions
- 🧹 Stale File Purge - Manifest-based stale code detection and cleanup with dry-run support to prevent orphaned code
- 🔄 Custom Code Injection - Preserve your custom code between regenerations with protected sections
Installation
⚠️ macOS Big Sur Users: If you encounter an esbuild error (
Symbol not found: _SecTrustCopyCertificateChain), install[email protected]first. See Troubleshooting for details.
🤖 Using with AI Agents
All CLI commands and programmatic APIs are agent-safe — no interactive prompts, fully non-blocking. Use --json for machine-readable output and --silent to suppress logs.
Full agent reference:
llms.txt— a structured discovery file for LLMs, Copilots, and MCP tools.
Agent Quick-Start (no prompts)
Machine-Readable Output (--json)
Every command emits a single, pure JSON object to stdout when --json is passed, making it safe to pipe directly into jq or consume from automated agents. All human-readable progress logs are suppressed or directed to stderr.
Dry Run (preview without writing files)
Compact, fast previews of planned files:
Layouts & Output Directories
- Flat Mode (Default): When
folderSplitis omitted or empty ({}), files are placed directly in the API folder (endpoints.ts,types/index.ts,types/shared.ts). - Tag-Split Mode: Setting
folderSplit: { byTags: true }organizes endpoints into tag subfolders (e.g.{tag}/endpoints.ts,{tag}/types.ts,shared.ts). - Custom Client Directory:
clientGeneration.outputDir(or CLI--output) is fully supported in both flat and folder-split layouts. In flat mode, clients are placed directly in{outputDir}/clients.ts(orapi.ts), while in folder-split mode clients are placed in{outputDir}/{tag}/client.tsand aggregated at{outputDir}/clients.ts, with relative imports resolving back to your generated types and endpoints.
Programmatic API (TypeScript)
Exit Codes
Agent-safe vs Interactive Commands
Quick Start
Option 1: Interactive Setup (Recommended) 🎯
The easiest way to get started is with the interactive setup wizard:
The wizard will guide you through:
- 📝 Configuration file format selection (TypeScript, JSON, or JavaScript)
- 🌐 API specification source (URL or local file)
- 📁 Folder organization options (split by tags or custom logic)
- 🚀 Client generation options (React Query, SWR, Fetch, Axios, RTK Query)
- ✅ Validation library setup (Zod, Yup, Joi)
- 🔧 Custom code preservation settings
- 🏷️ Type naming preferences (operationId usage, prefix)
- 🚫 Endpoint filtering (exclude by tags)
- 📚 Documentation options (cURL examples)
Option 2: Manual Setup
1. Create openapi.sync.json in your project root:
2. Run the sync command:
3. Use generated types and endpoints:
View detailed quick start guide →
⚡ Presets (Zero-Config Framework Setup)
Presets bundle opinionated defaults for your framework, client library, and validation stack into a single name. Instead of configuring dozens of settings by hand, pick a preset during npx openapi-sync init or set "preset": "<name>" in your config file. Any explicit configuration values you define always override preset defaults.
Using a Preset
In the CLI Setup Wizard:
Non-Interactive / CI:
In JSON (openapi.sync.json):
In TypeScript (openapi.sync.ts):
View presets guide on website →
API Client Generation
Generate fully-typed API clients with hooks for popular libraries:
Generate Fetch Client
Generate Axios Client
Generate React Query Hooks
Generate SWR Hooks
Generate RTK Query API
Generate Next.js Fetch Client (App Router & Server Components)
Usage in Next.js App Router (Server Components):
Filter by Tags or Endpoints
Usage Example (React Query)
1. Generate the client:
2. Use in your React components:
Client Generation Options
Custom Code Preservation
Generated clients support custom code sections that are preserved during regeneration:
View complete client generation guide →
Configuration
Supports multiple configuration formats: openapi.sync.json, openapi.sync.ts, or openapi.sync.js
Basic Example:
Advanced TypeScript Example:
🔐 Protected Specs & Stored Authentication (auth)
Fetch OpenAPI specifications protected behind Bearer tokens, Basic auth, API keys, or custom headers.
⚠️ IMPORTANT FOR HUMANS & AI AGENTS: Referencing environment variables for credentials requires using a TypeScript (
openapi.sync.ts) or JavaScript (openapi.sync.js) configuration file. Static JSON (openapi.sync.json) does not support JavaScript runtime expressions likeprocess.env. Always useopenapi.sync.tsoropenapi.sync.jswhen dynamic environment variables are needed to keep secrets safe and prevent invalid JSON syntax errors.
TypeScript Example (openapi.sync.ts):
JavaScript Example (openapi.sync.js):
View full configuration options →
CLI Commands
Interactive Setup
Launch an interactive wizard that guides you through creating your configuration file. Perfect for first-time setup or exploring available options.
Sync API Types
Synchronize your OpenAPI specifications and generate TypeScript types, endpoints, and validation schemas.
Zero-Config CLI Execution & Config Overrides
You can run openapi-sync directly from terminal scripts or CI/CD pipelines without creating a configuration file on disk. Pass any property supported by the configuration file via CLI flags:
[!NOTE] If run without a configuration file on disk and without necessary CLI flags (e.g.
--api-url,--api <name>=<url>, or--config-json),openapi-syncwill display the standardConfigNotFoundError, prompting you to runnpx openapi-sync init.
Generate API Client
Generate fully-typed API clients for various frameworks and libraries.
Available Commands & Options
CLI Flag Aliases
Flags are interchangeable across init, sync, validate, and generate-client:
- Output folder:
--output-folderor--folder(-f) (defaults to project root"") - Validation library:
--validation-libraryor--validation-lib(--validations-library) - Tag folder split:
--folder-splitor--split-by-tags - Type prefix:
--types-prefixor--type-prefix
Diagnostic Health Checks (doctor)
Run an automated environment audit to diagnose config syntax, specification accessibility, optional peer dependencies (zod, yup, joi), cache state, and directory write permissions:
Output Example:
Stale File Detection & Cleanup (purge)
Whenever endpoints or schemas are removed from your OpenAPI specification, previously generated files can become orphaned in your codebase. openapi-sync tracks generated artifacts via .openapi-sync/manifest.json and automatically detects stale files.
Inspecting Endpoints & Types (get-endpoint, read-type)
AI agents and developers can query specific endpoint metadata or read generated type declarations without loading huge files or blowing LLM context windows:
Typed Error Codes & Recovery
All CLI commands and programmatic methods throw structured error objects extending OpenApiSyncError. Each error exposes a stable code string:
Documentation
For complete documentation including:
- Configuration Options - All available settings and customization
- Generated Output - Understanding generated files and structure
- Custom Code Injection - Preserve your code between regenerations
- Validation Schemas - Runtime validation with Zod, Yup, or Joi
- Advanced Examples - Complex configurations and use cases
- API Reference - Programmatic usage and type definitions
- Troubleshooting - Common issues and solutions
Visit openapi-sync.com
🔌 MCP Server (Model Context Protocol)
openapi-sync ships with a complete Model Context Protocol (MCP) server. AI agents (Claude Desktop, Cursor, Windsurf, Zed, and any MCP-compatible client) can query endpoints, inspect schemas, read generated types, and execute syncs directly via type-safe tool calls over stdio — without pasting entire 5MB–15MB specs into prompt context.
The MCP server is published both as part of openapi-sync and as a dedicated zero-install companion package on npm: openapi-sync-mcp.
[npm version] [Glama] [Install in Cursor]
4 Ways Users & Agents Can Access OpenAPI Sync
Starting the Server
Transport: The server uses stdio transport — it reads JSON-RPC from stdin and writes responses to stdout. The working directory (
cwd) of the process is used as the project root for reading and writing files.
Host Configuration Guides
1. Cursor Configuration
Create or update .cursor/mcp.json in your project root:
Or add it globally via Cursor Settings → Features → MCP → + Add New MCP Server.
2. Claude Desktop Configuration
Edit your configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
3. Windsurf (Codeium) Configuration
Add to ~/.codeium/windsurf/mcp_config.json:
4. Zed Configuration
Add to your Zed settings.json under context_servers:
5. Google Antigravity Configuration
Add to your global configuration (~/.gemini/config/mcp_config.json) or project root (.agents/mcp_config.json):
Available MCP tools
Typical agent workflow via MCP
Tool input/output types
All tools return JSON-serialized versions of the same structured types used by the programmatic API:
openapi_sync_sync→SyncResultopenapi_sync_generate_client→SyncResultopenapi_sync_validate→ValidationResultopenapi_sync_doctor→DoctorResult({ healthy, checks, recommendations })openapi_sync_list_endpoints→Record<string, EndpointSummary[]>openapi_sync_get_endpoint_details→{ apiName, endpoint }openapi_sync_read_generated_type→stringopenapi_sync_init→{ success, configFile, message, errors }openapi_sync_read_config→{ found, file, path, content }
Troubleshooting
macOS Big Sur (11.x) - esbuild Installation Error
Error: dyld: Symbol not found: _SecTrustCopyCertificateChain when installing openapi-sync
Cause: The default esbuild version requires macOS 12.0+ APIs that aren't available in Big Sur.
Solution: Install a compatible esbuild version before installing openapi-sync:
Alternatively, add an override to your package.json:
Note: This issue only affects macOS Big Sur (darwin 20.x). Users on macOS 12+ are not affected.
License
ISC License - see LICENSE file for details.
Contributing
Contributions welcome! Submit pull requests to our GitHub repository.
Contributors
A special thanks to the following contributors for their valuable work on this project:
[Fisayo Akintomiwa] [Opemipo Akintomiwa] [Ayotunde Obasa]Support / Donate
If you find OpenAPI Sync useful and would like to support its development, thank you — your support helps pay for hosting, CI, and ongoing maintenance.
You can support the project in any of the following ways:
- Sponsor the maintainer on GitHub: https://github.com/sponsors/akintomiwa-fisayo
- Back the project on Open Collective (placeholder): https://opencollective.com/fisayo-akintomiwa
Thank you for considering supporting the project — every bit helps.
Source: README.md at commit 8f9cde0
Tools
0Version history
1- v6.4.2LatestSep 18, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts