build-mcp-server
Skill7 starsChanged 17 days agoMITView on GitHub
Use when exposing a service or dataset to AI clients through the Model Context Protocol — few task-shaped tools with typed inputs, read-only by default, server-enforced confirmation for writes, stdio or Streamable HTTP, OAuth for remote, size limits, tests with the Inspector.
- Installs packages
- Sends data out
12 other projects use a version of this.
Adopted by
Most recently taken up by
- jgobuilds/ai-standards-publictheir own version, first seen Nov 1, 2026
- VelimirMueller/ai-development-skillsword for word, first seen Oct 25, 2026
- sepehr071/toolsmelttheir own version, first seen Oct 25, 2026
- bosens-China/tc39-atlastheir own version, first seen Oct 23, 2026
- anthropics/claude-plugins-officialtheir own version, first seen Oct 13, 2026
- gcapodeferro02/my-agent-skillstheir own version, first seen Sep 21, 2026
Other versions12 projects use a version of this.
Word for word · 1
- VelimirMueller/ai-development-skills★ 7100% same
Edited · 0
None found.
Wrote their own version · 11
- anthropics/claude-plugins-official★ 46ksame name
- chrisdoc/hevy-mcp★ 535same name
- sepehr071/toolsmelt★ 18same name
- backnotprop/build-mcp-server★ 7same name
- HK-hub/AgentSkills★ 6same name
- pproenca/unifi-mcp★ 2same name
- gcapodeferro02/my-agent-skills★ 1same name
- japlete/md-vision-mcp★ 1same name
- bosens-China/tc39-atlas★ 0same name
- jgobuilds/ai-standards-public★ 0same name
1 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository156 other files it gives its agents.
- skills/swift/swiftui-design-principles/AGENTS.mdAGENTS.md
- skills/swift/ios-code-audit/CLAUDE.mdCLAUDE.md
- skills/swift/swift-focusengine-pro/llms.txtllms.txt
- build-llm-seamSkill
- build-rag-pipelineSkill
- secure-llm-featuresSkill
- set-up-llm-evalsSkill
- build-nextjs-backendSkill
- build-supabase-edge-functionSkill
- configure-backend-testsSkill
- design-http-apiSkill
- harden-backendSkill
- scaffold-fastapi-serviceSkill
- scaffold-go-serviceSkill
- scaffold-hono-serviceSkill
- secure-supabase-rlsSkill
- set-up-backend-authSkill
- set-up-background-jobsSkill
- set-up-databaseSkill
- set-up-nextjs-supabase-authSkill
- set-up-observabilitySkill
- set-up-supabaseSkill
- build-cliSkill
- release-cliSkill
- set-up-dev-toolchainSkill
- audit-securitySkill
- audit-toolchainSkill
- extend-skillsetSkill
- promote-releaseSkill
- set-up-stack-profileSkill
- write-commit-messagesSkill
- write-pull-requestsSkill
- analyze-complexitySkill
- apply-algorithmsSkill
- apply-design-patternsSkill
- apply-design-principlesSkill
- apply-solidSkill
- choose-data-structureSkill
- debug-systematicallySkill
- enforce-dependency-ruleSkill
- refactor-safelySkill
- slice-and-estimateSkill
- write-clean-testsSkill
- write-readable-codeSkill
- clean-frontend-scaffoldingSkill
- configure-accessibilitySkill
- configure-analyticsSkill
- configure-ciSkill
- configure-error-trackingSkill
- configure-lintingSkill
- configure-test-stackSkill
- configure-typescriptSkill
- create-moduleSkill
- optimize-performanceSkill
- scaffold-frontend-projectSkill
- set-up-authSkill
- set-up-design-systemSkill
- set-up-document-headSkill
- set-up-error-boundariesSkill
- set-up-feature-flagsSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.
0
Common
Most of the 11 edited versions we read keep these.
1
Distinctive
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
- Very specific: line 12
Read .claude/stack-profile.md (languages, backend.track, ai).
- Distinctive: line 26
No server → full install (steps 4–6).
“Common” is measured: kept by at least 6 in 10 of the 11 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Build an MCP Server
An MCP server is an API whose caller is a model: it reads your tool descriptions on every turn and recovers from errors by reading your messages. Design it for that reader. Spec revision 2026-07-28 (stateless, no sessions) and the v2 TypeScript SDK (@modelcontextprotocol/server) are the targets; the older single-package @modelcontextprotocol/sdk 1.x is the previous line.
1. Audit current state
Read .claude/stack-profile.md (languages, backend.track, ai). If absent, detect per stack-profile.md. Change nothing yet:
grep -n "modelcontextprotocol" package.json pyproject.toml 2>/dev/null # which SDK and line
grep -rn "Mcp-Session-Id\|StreamableHTTPServerTransport\|SSEServerTransport\|initialize" src | head # 2025-era code
ls .mcp.json mcp.json src/server.ts src/server.py 2>/dev/null
grep -rn "registerTool\|server.tool(\|@mcp.tool" src | wc -l # tool count
npm view @modelcontextprotocol/server version 2>/dev/null # current v2 lineReport: SDK line (v1 or v2), transport, tool count and names, whether any tool writes, how callers are authenticated, whether tool outputs are bounded.
2. Decide what to do
- No server → full install (steps 4–6).
- v1 server (
@modelcontextprotocol/sdk, sessions, SSE) → migrate to v2 with the SDK's upgrade guide (ts.sdk.modelcontextprotocol.io/v2/migration/upgrade-to-v2); v1 still gets fixes for at least six months after 2026-07-27, so plan it, do not panic. - Server exists → check each tool against mcp-patterns.md and apply the delta.
- A thin wrapper over one HTTP endpoint with one user → ask whether a plain CLI, a script or a skill is simpler. MCP earns its cost with several clients, several tools, or shared auth.
- Everything present and
Verifypasses → "already in place".
3. Detect the track
| Signal | Branch |
| Local, one user, launched by the host as a child process | stdio. No OAuth: credentials come from the environment the host passes |
| Remote or multi-user | Streamable HTTP behind OAuth 2.1 (the server is a resource server). Stateless: no session |
| TypeScript | @modelcontextprotocol/server + @modelcontextprotocol/hono (Hono) or @modelcontextprotocol/node / express |
| Python | mcp 2.x: from mcp.server import MCPServer |
| Go, Rust | Use the official SDK for that language; apply mcp-patterns.md unchanged. No canonical code here |
4. Install only what's missing
pnpm add @modelcontextprotocol/server @modelcontextprotocol/hono hono @hono/node-server zod # remote, TypeScript
pnpm add -D @modelcontextprotocol/client vitest tsx typescript @types/node # tests
uv add mcp # PythonTypeScript 6 or later needs "types": ["node"] in tsconfig.json. Zod must be 4.2 or later (peer of the server package).
5. Generate the seams
Code: mcp-code.md.
src/server.ts # createServer(auth): tools, resources; no transport code
src/http.ts # Streamable HTTP: Hono app, bearer auth, protected-resource metadata
src/stdio.ts # stdio entry for local use
tests/server.test.tsDesign the tools before writing code: list the 3 to 7 things a user asks, make one tool per intent, and write each description as "what it does, when to use it, what it returns, limits". Rules and examples: mcp-patterns.md. Identity (tenant, user) comes from auth (the verified token) passed to createServer, never from a tool argument.
6. Wire it up
- Local:
claude mcp add my-server -- npx tsx src/stdio.ts(Claude Code). Remote:claude mcp add --transport http my-server https://host/mcp; the client discovers the authorization server from the401challenge. - Remote only: point the protected-resource metadata at your authorization server (
AUTH_ISSUER) and setPUBLIC_URLto the exact public URL of the endpoint; tokens must be issued for that audience. Use an existing authorization server (Auth0, Keycloak, Entra ID, a cloud IdP); do not write one. - Behind a reverse proxy, set the allowed hosts and origins explicitly; disable response buffering for the MCP route.
- Log to stderr (stdio) or your logger (HTTP), never to stdout on stdio: stdout is the protocol channel.
7. Verify
pnpm typecheck && pnpm vitest run tests/server.test.ts # in-memory client: tools, structured output, scoping, confirmation
npx @modelcontextprotocol/inspector --cli npx tsx src/stdio.ts --method tools/list
npx @modelcontextprotocol/inspector --cli npx tsx src/stdio.ts --method tools/call --tool-name search_tickets --tool-arg status=open
curl -si -X POST http://127.0.0.1:3000/mcp -H 'Content-Type: application/json' -d '{}' | grep -i www-authenticateExpected: tests green (6 in the example); tools/list returns your tools in a stable order with annotations; the tools/call result carries structuredContent; the unauthenticated curl returns 401 with www-authenticate: Bearer … resource_metadata="…/.well-known/oauth-protected-resource/mcp". For a visual check run the Inspector without --cli and click through each tool, including a bad input and a request with the wrong token.
References
- mcp-patterns.md: rules and why. mcp-code.md: TypeScript and Python code.
- llm-security.md: tool outputs are untrusted text for the client; least privilege by token.
- stack-versions.md: spec revision, SDK lines, Inspector.
- security-baseline.md, config.md.
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.

