Skip to content

agentcathq/mcpcat-go-sdk

Repository files navigation

Important

MCPcat is now AgentCat 🐱 β€” same team, same product, new name. This module is frozen. It keeps working forever (nothing is retracted, old version pins keep resolving), but new development happens in go.agentcat.com/sdk. See MIGRATION.md to upgrade. go get go.agentcat.com/sdk

MCPcat Logo

Go Reference Go Report Card License: MIT Go Version GitHub issues CI

Note

Looking for the Python SDK? Check it out here mcpcat-python.

Why use MCPcat? πŸ€”

MCPcat helps developers and product owners build, improve, and monitor their MCP servers by capturing user analytics and tracing tool calls.

Use MCPcat for:

  • User session replay 🎬. Follow alongside your users to understand why they're using your MCP servers, what functionality you're missing, and what clients they're coming from.
  • Trace debugging πŸ”. See where your users are getting stuck, track and find when LLMs get confused by your API, and debug sessions across all deployments of your MCP server.
  • Existing platform support πŸ“Š. Get logging and tracing out of the box for your existing observability platforms (OpenTelemetry, Datadog, Sentry) β€” eliminating the tedious work of implementing telemetry yourself.
mcpcat-diagram

Supported MCP Libraries

MCPcat provides first-class support for the two most popular Go MCP libraries:

Library Install
mcp-go (mark3labs) go get github.com/mcpcat/mcpcat-go-sdk/mcpgo
go-sdk (official) go get github.com/mcpcat/mcpcat-go-sdk/officialsdk

Import the package that matches the MCP library you're already using. Both expose the same Track() API and share the same feature set.

Getting Started

Create an account and obtain your project ID at mcpcat.io. For detailed setup instructions visit our documentation.

Add one Track() call before starting your server:

mark3labs/mcp-go:

import mcpcat "github.com/mcpcat/mcpcat-go-sdk/mcpgo"

shutdown, err := mcpcat.Track(mcpServer, "proj_YOUR_PROJECT_ID", nil)
if err != nil { /* handle error */ }
defer shutdown(context.Background())

Official go-sdk:

import mcpcat "github.com/mcpcat/mcpcat-go-sdk/officialsdk"

shutdown, err := mcpcat.Track(mcpServer, "proj_YOUR_PROJECT_ID", nil)
if err != nil { /* handle error */ }
defer shutdown(context.Background())

Track() returns a shutdown function β€” call it before your application exits to flush all queued events.

Advanced Features

User Identification

Identify your user sessions with a callback to attach user information to every event in a session.

mark3labs/mcp-go:

import (
    "github.com/mark3labs/mcp-go/mcp"
    mcpcat "github.com/mcpcat/mcpcat-go-sdk/mcpgo"
)

shutdown, err := mcpcat.Track(s, "proj_YOUR_PROJECT_ID", &mcpcat.Options{
    Identify: func(ctx context.Context, req *mcp.CallToolRequest) *mcpcat.UserIdentity {
        return &mcpcat.UserIdentity{
            UserID: "user_12345", UserName: "demo_user",
            UserData: map[string]any{"email": "[email protected]"},
        }
    },
})

Official go-sdk:

import (
    "github.com/modelcontextprotocol/go-sdk/mcp"
    mcpcat "github.com/mcpcat/mcpcat-go-sdk/officialsdk"
)

shutdown, err := mcpcat.Track(s, "proj_YOUR_PROJECT_ID", &mcpcat.Options{
    Identify: func(ctx context.Context, req *mcp.CallToolRequest) *mcpcat.UserIdentity {
        return &mcpcat.UserIdentity{
            UserID: "user_12345", UserName: "demo_user",
            UserData: map[string]any{"email": "[email protected]"},
        }
    },
})

Sensitive Data Redaction

MCPcat redacts all data sent to its servers and encrypts at rest, but for additional security, it offers a hook to do your own redaction on all text data before it leaves your server.

shutdown, err := mcpcat.Track(s, "proj_YOUR_PROJECT_ID", &mcpcat.Options{
    RedactSensitiveInformation: func(text string) string {
        return emailRegex.ReplaceAllString(text, "[REDACTED]")
    },
})

Debug Mode

Enable debug logging for troubleshooting. Debug logs are written to ~/mcpcat.log.

shutdown, err := mcpcat.Track(s, "proj_YOUR_PROJECT_ID", &mcpcat.Options{Debug: true})

Using with Existing Hooks (mcp-go only)

If your server already uses mcp-go hooks, pass them via Options.Hooks and MCPCat will append its hooks alongside yours:

shutdown, err := mcpcat.Track(s, "proj_YOUR_PROJECT_ID", &mcpcat.Options{Hooks: hooks})

Internal diagnostics

To help us catch and fix broken installs, the SDK sends MCPCat a small, anonymized signal when setup or runtime errors occur β€” never your tool calls, your responses, or anything about your users. Records carry only operational metadata, such as your project ID (or an anonymous install ID when none is set), SDK version, and Go runtime/OS/arch. Your local ~/mcpcat.log is unchanged.

Diagnostics are on by default and can be turned off completely with either:

  • mcpcat.Options{DisableDiagnostics: true} passed to Track, or
  • the DISABLE_DIAGNOSTICS environment variable.

Configuration Options

Option Type Default Description
DisableReportMissing bool false When true, prevents the get_more_tools tool from being registered
DisableToolCallContext bool false When true, prevents the context parameter from being injected on tool calls
Debug bool false Enable debug logging to ~/mcpcat.log
RedactSensitiveInformation func(string) string nil Custom redaction applied to all text data before sending
Identify callback nil Attach user information to sessions
Hooks *server.Hooks nil Pre-existing hooks to merge with (mcp-go only)

Free for open source

MCPcat is free for qualified open source projects. We believe in supporting the ecosystem that makes MCP possible. If you maintain an open source MCP server, you can access our full analytics platform at no cost.

How to apply: Email [email protected] with your repository link

Already using MCPcat? We'll upgrade your account immediately.

Community Cats 🐱

Meet the cats behind MCPcat! Add your cat to our community by submitting a PR with your cat's photo in the docs/cats/ directory.

bibi zelda

Want to add your cat? Create a PR adding your cat's photo to docs/cats/ and update this section!

About

MCPcat is an analytics platform for MCP server owners 🐱

Resources

License

Contributing

Stars

5 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages