signoz-mcp-server
CLAUDE.md125 starsChanged 4 months agoApache-2.0View on GitHub
Go MCP server that gives MCP clients access to SigNoz metrics, logs, traces, alerts, dashboards, saved views, notification channels, and docs over stdio and stateless streamable HTTP. It calls the SigNoz backend and query-builder (QB) APIs upstream. Downstream, MCP clients, the SigNoz/agent-skills repo, and custom agents and clients built on this server consume its tool contracts. - make ci: run before pushing. Runs everything the PR gate runs except the live e2e suite: check-fmt, lint (golangci-lint pinned to CI's version),…
- Installs packages
In this repositoryOne other file it gives its agents.
- AGENTS.mdAGENTS.md
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
17 rules. About 0 are common, 7 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 30
No change-detector tests. That means asserting a constant equals its own literal, pinning internal call order, or mirroring the …
- Distinctive: line 33
Before adding a test, search for one that covers the same behavior and extend it.
- Very specific: line 42
Read docs/mcp-best-practices.md before adding or changing a tool, parameter, description, resource, prompt, error, or result shape, then …
- Very specific: line 47
Every tool input schema exposes a top-level searchContext string with the user's original question (SCH-5).
- Very specific: line 57
Update guardrails/tests.txt when a TestGuardrail_* test is added, removed, or renamed.
- Very specific: line 58
Add an e2e test in tests/e2e/tests/ when the behavior depends on SigNoz.
- Distinctive: line 70
Only expose features the SigNoz UI can render.
- Very specific: line 79
When editing tool or parameter descriptions, signoz:// resources, prompts, server instructions, or manifest.json descriptions, follow …
- Very specific: line 85
Follow guardrails/README.md.
- Distinctive: line 88
Never weaken a guardrail merely to pass CI.
- Distinctive: line 101
Test against reality where you can: an e2e test or a recorded real response, so upstream drift fails a test, not a user.
- Distinctive: line 103
When tests can't catch it, observability must.
- Very specific: line 107
Don't hide global upstream failures inside partial item results.
- Very specific: line 138
Don't silence the gate: fix the cause instead of adding //nolint.
- Very specific: line 148
Before a PR leaves draft, mark its plan Done with the outcome and verification results, or explain in Outcome why it merges incomplete.
- Very specific: line 163
Create GitHub issues in SigNoz/nerve-pod by default, and in another repo only when asked.
- Distinctive: line 166
When babysitting a PR, poll checks and comments newer than the last push.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
Go MCP server that gives MCP clients access to SigNoz metrics, logs, traces, alerts, dashboards, saved views, notification channels, and docs over stdio and stateless streamable HTTP. It calls the SigNoz backend and query-builder (QB) APIs upstream. Downstream, MCP clients, the SigNoz/agent-skills repo, and custom agents and clients built on this server consume its tool contracts.
Commands
make ci: run before pushing. Runs everything the PR gate runs except the live e2e suite:check-fmt,lint(golangci-lint pinned to CI's version),check-deps,check-build,test-race,check-guardrails,check-protocol,check-conformance,check-e2e-style, andcheck-repo-docs. Each step is also its own target. Needs Node, uv, goimports (make install-goimports), and GNUtimeout(on macOS,brew install coreutils). CI uses Go 1.26; with a newer local Go, runGOTOOLCHAIN=go1.26.0 make cito match it.make test: all Go tests, verbose. One test:go test ./internal/handler/tools -run TestName -count=1.make fmt goimports: rewrite formatting and imports.make buildruns both first.make test-e2e: e2e suite against an ephemeral SigNoz cast by foundry.make setup-e2e-envkeeps the environment andmake test-e2e-reusereruns against it. Seetests/README.md.make docs-index: rebuild the embedded docs corpus ininternal/docs/assets/. Diff the manifest and commit both files.make check-repo-docs READY=1: the plan rules CI applies once a PR leaves draft.
Tests
- Assert observable behavior: tool results, coded errors, structured content, and the requests the client sends upstream. A refactor that keeps behavior should leave every test green. Prefer exercising the handler or client over unexported helpers.
- No change-detector tests. That means asserting a constant equals its own literal, pinning internal call order, or mirroring the implementation step by step. If the only way a test can fail is someone editing the code under test, don't write it.
- Before adding a test, search for one that covers the same behavior and extend it. Cover each behavior once, at the lowest layer that runs the real code. Name test files and functions after the behavior they cover, not the review round or issue that prompted them.
- Exception: drift pins are fine when they guard a contract, such as the wire catalog,
guardrails/budgets, and recorded upstream responses. Say what drift the test catches in its name or a one-line comment.
Changing a Tool, Resource, Prompt, or Configuration Contract
Read docs/mcp-best-practices.md before adding or changing a tool, parameter, description,
resource, prompt, error, or result shape, then review the diff against its section 11 checklist
before opening the PR. Record any MUST exception, and the reason for any SHOULD deviation, in
the PR. Budgets and CI mechanics live in guardrails/README.md. In the same PR:
- Every tool input schema exposes a top-level
searchContextstring with the user's original question (SCH-5). Don't list it inrequiredor describe it as optional. Withmcp.WithInputSchema[T](), putSearchContextonT, because typed schemas replace earliermcp.WithString("searchContext", ...)options. - Handler tests cover the happy path and the most important failure path.
manifest.jsontool metadata matches the registered handlers. Tool names are checked byinternal/mcp-server/integration_test.go.README.mdtool tables and parameter references match current behavior.- In
internal/mcp-server/testdata/wire-catalog/, update only the entries the change intends to alter. Never re-record the catalog. - Update
guardrails/tests.txtwhen aTestGuardrail_*test is added, removed, or renamed. - Add an e2e test in
tests/e2e/tests/when the behavior depends on SigNoz. - Client-visible text follows
docs/client-visible-writing-style.md. docs/has no stale references.- A breaking change (CMP-1) ships with a compatibility path and a migration note (CMP-2). The
compatibility path for a retired or renamed input is a coded validation error that names its
replacement, as for the log
queryalias and flat notification-channel parameters, not a bare unknown-field error. The migration note goes in the PR body. - Top-level integer and boolean parameters also accept their string forms (
intOrStringTypeandboolOrStringType, orintOrStringandboolOrStringfields in typed argument structs), because some clients send every scalar as a string. - Each server release targets the latest SigNoz release. Don't name SigNoz versions in tool or
parameter descriptions,
signoz://resources, or README tool sections. - Only expose features the SigNoz UI can render. An agent can save a query into a dashboard or saved view, so a request type or panel the UI lacks (for example heatmaps) breaks it there.
- The PR summary lists the doc and metadata updates and says whether SigNoz/agent-skills needs a
companion change (CMP-3), with a link when it does. Changes to what skills teach need one: a
renamed or removed tool or parameter, a payload shape, or documented behavior, like the
query→filterrename. Additive or internal changes don't.
Client-Visible Writing Style
When editing tool or parameter descriptions, signoz:// resources, prompts, server instructions,
or manifest.json descriptions, follow docs/client-visible-writing-style.md. Skip it for code,
tests, and internal docs.
Guardrail Changes
- Follow
guardrails/README.md. Keep policy inguardrails/policy.go, the sortedTestGuardrail_*inventory inguardrails/tests.txt, and package-sensitive tests beside their packages. - Never weaken a guardrail merely to pass CI. Document intentional relaxations in the plan and PR summary.
make check-guardrailsruns the inventory check and the guarded tests. Lint changed workflows withactionlint.
External Contracts
Upstream, this server consumes the SigNoz backend and QB APIs. Downstream, MCP clients,
SigNoz/agent-skills, and custom agents and clients parse its tool outputs, error codes, and
signoz:// resources, so those are contracts too (CMP-1). Fixture tests only prove our code
matches our assumption of a contract. They don't catch drift such as a renamed field, a changed QB
envelope, or a new output shape. For code that parses an upstream response or shapes a tool output:
- Test against reality where you can: an e2e test or a recorded real response, so upstream drift fails a test, not a user.
- When tests can't catch it, observability must. Add a metric or WARN log that fires when the contract appears violated.
- Fail open, but never fail silent. Pair every fail-open cross-boundary parse with a detectable signal.
- Don't hide global upstream failures inside partial item results. SigNoz 401/403 must propagate
through the shared coded error path (
upstreamErrorfor tools) so clients can re-authenticate or handle permissions.
Delegate verification against a live SigNoz instance to a subagent (Agent tool). That covers creating, reading, updating, or deleting real alerts, dashboards, or views, and any multi-step API probing with credentials. The subagent must delete every resource it creates and confirm it's gone, never print or persist credentials, report which fields round-tripped server-side, and prefer copying an existing resource's shape over hand-crafting one.
Done Bar
- Tests cover the happy path and the most important failure path, written to the Tests rules.
- Tool, resource, prompt, or configuration changes: the checklist above, plus a review against
the
docs/mcp-best-practices.mdsection 11 checklist. - Upstream parsing changes: an e2e test or recorded real response, plus a WARN log or metric for contract violations.
- Transport or protocol-runtime changes: prove both protocol eras on every production transport
(CMP-4 to CMP-6) and run
make check-protocol check-conformance. - Docs search or ranking changes:
internal/docs/golden_test.gostill passes its per-style recall and precision gates against the baseline. - Architecture changes: update
docs/architecture.md. make cipasses.
Code Style
- Comments: only for a non-obvious why (gotcha, invariant, cross-cutting reason), in 1–3 lines.
- Logging: structured
log/slog, with variable data in attributes rather than the message. Never log API keys,Authorizationheaders, OAuth tokens or encrypted blobs, or other credentials. - Errors: tool handlers return coded results (
upstreamError,errorWithCode) instead of Go errors, so clients get a code and recovery guidance. - Don't silence the gate: fix the cause instead of adding
//nolint. When one is unavoidable, name the linter and say why, e.g.//nolint:errcheck // best-effort close. - Generated files: rebuild the docs corpus with
make docs-index. Never hand-editinternal/docs/assets/corpus.gob.gz.
Plans
- For non-trivial or multi-session work, check
plans/and followplans/README.md: oneplans/YYYY-MM-DD-<slug>.mdper change, committed with the implementation, with no separate context log. Current code, tests, schemas, anddocs/take precedence over plans. - Before a PR leaves draft, mark its plan
Donewith the outcome and verification results, or explain in Outcome why it merges incomplete. Thechecks / repo-docsjob fails ready PRs otherwise. - Legacy
.context.md/.plan.mdpairs are history. Continue in-flight work in its pair and preserve the append-only discussion log. Don't create new pairs or bulk-convert old ones.
Git & PR
- Conventional commits and PR titles:
feat:,fix:,chore:,refactor:,test:,docs:, e.g.chore(rate-limits): centralize override defaults. - Mark a breaking change with
!after the type or scope, e.g.feat!:orfix(alerts)!:. The release workflows list these commits under "Breaking changes" inCHANGELOG.md. - One concern per PR. If the description says "also", split it.
- PR body: the problem in a sentence or two, then how you fixed it, then how you verified it. End with the model and harness that did the work. Update the body whenever the diff changes.
- Create GitHub issues in
SigNoz/nerve-podby default, and in another repo only when asked. Include aContext:line naming the docs or plans an agent should read, e.g.Context: docs/mcp-best-practices.md. - When babysitting a PR, poll checks and comments newer than the last push. Verify each bot finding against the source, fix the real ones, and dismiss false positives with a written reason. Stay quiet when nothing is new. Stop when checks pass on the latest commit and every bot finding has a fix or a reply.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

