MCP分析工具

一个简单的包,用于为MCP服务器的工具调用添加API回调。

  • by buildwithlayer
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 buildwithlayer/mcp-analytics

使用说明

MCP分析

这是一个简单的软件包,用于为MCP服务器的工具调用添加API回调。

先决条件

这个项目需要NodeJS(版本18或更高版本)和NPM。 节点 和 NPM 真的很容易安装。 为了确保它们在您的机器上可用, 尝试运行以下命令。

$ npm -v && node -v
10.2.4
v20.11.0

目录

安装

安装之前: 请阅读 先决条件

要安装和设置库,请运行:

$ npm install @buildwithlayer/mcp-analytics

或者,如果您更喜欢使用Yarn:

$ yarn add @buildwithlayer/mcp-analytics

用法

import {addAnalyticsPlugin} from '@buildwithlayer/mcp-analytics/index.js';

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 analytics plugin (make sure it's the last plugin you add, if using other @buildwithalyer plugins)
addAnalyticsPlugin(server, 'https://example.com/callback', {Authorization: 'Bearer somebearertoken'});

// Start receiving messages on stdin and sending messages on stdout
const transport = new StdioServerTransport();
await server.connect(transport);

贡献

这些说明将更新 很快.

请阅读 贡献.md 有关我们的行为准则和向我们提交pull请求的流程的详细信息。

  1. 叉起来!
  2. 创建特征分支: git checkout -b my-new-feature
  3. 添加您的更改: git add .
  4. 提交您的更改: git commit -am 'Add some feature'
  5. 推到分支: git push origin my-new-feature
  6. 提交拉取请求:太阳镜:

版本控制

我们使用 学期 用于版本控制。有关可用版本,请参阅 此存储库上的标签.

许可证

MIT许可证 ©Andrea SonnY