# MCP Builder

Build MCP (Model Context Protocol) servers using the official @modelcontextprotocol/sdk.

- Repository: https://github.com/Leanmcp/gateway-skills (2122 stars)
- Category: AI and agents
- License: MIT
- Last updated: 2026-10-07
- Runs scripts: yes, review before use

## Install

Claude Code: `npx skills add Leanmcp/gateway-skills --skill mcp-builder -g -a claude-code -y`
Codex: `npx skills add Leanmcp/gateway-skills --skill mcp-builder -g -a codex -y`
Cursor: `npx skills add Leanmcp/gateway-skills --skill mcp-builder -g -a cursor -y`
Gemini CLI: `npx skills add Leanmcp/gateway-skills --skill mcp-builder -g -a gemini-cli -y`

## Description

Build MCP (Model Context Protocol) servers using the official @modelcontextprotocol/sdk. Use this skill when users ask to create an MCP server, MCP tools, MCP resources, or want to expose APIs/functionality to AI agents. This skill covers vanilla MCP implementation with Streamable HTTP transport, session management, tools, resources, and prompts.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# MCP Builder Skill

This skill guides you in building MCP (Model Context Protocol) servers using the official `@modelcontextprotocol/sdk` package with TypeScript.

## When to Use This Skill

- User asks to "create an MCP server"
- User wants to "expose an API to AI agents"
- User needs "tools for Claude/LLM"
- User mentions "Model Context Protocol"
- User wants to build "AI agent integrations"

## MCP Core Concepts

### What is MCP?

Model Context Protocol (MCP) is an open standard that enables structured, secure interactions between Large Language Models (LLMs) and external systems. MCP acts as a bridge allowing AI agents to:

- Access external data sources safely
- Execute tools and functions
- Maintain consistent communication protocols
- Integrate with APIs and databases

### Key Components

**Tools** - Interactive functions that perform actions or computations:
- Execute operations and computations
- Accept parameters from the LLM
- Return structured responses
- Can change system state (side effects allowed)
- Examples: calculations, database operations, API calls, sending emails

**Resources** - Read-only data endpoints:
- Passive data sources (no side effects)
- Loaded into AI context for reasoning
- URI-based identification
- Examples: documentation, config files, status data, user profiles

**Prompts** - Reusable prompt templates:
- Pre-defined conversation starters
- Can accept arguments for customization
- Return structured messages for the LLM

### Transport Options

| Transport | Best For | Pros | Cons |
|-----------|----------|------|------|
| **Streamable HTTP** | Production, cloud, multiple clients | Scalable, remote access | Requires session management |
| **SSE** | Real-time apps, live updates | Streaming, auto-reconnect | Connection limits |
| **STDIO** | Local desktop, development | Simple, low latency | Single session, local only |

**Recommendation**: Use Streamable HTTP for most production servers.

## Project Structure

The rest: https://github.com/Leanmcp/gateway-skills/blob/HEAD/skills/mcp-builder/SKILL.md
