SkillsMar 29, 2026·3 min read

Claude Official Skill: mcp-builder

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP serve...

TL;DR
The mcp-builder skill teaches Claude Code to create production-quality MCP servers with proper tool definitions and testing.
§01

What it is

The mcp-builder is an official Claude Code skill that guides the agent through creating high-quality MCP (Model Context Protocol) servers. MCP servers enable LLMs to interact with external services, databases, APIs, and tools through a standardized protocol. This skill encapsulates best practices for server architecture, tool definitions, resource handling, error management, and testing.

Developers building MCP integrations for Claude Code, Claude Desktop, or other MCP-compatible clients benefit most. The skill eliminates guesswork about MCP server structure and ensures the output follows the protocol specification.

§02

How it saves time or tokens

Building an MCP server from scratch requires understanding the protocol specification, setting up the transport layer, defining tool schemas, handling errors correctly, and writing tests. The mcp-builder skill front-loads all of this knowledge so Claude Code produces correct server code on the first attempt. Instead of iterating through protocol misunderstandings, the agent follows a validated template that covers common patterns.

§03

How to use

  1. Add the mcp-builder skill to your Claude Code project. It is included as an official skill in Claude Code installations.
  1. Ask Claude Code to build an MCP server:
Build an MCP server that connects to my PostgreSQL database and exposes query and schema inspection tools
  1. Claude Code follows the skill's guidance to generate:
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';

const server = new Server({
  name: 'postgres-mcp',
  version: '1.0.0'
}, {
  capabilities: { tools: {} }
});

server.setRequestHandler('tools/list', async () => ({
  tools: [
    {
      name: 'query',
      description: 'Execute a read-only SQL query',
      inputSchema: {
        type: 'object',
        properties: {
          sql: { type: 'string', description: 'SQL query to execute' }
        },
        required: ['sql']
      }
    }
  ]
}));
§04

Example

// Tool handler with proper error handling
server.setRequestHandler('tools/call', async (request) => {
  const { name, arguments: args } = request.params;
  
  if (name === 'query') {
    try {
      const result = await pool.query(args.sql);
      return { content: [{ type: 'text', text: JSON.stringify(result.rows) }] };
    } catch (error) {
      return { content: [{ type: 'text', text: `Query error: ${error.message}` }], isError: true };
    }
  }
});

const transport = new StdioServerTransport();
await server.connect(transport);
§05

Related on TokRepo

§06

Common pitfalls

  • MCP servers must handle errors gracefully with isError: true in the response. Throwing unhandled exceptions crashes the server and disconnects the client.
  • Tool input schemas must use JSON Schema format. Missing required fields or incorrect types cause silent failures when the client validates inputs.
  • The stdio transport reads from stdin and writes to stdout. Any console.log statements in your server code corrupt the protocol stream. Use stderr for debug logging.

Frequently Asked Questions

What is MCP?+

MCP (Model Context Protocol) is a standard protocol for connecting AI models to external tools and data sources. It defines how a client (Claude Code, Claude Desktop) communicates with a server that provides tools, resources, and prompts.

What languages can I build MCP servers in?+

The official MCP SDK is available for TypeScript/JavaScript and Python. The mcp-builder skill primarily generates TypeScript servers using the @modelcontextprotocol/sdk package. Community SDKs exist for Go, Rust, and other languages.

Can this skill build MCP servers for any service?+

Yes. The skill guides Claude Code to build MCP servers for databases, APIs, file systems, cloud services, and custom tools. You describe what the server should connect to and what operations it should expose, and the skill structures the implementation.

How do I test an MCP server?+

The mcp-builder skill includes testing guidance. Use the MCP Inspector tool to manually test tool calls, or write automated tests that spawn the server process and send protocol messages via stdin/stdout.

Do I need to install anything special to use this skill?+

The mcp-builder skill is included with Claude Code. To build servers, you need Node.js (for TypeScript servers) or Python. The @modelcontextprotocol/sdk package is installed as a dependency of your server project.

Citations (3)
🙏

Source & Thanks

Created by Anthropic. Licensed under MIT. anthropics/skills

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets