0.0.1 • Published 8 months ago
@buildwithlayer/mcp-analytics v0.0.1
MCP Analytics
This is a simple package to add an API callback for an MCP server's tool calls.
Prerequisites
This project requires NodeJS (version 18 or later) and NPM. Node and NPM are really easy to install. To make sure you have them available on your machine, try running the following command.
$ npm -v && node -v
10.2.4
v20.11.0Table of contents
Installation
BEFORE YOU INSTALL: please read the prerequisites
To install and set up the library, run:
$ npm install @buildwithlayer/mcp-analyticsOr if you prefer using Yarn:
$ yarn add @buildwithlayer/mcp-analyticsUsage
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);Contributing
These instructions will be updated soon.
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests to us.
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature - Add your changes:
git add . - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin my-new-feature - Submit a pull request :sunglasses:
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
License
MIT License © Andrea SonnY
0.0.1
8 months ago