/go-mcp-server-conventions:go-mcp-server-conventionsfrom go-mcp-server-conventions
Conventions for building MCP servers in Go with the official modelcontextprotocol/go-sdk, covering package layout, tool naming, input and output design, safety for mutating tools, and testing. Use when creating, extending, reviewing, or refactoring a Go MCP server or its tools.
Ships in go-mcp-server-conventions. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Code patterns for everything below are in references/patterns.md.
main.go env config -> API client -> server.New(client).Run(ctx, &mcp.StdioTransport{})
<api>/client.go transport, auth, one method per upstream endpoint actually used
<api>/types.go response structs with only the fields the tools read
server/server.go handlers struct, New(), tools() registering every tool, shared helpers
server/<tool>.go one file per tool, named after it: input/output types plus the handler method
server/*.go non-tool helpers in their own files (dates.go, location.go)
main.go stays small: read env, build the client, start the server.tools() function with the mcp.Tool literal inline, so one place shows all names, descriptions, and annotations. Handlers are methods on a handlers struct holding the client.go get github.com/modelcontextprotocol/go-sdk (no version pin) and check its API with go doc instead of relying on memory. Custom input schemas use github.com/google/jsonschema-go/jsonschema, which the SDK already depends on; importing it directly makes it a direct requirement after go mod tidy.verb_noun: get_account, list_reservations, search_classes, book_slot, cancel_reservation, add_bookmark. No server prefix; clients already namespace by server.schedule and schedules; models confuse singular and plural.slot_id everywhere even if the API calls it schedule_id).jsonschema tag that states format and an example: "earliest slot start, venue-local HH:MM, e.g. 07:30".InputSchema built by the inputSchema[T]() helper so they appear as number, not ["null","number"].name/activity/tag_id) and fail with a message naming the valid options.{"reservations": [...]}.path field.note explaining why and what to try next, ideally distinguishing causes (none nearby vs. none bookable now) with a cheap extra request.ReadOnlyHint: true only for tools that change nothing. A tool that writes anything (even history) gets no read-only hint.DestructiveHint explicitly: new(false) for additive actions, new(true) for cancellations and removals. Set IdempotentHint: true when repeating the call changes nothing more (add or remove a bookmark).max_credits that fails if the price rose, confirm_late that must be set after the user accepts a late-cancel penalty.http.Client gets a timeout. Concurrent 401s refresh the token once (compare against the token that failed).ErrNotFound so tools can degrade gracefully when an endpoint 404s for some resources.Never write anything but protocol messages to stdout. Logs, update notices, and installer output go to stderr; this includes npm wrappers around the binary.
httptest servers with sanitized fixtures.mcp.NewInMemoryTransports() against a fake API handler.null.-race.jq on the JSON-RPC responses.fnox.local.toml for public repos..mcp.json (and other client configs) running fnox exec -- go run . so the repo works as an MCP server immediately.Separate logical steps with blank lines: after each if err != nil block, before the final return, between setup, request, and response handling, and between registrations in tools().
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub dvcrn/skills --plugin go-mcp-server-conventions