TheSimpleApp

mcp-builder

0
0
# Install this skill:
npx skills add TheSimpleApp/agent-skills --skill "mcp-builder"

Install specific skill from multi-skill repository

# Description

Build high-quality Model Context Protocol (MCP) servers to integrate external APIs and services. Use when creating MCP tools, resources, or prompts.

# SKILL.md


name: mcp-builder
description: Build high-quality Model Context Protocol (MCP) servers to integrate external APIs and services. Use when creating MCP tools, resources, or prompts.
license: MIT
metadata:
author: thesimpleapp
version: "1.0"


MCP Builder

Create well-structured Model Context Protocol servers that integrate external APIs and services.

MCP Fundamentals

MCP servers expose three primitives:
1. Tools - Functions the AI can call (with user approval)
2. Resources - Data the AI can read (files, database records, API responses)
3. Prompts - Pre-defined prompt templates

Server Structure

my-mcp-server/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ index.ts          # Main entry point
β”‚   β”œβ”€β”€ tools/            # Tool implementations
β”‚   β”œβ”€β”€ resources/        # Resource handlers
β”‚   └── prompts/          # Prompt templates
β”œβ”€β”€ package.json
β”œβ”€β”€ tsconfig.json
└── README.md

Tool Design Principles

Naming

  • Use verb_noun format: get_user, create_issue, search_files
  • Be specific: get_github_issue not get_issue
  • Match the API's terminology

Input Schema

  • Use JSON Schema for parameter validation
  • Mark required fields explicitly
  • Provide clear descriptions for each parameter
  • Include examples where helpful

Error Handling

  • Return structured error messages
  • Include actionable information
  • Don't expose internal details

Best Practices

Authentication

  • Support environment variables for credentials
  • Never hardcode secrets
  • Document required auth setup clearly

Rate Limiting

  • Implement backoff for API rate limits
  • Cache responses where appropriate
  • Batch requests when possible

Testing

  • Write unit tests for each tool
  • Test error paths, not just happy paths
  • Mock external APIs in tests

Example Tool Implementation

server.tool(
  "get_weather",
  {
    description: "Get current weather for a location",
    inputSchema: {
      type: "object",
      properties: {
        location: {
          type: "string",
          description: "City name or coordinates"
        }
      },
      required: ["location"]
    }
  },
  async ({ location }) => {
    const data = await weatherApi.getCurrent(location);
    return {
      content: [{
        type: "text",
        text: JSON.stringify(data, null, 2)
      }]
    };
  }
);

Resources

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.