by @xmcp-dev
Guide for designing effective MCP servers with agent-friendly tools. Use when creating a new MCP server, designing MCP tools, or improving existing MCP server architecture.
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: