@frontmcp/adapters

中文文档
1.12.2发布于 2026/11/15Apache-2.0TypeScriptESM + CJS构建来源已验证近 30 天下载 1.1万

FrontMCP adapters: turn an OpenAPI spec into MCP tools (OpenapiAdapter)

原始使用文档
文档目录7 节
  1. Install
  2. Usage
  3. Entry points
  4. Docs
  5. Related packages
  6. Contributing
  7. License

@frontmcp/adapters

Adapters for FrontMCP servers. An adapter builds tools from another source when the server starts. This package has OpenapiAdapter, which reads an OpenAPI 3 description of a REST API and gives your app one tool per operation, so you can put an API you already have in front of a model without writing a tool for each endpoint.

npm License

Install

npm install @frontmcp/adapters

Use it in a FrontMCP app: it depends on @frontmcp/sdk, so keep the two at the same version. It needs Node.js 24 or later.

Usage

List the result of OpenapiAdapter.init() in an app's adapters:

import { OpenapiAdapter } from '@frontmcp/adapters';
import { App } from '@frontmcp/sdk';

@App({
  id: 'petstore',
  name: 'Pet Store',
  adapters: [
    OpenapiAdapter.init({
      name: 'petstore',
      url: 'https://petstore3.swagger.io/api/v3/openapi.json',
      baseUrl: 'https://petstore3.swagger.io/api/v3',
    }),
  ],
})
export class PetStoreApp {}

Required options:

OptionTypeDescription
namestringNames the adapter. It must be unique in the process, and prefixes a tool whose name clashes with another tool's.
baseUrlstringWhere the API is. Each operation's path is appended to it, and it wins over the spec's servers.
spec or urlobject or stringThe OpenAPI 3.0 or 3.1 document as an object, or an http: or https: URL to download it from when the server starts.

Each tool checks its arguments against the operation's parameters and body schema before it sends the request. Other options set credentials (staticAuth, authProviderMapper, securityResolver), filter and rename operations (generateOptions, toolTransforms), fill in inputs on the server (inputTransforms), reshape responses (dataTransforms), and re-read the spec while the server runs (polling). OpenAPI adapter documents every option.

Parsing the spec and generating the tools is done by mcp-from-openapi.

Entry points

ImportWhat it has
@frontmcp/adaptersOpenapiAdapter, OpenApiSpecPoller, and the OpenAPI helpers and types.
@frontmcp/adapters/openapiThe same OpenAPI exports, with OpenapiAdapter as the default export.
@frontmcp/adapters/skillsSkill bundle sources and the bundle store used by @frontmcp/plugin-skilled-openapi.

The root and /openapi entry points are built separately, each with its own copy of OpenapiAdapter, so import it from one of them throughout an app.

Docs

Contributing

Source: libs/adapters. Issues and pull requests are welcome; see CONTRIBUTING.md.

License

Apache-2.0. See LICENSE.

版本与发布记录

@frontmcp/adapters 共发布 127 个版本,首次发布于 2025/11/05;过去 12 个月发布了 119 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.12.2latest2026/11/151 天前
1.12.12026/11/132 天前
1.12.02026/11/114 天前
1.12.0-rc.1rc2026/11/114 天前
1.11.32026/11/106 天前
1.11.22026/11/096 天前

其他发布通道:beta → 1.1.2-beta.1,rc → 1.12.0-rc.1。

关于 @frontmcp/adapters 的常见问题

@frontmcp/adapters 是什么?

FrontMCP adapters: turn an OpenAPI spec into MCP tools (OpenapiAdapter)

如何安装 @frontmcp/adapters?

在项目目录运行 npm install @frontmcp/adapters,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@frontmcp/lazy-zod(1.12.2)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@frontmcp/adapters 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@frontmcp/adapters 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@frontmcp/adapters 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=24.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@frontmcp/adapters 可以商用吗?

@frontmcp/adapters 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@frontmcp/adapters 的下载量有多少?

根据 npm 官方下载统计,@frontmcp/adapters 在 2026/10/16 – 2026/11/14 这 30 天内被下载 10,589 次,日均约 353 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@frontmcp/adapters 还在维护吗?

最新版本 1.12.2 发布于 2026/11/15(1 天前);至今共发布 127 个版本,其中过去 12 个月发布了 119 个;首次发布于 2025/11/05。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。