Skip to main content
The Go SDK instruments servers built with mark3labs/mcp-go (v0.49–v0.56) or the official modelcontextprotocol/go-sdk (v1.7.0, MCP protocol 2026-07-28 and earlier). Go 1.25.12+.

Install

Set your API key

Copy both values from the dashboard when you mint the key. US workspaces can omit ANALYTICS_INGEST_URL (the SDK defaults to the US endpoint); EU workspaces must set it to https://eu.armature.tech/api/mcp-analytics/ingest. If the key is missing, the SDK quietly no-ops — your server keeps working, and no data is sent.

Instrument your server

Create the server with NewMCPServer and register tools with InstrumentTool:
main.go

Existing servers

Attach a recorder to a server you already construct:
For the official SDK, use official.NewRecorder(config) followed by rec.Install(server).
Running on serverless or stateless HTTP? See Stateless & serverless servers and set Delivery: armatureanalytics.DeliveryAwait.

Configuration

OnError is silent by default in Go. Set it in production — otherwise an invalid key or network failure drops events with no signal.

Flush on shutdown

NewMCPServer returns a Shutdown function that drains pending deliveries — call it with a timeout on exit (as in the quickstart above). With a manual recorder, call rec.Close(ctx).

What’s not captured

The Go SDK records one session_init per session and every tools/call. On the classic protocol the session_init comes from the initialize handshake; on the 2026-07-28 stateless protocol there is no handshake, so the SDK emits it when a new session identity first appears on any method. Prompts, resources, and OAuth flows are not captured.

Troubleshooting

With the official SDK adapter, install the analytics middleware before your auth middleware if your ActorSeed reads values that auth injects into the context.
Check ANALYTICS_INGEST_API_KEY is set (missing keys disable delivery silently by design), check ANALYTICS_INGEST_URL matches your workspace region — EU keys are rejected by the US endpoint — and set Config.OnError to surface failures.