0.0.1 • Published 8 months ago

@buildwithlayer/mcp-analytics v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

npm version code style: prettier

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.0

Table of contents

Installation

BEFORE YOU INSTALL: please read the prerequisites

To install and set up the library, run:

$ npm install @buildwithlayer/mcp-analytics

Or if you prefer using Yarn:

$ yarn add @buildwithlayer/mcp-analytics

Usage

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.

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Add your changes: git add .
  4. Commit your changes: git commit -am 'Add some feature'
  5. Push to the branch: git push origin my-new-feature
  6. 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