Konvertiert OpenAPI-Spezifikationen in MCP tool-Definitionen mit automatischer Auflösung von Parameterkonflikten und integriertem HTTP-Request-Building.
Auch bekannt als agentfront/mcp-from-openapi
- Stars
- 12
- Tools
- —
- Downloads, 30 Tage
- —
- Neueste Version
- —
- Letzter Commit
- 12. Nov. 2026
- Lizenz
- Apache-2.0
Was ist from-openapi MCP?
from-openapi ist ein MCP server. Konvertiert OpenAPI-Spezifikationen in MCP tool-Definitionen mit automatischer Auflösung von Parameterkonflikten und integriertem HTTP-Request-Building.
Zusammenfassung generiert aus dem README des Projekts
Über from-openapi MCP server
Entwickler, die die Lücke zwischen REST APIs und AI Agents schließen wollen, können diese Library nutzen, um OpenAPI-Spezifikationen in einsatzbereite MCP tool-Definitionen zu transformieren. Sie automatisiert die schwierige Aufgabe, Parameterkonflikte zu handhaben, bei denen derselbe Name an verschiedenen Stellen wie im Path, in der Query oder im Request Body vorkommt. Durch einen expliziten Mapper und einen integrierten Request Builder wird sichergestellt, dass HTTP-Requests korrekt konstruiert werden, ohne dass sie manuell zusammengesetzt werden müssen.
Das Tool läuft in Node.js oder V8-Isolates wie Cloudflare Workers und unterstützt das Laden von Spezifikationen aus URLs, Dateien oder JSON-Objekten. Es enthält spezialisierte Features für verschiedene AI-Clients, sodass Nutzer Claude, OpenAI oder Gemini anvisieren können, um sicherzustellen, dass die ausgegebenen Schemas genau dem entsprechen, was das jeweilige Modell akzeptiert. Zudem bietet es Sicherheitsfeatures wie SSRF-Prävention und Unterstützung für verschiedene Authentifizierungsschemata, einschließlich Bearer, OAuth2 und AWS Sig V4.
Über die reine Konvertierung hinaus bietet es Kuratierungsfunktionen wie Token-Budget-Reports via analyzeToolSet und Linting, um Lücken in der Spezifikation zu identifizieren. Nutzer können Tools nach Tags, Methoden oder Path-Globs filtern, um einen verfeinerten Satz an Capabilities für ihre Agents zu erstellen.
Was du damit machen kannst
- 1API-Parameter-Namenskonflikte lösenBenenne überlappende Parameter aus verschiedenen Teilen eines HTTP-Requests automatisch um, um Schema-Kollisionen zu vermeiden.
- 2Client-spezifische Tool-Schemas generierenErzeuge JSON-Schemas, die speziell auf die Anforderungen von Claude, OpenAI oder Gemini formatiert sind.
- 3HTTP-Request-Konstruktion automatisierenKonvertiere Tool-Inputs direkt in gültige HTTP-Requests, inklusive komplexer Query-Serialisierung und Multipart-Bodies.
- 4AI-Token-Verbrauch überwachenSchätze die Token-Kosten eines Toolsets ein, um eine Verschlechterung der Genauigkeit bei AI Agents zu verhindern.
Geschrieben aus dem README des Projekts. Jeder Use Case wurde gegen ein Zitat daraus geprüft.
So installierst du from-openapi MCP
Formate geprüft am 10. Nov. 2026Zu Cursor hinzufügenZu Goose hinzufügenfrom-openapi MCP in Claude Code installieren
$ claude mcp add mcp-from-openapi -- npx -y mcp-from-openapifrom-openapi MCP in Cursor installieren
~/.cursor/mcp.json
{
"mcpServers": {
"mcp-from-openapi": {
"command": "npx",
"args": [
"-y",
"mcp-from-openapi"
]
}
}
}from-openapi MCP in VS Code installieren
.vscode/mcp.json
{
"servers": {
"mcp-from-openapi": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"mcp-from-openapi"
]
}
}
}from-openapi MCP in VS Code CLI installieren
$ code --add-mcp '{"name":"mcp-from-openapi","type":"stdio","command":"npx","args":["-y","mcp-from-openapi"]}'from-openapi MCP in Claude Desktop installieren
claude_desktop_config.json
{
"mcpServers": {
"mcp-from-openapi": {
"command": "npx",
"args": [
"-y",
"mcp-from-openapi"
]
}
}
}from-openapi MCP in Codex installieren
$ codex mcp add mcp-from-openapi -- npx -y mcp-from-openapifrom-openapi MCP in Codex config.toml installieren
~/.codex/config.toml
[mcp_servers.mcp-from-openapi] command = "npx" args = ["-y", "mcp-from-openapi"]
from-openapi MCP in Gemini CLI installieren
$ gemini mcp add -s user mcp-from-openapi npx -- -y mcp-from-openapifrom-openapi MCP in Gemini settings.json installieren
~/.gemini/settings.json
{
"mcpServers": {
"mcp-from-openapi": {
"command": "npx",
"args": [
"-y",
"mcp-from-openapi"
]
}
}
}Automatisierte Checks
Geluften am 14. Nov. 2026Vollständiger Bericht →Unsere automatisierten Checks bestanden. Das ist kein Security-Audit: Lies den Code und gib dem Server nur den minimal notwendigen Zugriff. Wie die Checks funktionieren
- Source Repository verknüpft und erreichbaragentfront/mcp-from-openapi is public and reachablegithub.com/agentfront/mcp-from-openapi ↗Bestanden
- Paket nennt dieses Repository als Quellemcp-from-openapi names agentfront/mcp-from-openapi as sourcenpmjs.com/package/mcp-from-openapi ↗Bestanden
- Build-Provenienz (Sigstore-Attestierung)Sigstore attestation for mcp-from-openapinpmjs.com/package/mcp-from-openapi/v/2.9.3#provenance ↗Bestanden
- Open Source Lizenz (OSI)Apache-2.0spdx.org/licenses/Apache-2.0.html ↗Bestanden
- Commit oder Release im letzten JahrLast commit or release 2026-11-12github.com/agentfront/mcp-from-openapi ↗Bestanden
- OpenSSF ScorecardNicht geprüft
- Package-Name ähnelt keinem populären PackageNo popular package one edit away from mcp-from-openapiBestanden
- Keine kritischen Advisories im Paket oder seinen AbhängigkeitenNicht geprüft
- Keine versteckten Anweisungen an das Modell0 tool descriptions and the README read; no override phrases, credential paths or hidden charactersBestanden
- Destruktive Tools sind markiertNicht geprüft
- Remote-Endpoint beantwortet den MCP-HandshakeNicht geprüft
README
Auf GitHub ansehenmcp-from-openapi
Convert OpenAPI specifications into MCP tool definitions with automatic parameter conflict resolution
What This Solves
When converting OpenAPI specs to MCP tools, you hit parameter conflicts -- the same name appears in different locations (path, query, body). This library resolves them automatically and gives you an explicit mapper for building HTTP requests.
The Problem:
paths:
/users/{id}:
post:
parameters:
- name: id # path
in: path
requestBody:
content:
application/json:
schema:
properties:
id: # body -- CONFLICT!
type: string
The Solution:
{
inputSchema: {
properties: {
pathId: { type: "string" }, // Automatically renamed
bodyId: { type: "string" } // Automatically renamed
}
},
mapper: [
{ inputKey: "pathId", type: "path", key: "id" },
{ inputKey: "bodyId", type: "body", key: "id" }
]
}
Now you know exactly how to build the HTTP request.
Features
- Built-in Request Builder --
buildHttpRequest()applies the full OpenAPI serialization table (form/deepObject/pipeDelimited queries, label/matrix paths, multipart, binary,wholeBody) so you never hand-write request assembly - Client Compatibility Targets --
target: 'claude' | 'openai' | 'gemini' | 'strict'emits schemas each client actually accepts (inlined refs, closed objects, collapsed unions, demoted formats) - Context-Budget Reports --
analyzeToolSet()estimates the token bill per tool and warns at the thresholds where agent accuracy degrades - Overlays & Lint -- apply OpenAPI Overlay curation files at load time;
lint()flags the spec gaps that hurt tool-calling accuracy - Curation-Grade Filtering -- Filter by tag, method, path glob (
/admin/**), operationId, areadOnlyOnlysafety switch, andx-mcpextension flags with root < path < operation precedence - Smart Parameter Handling -- Automatic conflict detection and resolution across path, query, header, cookie, and body;
allOfbodies flatten, union and binary bodies map cleanly (wholeBody,binarymarkers) - Complete Schemas -- Input schema combines all parameters; output schema from responses (with oneOf unions); clean JSON Schema 2020-12 output (
nullableunions, normalizedexamples) - MCP-Native Tools --
titleand toolannotations(readOnly/destructive/idempotent hints) inferred from HTTP semantics, overridable via thex-mcpextension family; spec-compliant tool names (64-char cap, stable hash truncation, collision dedup); deterministic tool ordering for prompt-cache friendliness;toSdkTool()for one-line SDK registration - Security Resolution -- Framework-agnostic auth for Bearer, Basic, Digest, API Key, OAuth2, OpenID, mTLS, HMAC, AWS Sig V4; per-scheme
includeSecurityInInput - SSRF Prevention -- Blocks internal IPs, localhost, and cloud metadata endpoints by default during
$refresolution; one-flagsecureDefaultsposture for untrusted specs - Multiple Input Sources -- Load from URL, file, YAML string, or JSON object
- Rich Metadata -- Authentication, servers, tags, deprecation, external docs,
x-frontmcpextension - Production Ready -- Full TypeScript support, validation, structured errors, 100% test coverage (enforced)
- Runtime Agnostic -- Works on Node and V8 isolates (Cloudflare Workers) alike
Installation
npm install mcp-from-openapi
# or
yarn add mcp-from-openapi
# or
pnpm add mcp-from-openapi
Quick Start
import { OpenAPIToolGenerator } from "mcp-from-openapi";
// Load an OpenAPI spec
const generator = await OpenAPIToolGenerator.fromURL(
"https://api.example.com/openapi.json",
);
// Generate MCP tools
const tools = await generator.generateTools();
// Each tool has everything you need
tools.forEach((tool) => {
console.log(tool.name); // "createUser"
console.log(tool.title); // "Create a user" (from summary/extensions)
console.log(tool.annotations); // { readOnlyHint: false, destructiveHint: true, ... }
console.log(tool.inputSchema); // Combined schema for all params
console.log(tool.outputSchema); // Response schema
console.log(tool.mapper); // How to build the HTTP request
console.log(tool.metadata); // Auth, servers, tags, etc.
});
Building Requests
buildHttpRequest() turns a tool plus input values into a ready-to-send request — style/explode serialization, deepObject queries, multipart, binary, and wholeBody handled correctly:
import { buildHttpRequest } from "mcp-from-openapi";
const request = buildHttpRequest(tool, { id: "42", filter: { tag: "news" } });
// { url: 'https://api.example.com/users/42?filter[tag]=news',
// method: 'GET', headers: {...}, body: undefined, ... }
await fetch(request.url, {
method: request.method,
headers: request.headers,
body: request.body as BodyInit,
});
The mapper array stays public for anyone who needs custom request assembly — see Request Builder and Parameter Conflicts for its contract.
Serving with the Official MCP SDK
import { toSdkTool, buildHttpRequest } from "mcp-from-openapi";
import { fromJsonSchema } from "@modelcontextprotocol/server"; // SDK v2
for (const tool of await generator.generateTools({ target: "claude" })) {
server.registerTool(...toSdkTool(tool, { fromJsonSchema }), async (input) => {
const request = buildHttpRequest(tool, input);
const response = await fetch(request.url, {
method: request.method,
headers: request.headers,
body: request.body as BodyInit,
});
return { content: [{ type: "text", text: await response.text() }] };
});
}
Documentation
| Document | Description |
|---|---|
| Getting Started | Loading specs, generating tools, building requests |
| Configuration | LoadOptions, GenerateOptions, RefResolutionOptions |
| Parameter Conflicts | How conflict detection and resolution works |
| Request Builder | buildHttpRequest — full OpenAPI parameter serialization |
| Client Targets | Per-client schema dialects (Claude, OpenAI, Gemini) |
| Curation | Token budgets, overlays, lint, trimming, response hints |
| Type Signatures | TypeScript call contracts for code-execution surfaces |
| Modern MCP Fields | Tool _meta, icons, x-mcp-header, elicitation descriptors |
| Arazzo Workflows | fromArazzo() — Arazzo 1.0 workflows as consolidated MCP tools |
| Tested Examples | Runnable examples, each executed as an e2e test on every CI run |
| Response Schemas | Output schemas, status codes, oneOf unions |
| Annotations & Extensions | Tool title, annotation inference, x-mcp extension family |
| Security | SecurityResolver, all auth types, custom resolvers |
| SSRF Prevention | Ref resolution security, blocked IPs and hosts |
| Format Resolution | Format-to-schema enrichment (uuid, date-time, email, int32, etc.) |
| Naming Strategies | Custom tool naming and conflict resolvers |
| SchemaBuilder | JSON Schema utility methods |
| Error Handling | Error classes, context, and patterns |
| x-frontmcp Extension | Custom OpenAPI extension for MCP annotations |
| API Reference | Complete types, interfaces, and exports |
| Examples | MCP server, Zod, filtering, security, and more |
| Architecture | System overview, data flow, design patterns |
Requirements
- Node.js >= 20.0.0
- TypeScript >= 5.0 (for TypeScript users)
- Peer dependency:
zod@^4.0.0
Contributing
Contributions are welcome! Start with the contributing guide; this project follows the Contributor Covenant. Bug reports and feature requests go through the issue templates.
Security
Report vulnerabilities privately — see the
security policy.
When loading untrusted specs, use secureDefaults: true.
Related Projects
License
from-openapi MCP Fragen
Wie füge ich from-openapi MCP zu Claude Code hinzu?
Führe claude mcp add mcp-from-openapi -- npx -y mcp-from-openapi in deinem Terminal aus. Füge --scope user hinzu, damit der Server in jedem Projekt verfügbar ist.
Wie füge ich from-openapi MCP zu Cursor hinzu?
Öffne ~/.cursor/mcp.json und füge den Server unter mcpServers hinzu, mit der Cursor-Config aus dem Installationsabschnitt oben.
Wie geht die Library mit Parameterkonflikten in OpenAPI-Specs um?
Sie erkennt und löst Konflikte automatisch, wenn derselbe Parametername an verschiedenen Stellen wie Path, Query oder Body auftaucht, indem sie diese umbenennt.
Kann ich das mit verschiedenen AI-Clients wie Claude oder OpenAI nutzen?
Ja, sie unterstützt spezifische Kompatibilitätsziele für Clients wie Claude, OpenAI und Gemini, indem sie Schemas ausgibt, die der jeweilige Client akzeptiert.
Hilft es beim Management des Token-Verbrauchs für Tools?
Ja, sie enthält Context-Budget-Reports, die die Token-Kosten pro Tool schätzen und dich warnen, wenn Schwellenwerte erreicht werden.
Welche Authentifizierungsmethoden werden unterstützt?
Die Library bietet framework-agnostische Unterstützung für Bearer, Basic, Digest, API Key, OAuth2, OpenID, mTLS, HMAC und AWS Sig V4.