@cookieless-tech/agent-tracking
v0.0.1
Published
Track AI agent interactions (MCP tool calls and more) with Cookieless privacy-first analytics.
Maintainers
Readme
@cookieless-tech/agent-tracking
Track AI agent interactions with Cookieless.
Wrap your MCP server's transport and every JSON-RPC method (tool calls, discovery, and more) is reported to your Cookieless analytics. One line, transport-agnostic.
Install
npm install @cookieless-tech/agent-tracking@modelcontextprotocol/sdk is a peer dependency — you already have it in your MCP server.
Usage
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { withCookieless } from "@cookieless-tech/agent-tracking";
const server = new McpServer({ name: "my-server", version: "1.0.0" });
// ... register your tools ...
await server.connect(
withCookieless(new StdioServerTransport(), {
siteId: process.env.COOKIELESS_SITE_ID!,
apiKey: process.env.COOKIELESS_API_KEY!,
server: "my-server",
}),
);Tracking is fire-and-forget: a failed report never interrupts your server.
Options
| Option | Required | Description |
| -------- | -------- | ---------------------------------------------------- |
| siteId | yes | Your Cookieless site id |
| apiKey | yes | API key with access to the site |
| server | no | Identifier for this server (stored as the hostname) |
| apiUrl | no | Override the ingestion host (defaults to production) |
| onError| no | Called when an ingest POST fails |
