streamnative-mcp-server
Copilot instructions24 starsChanged 10 months agoApache-2.0View on GitHub
Use the repo's concrete workflow and architecture, not generic Go defaults. The codebase targets Go 1.25.12 from go.mod.
The file
We split this copilot-instructions.md into the rules it gives an agent
11 rules. About 0 are common, 2 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 3
Use the repo's concrete workflow and architecture, not generic Go defaults.
- Very specific: line 21
If you add files or touch license headers, run make license-check and make license-fix.
- Very specific: line 22
If you touch charts/, cmd/snmcp-e2e/, or scripts/e2e-test.sh, also run ./scripts/e2e-test.sh all.
- Very specific: line 23
If you change release or packaging flow, also run go generate ./...
- Very specific: line 46
Keep feature gating aligned with pkg/mcp/features.go.
- Distinctive: line 49
Keep tests next to the code they validate.
- Distinctive: line 50
If you change public CLI flags, startup behavior, feature names, or connection examples, update README.md.
- Very specific: line 51
If you change a runtime-visible tool, update the matching file in docs/tools/.
- Very specific: line 52
If you change Helm values, update charts/snmcp/README.md and the chart templates together.
- Very specific: line 53
If you change SSE auth, multi-session Pulsar behavior, or protocol/auth flows, review pkg/cmd/mcp/sse.go, pkg/mcp/session/, cmd/snmcp-e2e/, …
- Very specific: line 54
Treat sdk/sdk-apiserver/ and sdk/sdk-kafkaconnect/ as generated local modules.
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions 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
Copilot instructions
Use the repo's concrete workflow and architecture, not generic Go defaults. The codebase targets Go 1.25.12 from go.mod.
Build, test, and lint
go mod verify
go mod download
go fmt ./...
go mod tidy
golangci-lint run --timeout=3m
go test -race ./...
go test -race ./pkg/mcp/builders/...
go test -v -run TestName ./pkg/...
make build- CI expects
go fmt ./...andgo mod tidyto leave no diff behind. make buildwritesbin/snmcpfromcmd/streamnative-mcp-server/main.go.- If you add files or touch license headers, run
make license-checkandmake license-fix. - If you touch
charts/**,cmd/snmcp-e2e/**, orscripts/e2e-test.sh, also run./scripts/e2e-test.sh all. - If you change release or packaging flow, also run
go generate ./...andgoreleaser release --snapshot --clean.
High-level architecture
cmd/streamnative-mcp-server/main.godefines thesnmcpCobra CLI, adds shared config flags, and attaches thestdioandssesubcommands.pkg/cmd/mcp/mcp.goresolves config and selects one runtime mode:--key-fileenables StreamNative Cloud mode, defaults toallfeatures, and ensuresstreamnative-cloudis present if features were set explicitly.--use-external-kafkaenables Kafka-only mode, rejects extra feature flags, and infers Kafka admin, client, and schema registry features.--use-external-pulsarenables Pulsar-only mode, rejects extra feature flags, and infersall-pulsar.
pkg/cmd/mcp/server.gois the server bootstrap and tool-registration hub. It creates backend sessions and wires every Kafka, Pulsar, and StreamNative tool family into one MCP server.pkg/mcp/server.gois the thin wrapper aroundmark3labs/mcp-go; it applies default resource capabilities, recovery, and logging.- Request-scoped sessions are passed through
pkg/mcp/internal/context/ctx.go. Tool handlers are expected to retrieve Kafka, Pulsar, and StreamNative Cloud sessions from there. pkg/mcp/*_tools.gofiles are mostly registration wrappers. The actual Kafka and Pulsar tool schemas and handler logic belong inpkg/mcp/builders/{kafka,pulsar}.- StreamNative Cloud context, resource, and log tools still register from
pkg/mcp/streamnative_*_tools.go;pkg/mcp/builders/streamnative/is not the primary implementation path today. pkg/cmd/mcp/sse.goowns SSE transport, auth middleware, and health endpoints at<httpPath>/sse,<httpPath>/message,<httpPath>/healthz, and<httpPath>/readyz.- Multi-session Pulsar exists only in SSE plus external Pulsar mode.
pkg/mcp/session/caches per-token sessions, and requests must sendAuthorization: Bearer <token>. pkg/mcp/pftools/pluspkg/mcp/pulsar_functions_as_tools.godynamically expose deployed Pulsar Functions as MCP tools, so changes there alter the runtime tool surface.docs/tools/content is surfaced to MCP clients at runtime, so docs changes can be behavior-visible.
Key conventions
- Preserve the current builder-and-wrapper split: add Kafka and Pulsar tool logic under
pkg/mcp/builders/{kafka,pulsar}and keeppkg/mcp/*_tools.gofocused on wiring. - Reuse the typed helpers in
pkg/mcp/internal/context/ctx.go; do not introduce parallel ad hoc context-key patterns. - Keep feature gating aligned with
pkg/mcp/features.go. External Kafka and external Pulsar modes infer their feature sets instead of accepting arbitrary extras. - Respect
--read-only: write-capable tools must not register or leak into read-only mode. - Wrap errors with
%w. In tool handlers, check for missing sessions and returnmcp.NewToolResultError(...)instead of silently succeeding. - Keep tests next to the code they validate. Builder packages already contain unit and parity tests; extend those patterns instead of inventing a separate layout.
- If you change public CLI flags, startup behavior, feature names, or connection examples, update
README.md. - If you change a runtime-visible tool, update the matching file in
docs/tools/. - If you change Helm values, update
charts/snmcp/README.mdand the chart templates together. - If you change SSE auth, multi-session Pulsar behavior, or protocol/auth flows, review
pkg/cmd/mcp/sse.go,pkg/mcp/session/,cmd/snmcp-e2e/,scripts/e2e-test.sh,charts/snmcp/, and the relevantagents/design docs together. - Treat
sdk/sdk-apiserver/andsdk/sdk-kafkaconnect/as generated local modules; prefer regeneration over hand-editing. - Logging uses
logrus, notzap. - Most CLI flags also map to
SNMCP_*environment variables, and the default config/state directory is~/.snmcpunless overridden.
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.

