This skill guides designing MCP servers optimized for agent reasoning, providing task-focused tools, minimal complexity, and actionable guidance for scalable
npx playbooks add skill xmcp-dev/skills --skill mcp-server-design
This skill provides best practices for designing MCP (Model Context Protocol) servers that work effectively with LLM agents. The key insight: design for agents, not automation. LLMs are human-like thinkers, not API consumers.
Traditional API design optimizes for programmatic access with granular endpoints. MCP tool design should optimize for how LLMs think and reason:
Anti-pattern: Wrapping every API endpoint as a tool
// Bad: Generic database tools
// src/tools/run-sql.ts
// src/tools/list-tables.ts
// src/tools/describe-table.ts
Best practice: Design tools around user tasks
// Good: Task-oriented tools
// src/tools/prepare-database-migration.ts
import { z } from "zod";
import type { ToolMetadata } from "xmcp";
export const schema = {
description: z.string().describe("What database changes are needed"),
};
export const metadata: ToolMetadata = {
name: "prepare-database-migration",
description: "Design a database change with safety checks and reviewed migration plan",
};
// src/tools/analyze-slow-queries.ts
// src/tools/create-backup.ts
LLMs struggle with long tool lists. Each additional tool:
Guidelines:
Tool names guide LLM behavior. The name should describe the task, not the mechanism.
| Instead of... | Use... |
|---------------|--------|
| post-slack-message | notify-team |
| run-sql-query | analyze-data |
| call-api-endpoint | check-service-status |
For complex flows, one tool per task beats one tool per step.
Anti-pattern: Breaking deployment into atomic operations
// Bad: Too many granular tools
// src/tools/create-branch.ts
// src/tools/commit-changes.ts
// src/tools/push-branch.ts
// src/tools/create-pr.ts
// src/tools/run-tests.ts
// src/tools/merge-pr.ts
Best practice: Single tool for the complete task
// src/tools/deploy-changes.ts
import { z } from "zod";
import type { ToolMetadata } from "xmcp";
export const schema = {
description: z.string().describe("What changes are being deployed"),
runTests: z.boolean().default(true).describe("Run test suite first"),
autoMerge: z.boolean().default(false).describe("Auto-merge after tests pass"),
};
export const metadata: ToolMetadata = {
name: "deploy-changes",
description: "Deploy current changes through the complete workflow",
};
export default function deployChanges({ description, runTests, autoMerge }) {
// Handles: branch creation, commit, push, PR, tests, merge
}
Create a new tool when:
Don't create a new tool when:
Combine multiple operations into one tool when:
Keep operations separate when:
| Granular Tools | Combined Tools |
|----------------|----------------|
| More flexibility | Simpler mental model |
| Higher selection burden | Clearer intent |
| Risk of misuse | Less customizable |
design-principles.md - Extended examples, anti-patterns, and real-world case studiesFor deeper exploration of these concepts, read the design principles reference document.
Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.