wtc-openapi-mcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
@eksido/wtc-openapi-mcp
Convert OpenAPI 3.0 and 3.1 specifications into executable MCP tools. Use it as a library, a stdio server, or a foundation for your own API tooling.
An independent Apache-2.0 primitive from Eksido.com / WeTakeControl.eu. It does not require either commercial platform.
npm: @eksido/wtc-openapi-mcp · Source: wtc-openapi-mcp · Report an issue.
What It Is
A TypeScript/ESM npm package with a normalized operation model, JSON Schema tool inputs, HTTP execution, authentication configuration, filters, overrides, and lifecycle hooks. Requires Node.js 20 or later. The CLI uses stdio; the library also accepts an MCP SDK transport.
Related MCP server: openapi-to-mcp
What It Is Not
An authorization server, policy engine, API gateway, approval system, or guarantee that every OpenAPI extension can be executed. The metadata classification is descriptive, never security enforcement. Selecting a tool authorizes no action by itself; configure controls in your host or hooks.
Installation
Install the SDK from npm (Node.js 20 or later):
npm install @eksido/wtc-openapi-mcpMigration
The old unscoped wtc-openapi-mcp package is deprecated. Replace it with
@eksido/wtc-openapi-mcp:
npm uninstall wtc-openapi-mcp
npm install @eksido/wtc-openapi-mcpUpdate SDK imports from "wtc-openapi-mcp" to "@eksido/wtc-openapi-mcp".
The package-name migration preserves the API and wtc-openapi-mcp CLI command.
The wtc-openapi-mcp/operation metadata key is also unchanged.
Existing unscoped releases remain available but are deprecated.
Programmatic usage
import { createMcpFromOpenApi } from '@eksido/wtc-openapi-mcp';
const server = await createMcpFromOpenApi({
spec: './openapi.yaml',
baseUrl: 'https://api.example.com',
auth: { type: 'bearer', token: process.env.API_TOKEN },
});
await server.start();spec accepts a local JSON/YAML path, an HTTP(S) JSON/YAML URL, or a JavaScript object. For an object with relative external references, set specBase to the originating file path or URL. Resolution does not mutate the supplied object. Internal, external, relative, and recursive $ref schemas are supported. Recursive schemas become local JSON Schema pointers in the final MCP input schema.
const app = await createMcpFromOpenApi({ spec: openApiObject, baseUrl });
console.log(app.operations); // all normalized operations, before filtering
console.log(app.tools); // exposed tools, after filtering and transforms
const result = await app.callTool('getNote', { path: { id: '1' } });
// { status: 200, contentType: 'application/json', data: { ... } }
await app.close();start(transport?) connects the underlying SDK server; it defaults to stdio. close() closes its transport. Only call start once per instance. Import normalizeOpenApi(options) for normalization without server construction. Exported types include Options, Operation, Parameter, Auth, Filter, Override, McpTool, ExecutionContext, and ExecutionResult.
CLI
wtc-openapi-mcp --spec ./openapi.yaml --base-url https://api.example.com
wtc-openapi-mcp --spec ./openapi.yaml --bearer-env API_TOKEN
wtc-openapi-mcp inspect --spec ./openapi.yaml --include-method GET
wtc-openapi-mcp inspect --spec ./openapi.yaml --exclude-tag internalFilters are repeatable: --include-operation, --include-tag, --include-method, --include-path, and corresponding --exclude-* flags. Paths match the exact OpenAPI template, not a glob. --help describes the CLI. Non-bearer authentication, hooks, private spec URLs, and overrides use the programmatic API.
Inspection parses/resolves the specification but never calls an API operation. For the bundled example with --include-method GET:
3 operations found
1 read
1 write
1 destructive
1 exposed after filteringServer stdout is reserved for MCP messages. Startup failures go to stderr with exit code 1.
Input and operation model
Inputs use separate path, query, header, cookie, and body properties. This keeps two parameters called id in different locations distinct. Required parameters and bodies retain their required status. Unknown arguments are rejected. Defaults remain schema metadata; values are not automatically inserted or coerced.
await app.callTool('createItem', {
path: { accountId: '42' },
query: { notify: true },
header: { 'X-Request-ID': 'request-1' },
body: { title: 'Example' },
});Each operation has a stable id (GET /notes/{id}), optional operationId, method, path, tags, summary, description, parameters, selected request-body media type and schema, all response schemas, declared security requirements/schemes, resolved server URL, deprecated flag, and classification.
GET, HEAD, OPTIONS:
read(TRACE is also classifiedread).POST, PUT, PATCH:
write.DELETE:
destructive.
Valid operationId values become tool names directly. Missing, unsafe, or overlong IDs receive a sanitized deterministic name with a hash suffix. Duplicate operation IDs or final tool names cause startup errors instead of overwriting tools.
Tool descriptions combine summary and description. Parameter descriptions and body schemas appear in the input schema. Response schemas are available in operations and tool _meta['wtc-openapi-mcp/operation'].responses. There is no fabricated MCP output schema: multiple upstream status codes/media types do not necessarily have one shape. Responses are not schema-validated.
Operation-level parameters override matching path-level parameters. Server precedence is override → explicit baseUrl → operation servers → path servers → root servers. The first server is selected, using variable defaults. Relative servers in remote specs resolve against the spec URL; relative servers in local specs require baseUrl for execution. Base URL path prefixes are preserved.
Filters and overrides
const app = await createMcpFromOpenApi({
spec: './openapi.yaml',
include: { tag: ['notes'], method: ['GET', 'POST'] },
exclude: { operationId: ['internalLookup'], path: ['/admin'] },
overrides: {
getNote: { name: 'read_note', description: 'Retrieve a note by ID.' },
'DELETE /notes/{id}': { enabled: false },
},
filterOperation: operation => !operation.deprecated,
});Include criteria use AND across populated fields and OR within each list. Any matching exclude criterion removes an operation. Empty include objects match everything; empty exclude objects exclude nothing. Operation-ID filters can use the stable operation id when operationId is absent. Overrides are keyed by operationId (preferred) or stable id and can set name, description, enabled, and baseUrl. enabled: true does not bypass filters. The source document is unchanged.
Authentication
Authentication is explicit; declarations from the spec are metadata, not an automatic credential lookup or OAuth login flow. A configured credential applies to all exposed operations; use separate instances or beforeExecute to scope it further.
// Choose one, or compose multiple schemes with an array:
const auth = { type: 'none' };
const apiKey = { type: 'apiKey', name: 'X-API-Key', value: process.env.API_KEY, in: 'header' };
const bearer = { type: 'bearer', token: process.env.API_TOKEN };
const basic = { type: 'basic', username: process.env.API_USER, password: process.env.API_PASSWORD };
const oauth = { type: 'oauth2', getAccessToken: async operation => tokenProvider(operation.security) };API keys support header (default), query, and cookie. OAuth token providers run on every invocation and can implement caching/refresh externally. Credentials overwrite matching ordinary header/query inputs. Credentials are never bundled or logged by this package.
Hooks and execution
Hooks execute in this order: filterOperation → transformTool during creation, then input validation → request construction/auth → beforeExecute → fetch → decoding → afterExecute. onError receives execution/input failures for known tools. Unknown tools and startup errors are thrown directly.
const app = await createMcpFromOpenApi({
spec: './openapi.yaml',
transformTool: (tool, operation) => ({ ...tool, title: operation.summary }),
beforeExecute: async context => {
// Throw to prevent execution; inspect operation/input or modify url/init.
await yourAuthorizer(context.operation, context.input);
},
afterExecute: async (result, context) => {
await yourAuditStore(context.operation.id, result.status);
return result; // returning undefined preserves the original result
},
onError: async (error, operation) => {
await yourErrorRecorder(operation.id, error.code);
},
});Hooks are trusted application code. Transformed tools must still have valid, unique names and valid input schemas. If you change the input shape, adapt it in your integration; transformTool does not rewrite HTTP parameter mappings. beforeExecute runs after request construction, so change url/init to affect the outgoing request. Hook payloads may contain credentials and sensitive data; redact before auditing.
timeoutMs defaults to 30,000; maxResponseBytes defaults to 10 MiB. Both must be positive integers. fetch replaces upstream execution only (not spec/ref downloads). Fetch redirects are rejected by default. JSON and +json responses are decoded; text is returned as a string; empty responses become null. Non-2xx responses throw OpenApiMcpError with code: 'HTTP' and status, without the upstream body. Invalid JSON, oversized responses, and transport failures use NETWORK. Schema failures use SPEC; input failures use INPUT. Generic execution/hook failures are sanitized. MCP calls return a text JSON envelope plus structuredContent; failures return isError: true. Direct callTool calls throw errors.
Supported serialization and limitations
Schema parameters: path
simple/label/matrix, queryform/spaceDelimited/pipeDelimited/deepObject, simple headers, primitive cookies. Nested-object parameter serialization andallowReservedare not supported. Prefer JSON request bodies for nested data.Request bodies: JSON/
+json, text, and flat URL-encoded forms. JSON is preferred when multiple media types are declared; otherwise the first media type is selected. Multipart/file uploads, binary bodies, XML encoders, streaming responses, and parametercontentdefinitions are not supported. Unsupported body media types fail on execution.OpenAPI 3.0 nullable/exclusive bounds are converted to JSON Schema. Input validation uses JSON Schema 2020-12 via Ajv, including recursive local references. Custom schema dialects,
$dynamicRef/dynamic anchors, unusual external$idscopes, and vendor-specific extensions are not guaranteed. This is structural validation plus input-schema compilation, not a full OpenAPI conformance checker.Only operations under
pathsbecome tools; callbacks, links, and webhooks do not. GET/HEAD request bodies cannot be sent by Node fetch. No automatic pagination, retries, rate limiting, OAuth grant acquisition, or upstream response validation.Stdio is the bundled transport. The public SDK server/custom transport surface can be used by a separately secured HTTP host; no HTTP listener is bundled.
Specifications are trusted configuration. External refs are enabled by default; set
resolveExternalRefs: falseto disallow their resolution. Private/localhost spec URLs are blocked by the ref parser unlessallowPrivateSpecUrls: trueis explicitly configured. API execution can use private addresses. Resolver URL checks are not a network sandbox; apply your own egress controls for untrusted sources.
Examples
All examples consume the public package API. From a source checkout:
npm install
npm run build
node examples/filtering.mjs
node bin/wtc-openapi-mcp.js inspect --spec examples/openapi.yamlFor a local round trip, start node examples/mock-api.mjs in one terminal, then run node examples/client.mjs in another. The client starts the stdio CLI, lists the sample tools, and calls getNote. Other examples: node.mjs, auth.mjs, overrides.mjs, and cli.sh.
Package validation
npm run quality
# typecheck → ESLint → Vitest → tsup/declarations → npm pack --dry-run
npm pack --dry-run
npm packThe WTC skill validator can also be run where that skill is installed:
python3 /path/to/wtc-create/scripts/validate_wtc_package.py .Publication is a separate, explicit action: npm publish --access public. prepublishOnly reruns the quality gate. Source code and issue tracking are available at eksido/wtc-openapi-mcp.
Repository layout
bin/wtc-openapi-mcp.js Executable loader
src/types.ts Public types and errors
src/normalize.ts Loading, references, normalization, tool schemas
src/execute.ts HTTP mapping, auth, execution
src/index.ts Public factory and MCP server
src/cli.ts CLI and inspection
examples/ Public API examples and sample API
test/ Integration and regression tests
dist/ Generated ESM and declarations
README.md SECURITY.md LICENSE
package.json package-lock.json tsconfig.json tsup.config.ts eslint.config.jsProduction and security
See SECURITY.md. Review exposed operations, keep credentials in environment/secret stores, scope API permissions, and use hooks to layer governance where needed. Read/write classifications never substitute for authorization.
Related WTC packages
WTC Semantic Layer —
@eksido/wtc-semantic-layer.WTC Control Plane —
@eksido/wtc-control-plane.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Generate a typed SDK, CLI, and MCP server from any OpenAPI or GraphQL spec, and keep them current.
Convert, lint and generate LLM tool schemas for OpenAI, Anthropic, Gemini and MCP
Point Gecko at an OpenAPI spec; get first-call-correct, auth-hidden agent tools.
Discover, plan and run tools across your connected business systems through one OAuth MCP endpoint
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceConverts any OpenAPI/Swagger API specification into MCP tools that AI assistants can use to interact with the API.8 npm7MIT
- AlicenseNot gradedqualityCmaintenanceConverts any OpenAPI 3.x spec into a live MCP server, making every endpoint a validated tool that AI agents can call without writing glue code.12 npmMIT
- AlicenseNot gradedqualityBmaintenanceConverts OpenAPI documents into MCP services with generated tools, prompts, and resources, supporting HTTP and STDIO transports plus an admin Web UI.76 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables converting any OpenAPI 3.2 specification into a fully functional MCP server, automatically generating tools, prompts, and resources with support for stdio and HTTP/SSE transports.76 npmMIT