SuperAPIAI Directory

openapi-agentify

github.com · AI developer platforms

openapi-agentify is an open-source middleware for turning existing APIs into MCP servers. It supports Express, Hono, Fastify, and Next.js, reads OpenAPI specifications (or drafts a specification from routes), and serves a tool for each operation at the /mcp endpoint in-process. Tool calls are translated into the HTTP requests described by that operation and executed through your own routes, authentication middleware, validation, and handlers, with no second server, proxy, or extra port. It also provides discovery documents such as llms.txt, MCP server cards, and AI Catalog, as well as scoring and improvement suggestions for how agent-readable an API specification is.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)

About this tool

openapi-agentify is an open-source project whose goal is to turn an already running API directly into an MCP server. It plugs into an Express, Hono, Fastify, or Next.js application as a middleware, reads an OpenAPI specification (or drafts one from existing routes), and exposes a tool for each API operation at the /mcp path. Tool calls are translated into the HTTP requests described by that operation and executed in-process through your own routes, authentication middleware, validation logic, and handlers, so no second server, proxy, or extra port is needed.

Main capabilities:

  • MCP endpoint: supports Streamable HTTP, JSON responses, and stateless mode, is compatible with two protocol versions (2026-07-28 and 2025-11-25/06-18/03-26), and has been tested with the official MCP TypeScript client.
  • In-process dispatch: maps path, query, header, and JSON body parameters from the specification; only declared parameters reach the application; models cannot forge credentials or X-Agentify-* headers; non-2xx responses become model-readable tool errors; supports timeouts and response size limits.
  • Tool generation from specifications: supports OpenAPI 3.0 and 3.1 (JSON or YAML, from a file, URL, or read from the running application), with JSON Schema 2020-12 validation in linear time; also supports defining non-route code tools with defineTool() and Zod schemas. agentify.tools.json is a reviewable tool list containing names, descriptions, and which write operations are enabled.
  • Discovery documents: provides llms.txt, llms-full.txt, MCP server cards (SEP-2127), AI Catalog, /openapi.json and /openapi.yaml with x-agentify hints, an /agent index, and a Link header on /; uses ETag caching, and each item can be disabled.
  • Agent readiness check: npx openapi-agentify check scores how understandable an API is to models (0–100) according to 13 weighted rules, covering operationIds, descriptions, parameter documentation, responses schema, authentication, examples, errors, pagination, idempotency, enums, tool count, and more; improve writes rule-based fixes into agentify.tools.json (without changing your specification), while --accept serves those fixes directly.
  • Specification drafter: when there is no specification, draft uses a TypeScript parser to read Express, Hono (including zValidator and @hono/zod-openapi), Fastify, or Next.js source code (without executing it) and writes OpenAPI 3.1.
  • Route-layer protection: strips forged X-Agentify-* headers, detects agents (based on a dated User-Agent list and Web Bot Auth), honors Idempotency-Key for agent write operations, and rejects paths that a router might resolve differently.
  • Extension hooks: authenticate, beforeToolCall, afterToolCall, guardRoute, describe, extra surfaces, allowing you to plug in your own API keys, OAuth, rate limiting, metering, or payments.

Usage: for a quick start, use init to automatically detect the framework and create the application's files, find or draft a specification, score it, write agentify.config.ts and agentify.tools.json (reads on, writes off), and add two lines to the entry file; then point any MCP client at http://localhost:3000/mcp。也可手动在 Add three lines of middleware in Express. When a TLS client certificate socket or another language is needed, you can use dispatch: { mode: "http", url } to send tool calls over loopback HTTP.

Notes: Authentication is still handled by your API, and the MCP endpoint by default forwards the caller's own credentials; if dispatch: http would send credentials to another origin, Agentify refuses to start. In production you should set baseUrl, which determines the origin in all documentation and is the only origin allowed to let browser pages call /mcp (can be combined with allowedOrigins); when unset, only browser requests from localhost pages under a localhost Host are accepted, to prevent DNS rebinding. The middleware should be mounted first, before the body parser and authentication, so that forged request headers can be stripped; it does not parse the request body for your routes. It is recommended to add pattern, enum, or format to the id parameter to avoid routes that are outside the spec but match the template being mistaken for that operation.

Examples and limitations: examples/orders-api provides implementations of the same small Orders API under four frameworks, with built-in API-key authentication and a deliberately minimal spec (score 54, rising to 96 after improve --accept). The Express version can be opened in StackBlitz. For MCP clients that start a process rather than call a URL, npm run demo:stdio serves the Express version over stdio, with each message forwarded through the same middleware to its /mcp. The repository Dockerfile can run this demo, but it is not part of the npm package. The project is under the MIT license, maintained by Jorge Ortega at Latitude 10 (October Moon LLC), and is the open-source core of the Latitude 10 Agentify kit. Commercial information such as hosted MCP services and paid suites (agent keys, OAuth, per-agent rate limiting, usage metering, x402 pay-per-call) is mentioned in the materials, but specific pricing and feature details are not yet provided.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools