mcp-server-authoring
Skill65 starsChanged 15 days agoMITView on GitHub
Skriv, test og registrer MCP-servere som kjører bak fleet-gateway på Nais, med Texas-auth, verktøydesign for agenter, ROS og OWASP MCP Top 10
In this repository40 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- ai-news-researchSkill
- aksel-builderSkill
- api-designSkill
- appsec-advisorySkill
- conventional-commitSkill
- deliberate-ai-useSkill
- dependency-upgradeSkill
- flyway-migrationSkill
- innblikkSkill
- jackson-3-migrationSkill
- java-to-kotlinSkill
- kafkaSkill
- klarsprakSkill
- kotlin-app-configSkill
- ktor-scaffoldSkill
- naisSkill
- nav-architecture-reviewSkill
- nav-authSkill
- nav-deep-interviewSkill
- nav-dekoratorenSkill
- nav-planSkill
- nav-troubleshootSkill
- observability-debuggingSkill
- observability-setupSkill
- playwright-testingSkill
- postgresql-reviewSkill
- readme-reviewSkill
- repo-baseline-auditSkill
- repo-pii-auditSkill
- rust-developmentSkill
- security-owaspSkill
- security-reviewSkill
- spring-boot-scaffoldSkill
- terse-modeSkill
- threat-modelSkill
- tokenx-authSkill
- web-design-reviewerSkill
- workstation-securitySkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 26
Evaluate: Write 10 realistic multi-step questions with a known answer.
- Very specific: line 69
Go:: no SDK needed; copy the pattern from apps/mcp-kodeverk (reference for auth, caps, pagination, output schema, compliance test …
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill 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
MCP Server Authoring
Build an MCP server that Nav teams can run behind fleet-gateway. Workflow adapted from Anthropic's mcp-builder (Apache-2.0, see NOTICE); the Nav layer is added.
When to Use
- Creating a new MCP server on Nais, or adding tools to one
- Registering a server in the registry and the gateway
- Reviewing an MCP server for security or agent usability
Workflow
- Plan tools. List the tasks an agent must finish, not the API endpoints. Merge list+filter into one search tool. Aim for few tools.
- Implement. Pick the SDK (see Language notes), add auth (Nav layer), input validation, caps.
- Test. Unit-test each tool. Run the server locally and call it with MCP Inspector. Test the auth rejects (wrong audience, wrong
azp, app token). - Evaluate. Write 10 realistic multi-step questions with a known answer. Measure accuracy, number of calls, errors. Fix descriptions first, code second.
- Register and ship. ROS, registry entry, gateway route, then rollout.
Guidelines (source of truth)
The full rules, each linked to OWASP MCP Top 10 and the MCP 2026-07-28 spec, live in one place: Retningslinjer for MCP-servere (apps/my-copilot/src/app/(nb)/(mcp)/mcp/tilby-server/retningslinjer/page.tsx). Do not repeat them here; read the page. Registration steps: fleet-gateway for teams.
Checklist:
- Texas introspection;
azpis fleet-gateway,NAVidentpresent, app tokens rejected; OBO, no passthrough. - Read tools first; writes only after ROS sign-off.
- Write tools: the server enforces confirmation itself (two-step preview + short-lived token, as
mcp-dollycreate_order); a client prompt orinput_requiredalone is not enough. - Explicit
tools:list in route and registry, nopassAllTools. - Caps on input, request body, page size and response size; timeouts upstream.
Mcp-*headers checked against the body (-32020).- No tokens or personal data in logs.
- Static descriptions; all four annotations set; annotations are hints only.
- Per-tool metrics with bounded labels (tool name, outcome).
- Output is an API:
outputSchema+structuredContent(also the serialized JSON as acontenttext block, for clients that ignorestructuredContent); only add fields. - Never truncate silently: cut on characters, not bytes, with a marker and a tool hint; lists carry
truncatedand the remaining count. - Oversized backend replies are errors, not truncated data.
- Free text written by others is marked or left out of what the model reads.
- User ID from the token (
NAVident), never from tool arguments. - No citizen or case data; never log content.
- Few tools; no demo tools in prod.
- Negative tests: expired token, app token, wrong
azp, missingNAVident, wrong tool, oversized body. - Fresh login before writes once the owner has set the rule (#2964, not decided).
- One ROS per server (template:
fleet-gateway/ros-mcp-server-mal.mdin the privatenavikt/copilot-internrepo).
Registry and gateway route
- Registry: add an entry to
apps/mcp-registry/allowlist.json. Thename(e.g.io.github.navikt/kodeverk) must not contain the transport. - Gateway: add a route to
apps/fleet-gateway/pilot-routes.prod.yaml(and dev) with an explicittools:list. Only the operator usespassAllTools.toolsin the route and in the registry must match. - Network: the route alone does not make the server reachable. Add the server to
outbound_rulesinapps/fleet-gateway/.nais/dev-gcp.yamland.nais/prod-gcp.yaml(application, plusnamespacewhen the server is outsidecopilot).
Further reading
OWASP MCP Top 10, MCP authorization, tools spec, Writing tools for agents.
Language notes
- Kotlin: official Kotlin MCP SDK with Ktor (
mcpStreamableHttp). The README says nothing on auth or spec version: add the Texas check as a Ktor plugin and test the2026-07-28behaviour yourself. - TypeScript: official TypeScript SDK (v2 follows
2026-07-28, Streamable HTTP). Validate tokens before the transport sees the request. - Go: no SDK needed; copy the pattern from
apps/mcp-kodeverk(reference for auth, caps, pagination, output schema, compliance testmcp2026_compliance_test.go).
References
apps/mcp-kodeverk— read-only reference serverapps/mcp-dolly— write tool (create_order) with caps, quota, ownership, audit lineapps/fleet-gateway/README.md— routes, tool lists, limits- fleet-gateway for teams
- Retningslinjer for MCP-servere
- Anthropic mcp-builder (source of the workflow, Apache-2.0)
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.

