agentleFS
patonkikhpatonkikh/APES/skills/mcp/mcp-best-practices/skill.md

mcp-best-practices

Skill3 starsChanged 4 months agoMITView on GitHub

Document and apply MCP implementation best practices: server design, client integration, testing, versioning, observability, and operational readiness for production MCP deployments. Use when working on MCP servers, MCP tools, MCP clients, or Model Context Protocol integrations.

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Document and apply MCP implementation best practices: server design, client integration, testing, versioning, observability, and …

    line 14
  2. Distinctive:

    Document runbook: server restart, token rotation, rollback procedure.

    line 80
  3. Distinctive:

    Use semantic versioning for server packages.

    line 128
  4. Distinctive:

    Document breaking changes with migration guide.

    line 129

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
skill.md

MCP Best Practices

Purpose

Document and apply MCP implementation best practices: server design, client integration, testing, versioning, observability, and operational readiness for production MCP deployments.

Input: MCP server/client implementation (existing or planned), deployment target, team constraints
Output: MCP Best Practices Compliance Report with gap analysis, recommended patterns, and operational playbook Examples: See examples.md for worked input/output.


Workflow

Step 1: Assess current implementation

Score each practice area:

AreaStatusGap
Server scope & naming
Tool design quality
Auth & secrets
Error handling
Testing
Observability
Versioning
Documentation

Step 2: Apply server best practices

PracticeRequirement
Single domainOne server per bounded integration
Tool namingsnake_case, verb_noun, unique across server
DescriptionsLLM-optimized with negative cases
SchemasJSON Schema with constraints on all inputs
ErrorsStructured: code, message, retryable flag
TimeoutsPer-tool and per-request limits
Rate limitingProtect upstream API quotas

Step 3: Apply client best practices

PracticeRequirement
DiscoveryDynamic tool list; no hardcoded assumptions
ValidationClient-side schema check before invoke
ResilienceRetry with backoff on transient errors
DegradationGraceful fallback when server unavailable
LoggingTool name + duration; redact sensitive args

Step 4: Define testing strategy

LevelCoverage
UnitHandler logic, schema validation, error mapping
IntegrationMCP protocol round-trip with test server
ContractSchema snapshot tests on tool definitions
SecurityInjection payloads, auth failure cases
LoadRate limit behavior under concurrent calls

Step 5: Plan observability and operations

SignalToolAlert
Tool success rateMetrics<95% over 5m
Latency p95Metrics> SLA
Error rate by codeLogsSpike in 5xx
Auth failuresLogs>10/hour

Document runbook: server restart, token rotation, rollback procedure.

Step 6: Validate

Run Validation checklist.


Decision Rules

ConditionAction
No integration testsBlock production; minimum contract tests required
Breaking tool schema changeMajor version bump and changelog entry
Multiple teams sharing one serverEstablish ownership and contribution guidelines
Server uptime SLA requiredHTTP transport with health endpoint
Frequent upstream API changesAdd adapter layer in lib/; isolate from tool handlers
Compliance requirement (SOC2, HIPAA)Extend with ai-security skills; audit logging mandatory

Validation

  • All 8 practice areas assessed with gaps identified
  • Server practices: naming, schemas, errors, timeouts documented
  • Client practices: discovery, validation, resilience documented
  • Testing strategy covers unit, integration, contract, security
  • Observability signals and alerts defined
  • Versioning and changelog policy stated
  • README complete: setup, config, tools, troubleshooting
  • Operational runbook for common incidents

Anti-patterns

  • Copy-paste handlers — duplicated logic without shared lib layer.
  • No changelog — breaking changes without consumer notice.
  • Production debugging via printf — unstructured logs without levels.
  • Skipping contract tests — server deploy breaks clients silently.
  • Monorepo chaos — server and unrelated app code interleaved.

Best Practices

  • Pin MCP SDK versions; test upgrades in staging.
  • Publish JSON Schema for tools as machine-readable artifact.
  • Use semantic versioning for server packages.
  • Document breaking changes with migration guide.
  • Schedule periodic security re-review with mcp-security-review.

Output Structure

# MCP Best Practices Report: [Project Name]

## Compliance Summary
| Area | Score (1-5) | Critical gaps |
|------|-------------|---------------|

## Server Practices
[Checklist with pass/fail]

## Client Practices
[Checklist with pass/fail]

## Testing Strategy
| Level | Status | Action items |
|-------|--------|--------------|

## Observability
| Signal | Implementation | Alert |
|--------|----------------|-------|

## Versioning Policy
[Semver rules, changelog format]

## Operational Runbook
| Incident | Detection | Resolution |
|----------|-----------|------------|

## Improvement Roadmap
| Priority | Item | Effort |
|----------|------|--------|

Next Skills

OutcomeRecommended Skill
Security re-assessmentmcp/mcp-security-review
Add new toolsmcp/mcp-tool-generator
New server from scratchmcp/mcp-server-generator
Client improvementsmcp/mcp-client-generator
AI system integrationai/ai-workflow-builder

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.