streamnative-mcp-server copilot-instructions.md

A project guide for StreamNative's MCP server, a Go program that exposes StreamNative services to AI tools. It documents how to build, test, lint, package, and understand the codebase.

In plain words
What is it for?
Use it when changing the server, its command-line interface, MCP runtime modes, build files, charts, end-to-end tests, or release process.
Why use it?
It gives coding agents the project's exact commands and conventions instead of relying on generic Go assumptions.

Instructions file for GitHub Copilot

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/streamnative/streamnative-mcp-server/copilot-instructions
Clone the repo
git clone --depth 1 https://github.com/streamnative/streamnative-mcp-server

Made for: GitHub Copilot.

Per session 1,165 This file is loaded in full into every session.
When invoked 1,165 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.01165 $0.01165
Opus 5 $0.00583 $0.00583
Sonnet 5 $0.00233 $0.00233
Haiku 4.5 $0.00117 $0.00117

Measured 2d ago against content hash f2af9ee0d853, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

streamnative-mcp-server copilot-instructions.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.github/copilot-instructions.md · 57 lines

How it starts

The opening of the file, as written. The whole thing — 57 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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 ./... and go mod tidy to leave no diff behind.
  • make build writes bin/snmcp from cmd/streamnative-mcp-server/main.go.
  • If you add files or touch license headers, run make license-check and make license-fix.
  • If you touch charts/**, cmd/snmcp-e2e/**, or scripts/e2e-test.sh, also run ./scripts/e2e-test.sh all.
  • If you change release or packaging flow, also run go generate ./... and goreleaser release --snapshot --clean.

High-level architecture

  • cmd/streamnative-mcp-server/main.go defines the snmcp Cobra CLI, adds shared config flags, and attaches the stdio and sse subcommands.
  • pkg/cmd/mcp/mcp.go resolves config and selects one runtime mode:
    • --key-file enables StreamNative Cloud mode, defaults to all features, and ensures streamnative-cloud is present if features were set explicitly.
    • --use-external-kafka enables Kafka-only mode, rejects extra feature flags, and infers Kafka admin, client, and schema registry features.
    • --use-external-pulsar enables Pulsar-only mode, rejects extra feature flags, and infers all-pulsar.
  • pkg/cmd/mcp/server.go is 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.go is the thin wrapper around mark3labs/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.go files are mostly registration wrappers. The actual Kafka and Pulsar tool schemas and handler logic belong in pkg/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.go owns 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 send Authorization: Bearer <token>.
  • pkg/mcp/pftools/ plus pkg/mcp/pulsar_functions_as_tools.go dynamically 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.

Read the full file on GitHub · 57 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 57 lines · 1,165 tokens per session scan A f2af9ee0d853

Subscribe to this mod's changes

streamnative-mcp-server copilot-instructions.md is an instructions file published in the GitHub repository streamnative/streamnative-mcp-server (24 stars, last pushed 19d ago), licensed Apache-2.0. It adds 1,165 tokens to every session, about $0.0058 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other instructions, from other repositories