打开API到工具
这是一个简单的软件包,可以将OpenAPI路由转换为供MCP服务器或其他LLM应用使用的工具.
先决条件
该项目需要NodeJS(第18版或以后版)和国家预防机制. 节点 财务报告和审定财务报表 国家预防机制 非常容易安装. 为了保证你的机器能提供, 尝试运行以下命令.
$ npm -v && node -v
10.2.4
v20.11.0
目录
安装
在你进来之前: 请阅读 先决条件
要安装和设置库, 运行 :
$ npm install @buildwithlayer/openapi-to-tools
或者,如果你喜欢使用雅恩:
$ yarn add @buildwithlayer/openapi-to-tools
使用量
国 际
input_file_path是任何有效的 OpenAPI Spec 3. X 的路径output_file_path是 JSON 文件写工具的路径
npx @buildwithlayer/openapi-to-tools <input_file_path> [-o <output_file_path>]
MCP 服务器
import {addAPIToolsPlugin} from '@buildwithlayer/openapi-to-tools/index.js';
import {apiTools} from './tools.json';
const server = new McpServer(
{
name: 'very-cool-server',
version: '1.0.0',
},
{
capabilities: {
tools: {},
},
},
);
// Add any manual tools
server.tool('hello-world', async () => ({
content: [
{
text: 'Hello, world!',
type: 'text',
},
],
}));
// Add the API tools (generated with CLI or using the library)
addAPIToolsPlugin(server, apiTools);
// Start receiving messages on stdin and sending messages on stdout
const transport = new StdioServerTransport();
await server.connect(transport);
捐款
这些指示将予更新 马上。 。 。 .
请阅读 捐款额 详细介绍我们的行为守则和向我们提交拉动请求的程序.
- 叉开它!
- 创建您的特性分支 :
git checkout -b my-new-feature - 添加您的更改 :
git add . - 提交更改 :
git commit -am 'Add some feature' - 推到树枝上:
git push origin my-new-feature - 提交拉动请求 :
版本
我们用 交换器 用于版本。 有关现有版本,见 此仓库上的标记。 。 。 .
许可证
目前,这是没有许可证的,需要明确的许可才能使用. 未来,我们将打开这个许可证.