Skip to content
Back to skills

Mcp Server Builder

ASecurity

Converts OpenAPI specs to MCP tool definitions, lints tool names, descriptions and schemas, and scaffolds TypeScript or Python servers. Use when exposing an API to AI agents, building a tool server, or reviewing MCP tool definitions before release.

  • 1,271 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added May 27, 2026
data-aitypescriptpythongobashtestingapidocumentation

Works with

  • cursor
  • cli
  • api
  • mcp

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned December 4, 2026

npx -y skills add borghei/Claude-Skills --skill mcp-server-builder --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Mcp Server Builder?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Mcp Server Builder
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/borghei-mcp-server-builder/badge)](https://www.skillsdirectory.com/skills/borghei-mcp-server-builder)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: mcp-server-builder
description: >
  Converts OpenAPI specs to MCP tool definitions, lints tool names, descriptions and
  schemas, and scaffolds TypeScript or Python servers. Use when exposing an API to AI
  agents, building a tool server, or reviewing MCP tool definitions before release.
license: MIT + Commons Clause
metadata:
  version: 1.3.0
  author: borghei
  category: engineering
  domain: ai-integration
  tier: POWERFUL
  updated: 2026-11-08
  frameworks: mcp-sdk, typescript, python, openapi
  tags:
    - mcp
    - ai-integration
    - tool-definitions
    - api
    - ai-agents
---
# MCP Server Builder

The agent designs and ships MCP (Model Context Protocol) servers whose tools an agent picks correctly and calls safely: verb_noun names, descriptions that say when to use the tool and what it returns, typed inputs, paginated lists and gated destructive actions. Schema quality is the main lever: the model chooses tools from names and descriptions alone.

## When to Use

- Exposing an internal REST API to Claude, Cursor or another MCP client.
- Converting an OpenAPI spec into MCP tools, then fixing what the conversion gets wrong.
- Replacing brittle browser automation with typed tool interfaces.
- Reviewing an existing server's tool definitions before release.

## Clarify First

Before building the server, settle the inputs below. When one is missing or vague and would change the result, ask about it; when it wouldn't, use a sensible default and say which one you used.

- **Source contract:** an OpenAPI spec, an existing API, or tools designed from scratch.
- **Language:** TypeScript (`@modelcontextprotocol/sdk`) or Python (`mcp`).
- **Transport:** stdio for local tools, Streamable HTTP for remote or shared servers (HTTP+SSE only for legacy clients).

Ask about the two or three inputs that matter most for this request, not the whole list. If the user wants a result straight away, produce it and state your assumptions at the top.

## Workflow

1. **Get tool definitions.** From a spec: `openapi_converter.py spec.json -o tools.json` (add `--filter GET,POST`, `--exclude '/internal/*'`, `--prefix`). From scratch: write `{"tools": [...]}` by hand using [references/tool-schema-design.md](references/tool-schema-design.md).
2. **Lint naming, descriptions and schemas** with `tool_linter.py tools.json`. Fix every error; rewrite descriptions to say when to use the tool and what it returns.
3. **Lint interaction design** with `tool_schema_linter.py tools.json`: add pagination to list tools, a `confirm` or `dry_run` gate to destructive ones, arrays where calls are naturally repeated.
4. **Scaffold** the server with `server_scaffolder.py tools.json --lang typescript|python --output <dir>`, then implement each handler from [references/server-implementation.md](references/server-implementation.md).
5. **Test** with MCP Inspector and the checks in [references/testing-and-troubleshooting.md](references/testing-and-troubleshooting.md).
6. Done when both linters exit 0 with `--strict`, every handler returns structured errors instead of throwing, and the Inspector lists and calls every tool.

## Quick Start

```bash
# from engineering/mcp-server-builder/; write output outside the repo
OUT=$(mktemp -d)
python3 scripts/openapi_converter.py assets/sample_openapi.json --prefix tasks -o "$OUT/tools.json"
python3 scripts/tool_linter.py "$OUT/tools.json"
python3 scripts/tool_schema_linter.py "$OUT/tools.json"         # exit 1: delete has no confirm gate
python3 scripts/server_scaffolder.py "$OUT/tools.json" --lang python --output "$OUT/server" --dry-run
```

A real run on a deliberately weak file:

```bash
python3 scripts/tool_schema_linter.py assets/flawed_tools.json
```

```text
list_all_users
  W [list-pagination] Tool 'list_all_users' returns a collection but exposes no pagination/limit param (limit, cursor, page_size...). ...
      fix: In 'list_all_users'.inputSchema.properties add "limit": {"type": "integer", "maximum": 100, "default": 25} and "cursor": {"type": "string"}; say in the description that it returns next_cursor.
============================================================
Tools read: 3  Warnings: 2  Info: 3
FIX 2 warnings, 3 info across 3 tools
```

Every finding quotes the tool and property from your file and ends with a `fix:` line. The heuristics are name, description and schema based; they prompt a review, they do not prove a defect.

## Exit Codes

| Code | Meaning |
|------|---------|
| 0 | Clean (linters), or the conversion or scaffold succeeded |
| 1 | Linters only: findings to fix (`tool_linter.py` errors, or warnings with `--strict`; `tool_schema_linter.py` warnings, or info with `--strict`) |
| 2 | Unusable input: unreadable or invalid JSON, wrong shape, empty tools array, converter produced no tools, scaffolder run without `--output` or `--dry-run`. One-line message on stderr, no traceback |

All four tools take `--format text|json` (`--json` is a legacy alias). The scaffolder never writes into the current directory unless you pass `--output`.

## Tools Overview

| Tool | Purpose | Key flags | Exit codes |
|------|---------|-----------|------------|
| `scripts/openapi_converter.py` | OpenAPI 3.x / Swagger 2.0 JSON to MCP tool definitions (`{"tools": [...]}`), operationId to snake_case | `spec`, `-o`, `--prefix`, `--filter GET,POST`, `--exclude GLOB`, `--no-source`, `--format` | 0 converted; 2 missing or invalid spec, or no operations left after filters |
| `scripts/tool_linter.py` | Naming (snake_case, verb_noun), description length and guidance, property types and descriptions | `file`, `--path`, `--strict`, `--format` | 0 no errors (or no warnings with `--strict`); 1 issues; 2 unreadable input |
| `scripts/tool_schema_linter.py` | Interaction smells: list tools without pagination, destructive tools without a gate, chatty single-item tools, unconstrained inputs | `file`, `--path`, `--strict`, `--format` | 0 no warnings; 1 smells found; 2 unreadable input |
| `scripts/server_scaffolder.py` | TypeScript or Python server skeleton with one handler stub per tool | `config`, `--lang`, `--output` (required unless `--dry-run`), `--dry-run`, `--format` | 0 generated; 2 invalid config or no output target |

The linters accept a bare tool, a tool array, or a `{"tools": [...]}` wrapper (converter output); use `--path` for other nesting. The scaffolder takes the converter output directly and derives the server name from the spec title when `name` is absent. Run both linters: they check different things.

## Anti-Patterns

**Mistake:** Shipping the converter output as is.
**Why it matters:** OpenAPI summaries describe endpoints, not when an agent should call them, so the model picks the wrong tool or none.
**Instead:** Rewrite each description with a "Use when ..." clause and what it returns, then re-lint.

**Mistake:** A list tool that returns everything.
**Why it matters:** Unbounded results flood the context window and get truncated mid-record.
**Instead:** Cap the page size, return a cursor, and document both in the description.

**Mistake:** Destructive tools that act on the first call.
**Why it matters:** The agent calls tools speculatively; an ungated delete turns a misunderstanding into data loss.
**Instead:** Add `confirm` or `dry_run` defaulting to the safe path, and say in the description that the action cannot be undone.

## Common Patterns

- **Long-running tools:** emit throttled progress with a stable handle, honor cancellation, and make the final response stand alone. See [references/streaming-batch-and-computer-use.md](references/streaming-batch-and-computer-use.md).
- **Batch-friendly tools:** accept bounded arrays, take an idempotency key, return per-item results so the agent retries only failures.
- **Computer use via MCP:** expose intent-level actions (`navigate`, `click`, `read_page`), return observable state as text first, and gate irreversible actions. For the automation engine see `engineering/computer-use-automation`.

## Reference Documentation

- **[references/tool-schema-design.md](references/tool-schema-design.md)**: naming, the description template and input-schema rules. Read first when defining any tool.
- **[references/server-implementation.md](references/server-implementation.md)**: TypeScript and Python servers (tools, resources, prompts) and the OpenAPI conversion rules. Read when writing handlers.
- **[references/transport-and-deployment.md](references/transport-and-deployment.md)**: transport choice, client configuration and tool versioning. Read when connecting clients or planning releases.
- **[references/testing-and-troubleshooting.md](references/testing-and-troubleshooting.md)**: schema validation, MCP Inspector, pitfalls, troubleshooting and success criteria. Read when validating or diagnosing.
- **[references/streaming-batch-and-computer-use.md](references/streaming-batch-and-computer-use.md)**: streaming and cancellation, computer-use wrappers, batch design and pagination.

## Files

| File | Purpose |
|------|---------|
| `scripts/openapi_converter.py` | OpenAPI to MCP tool definitions |
| `scripts/tool_linter.py` | Naming, description and schema linter |
| `scripts/tool_schema_linter.py` | Interaction-design linter |
| `scripts/server_scaffolder.py` | Server skeleton generator |
| `assets/sample_openapi.json` | Three-operation Tasks API (list, create, delete) |
| `assets/sound_tools.json` | Well-formed tool definitions; both linters exit 0 with `--strict` |
| `assets/flawed_tools.json` | Deliberately weak tool definitions; both linters exit 1 |
| `assets/malformed_tools.json`, `assets/malformed_openapi.json` | Unusable inputs; every tool exits 2 |
| `assets/contract.json` | Declared runs checked by `scripts/skill_contract_check.py` |

## Scope & Limitations

**Covers:** tool, resource and prompt design; TypeScript and Python servers; transport choice and client configuration; OpenAPI conversion; schema and interaction linting.

**Does not cover:**
- MCP clients or orchestration layers (see `engineering/agent-workflow-designer`).
- Multi-agent systems that consume the tools (see `engineering/agent-designer`).
- REST API design itself (see `engineering/api-design-reviewer`).
- Deployment pipelines (see `engineering/ci-cd-pipeline-builder`).

Files in this skill

  • SKILL.md23 KB
  • scripts/openapi_converter.py14.2 KB
  • scripts/server_scaffolder.py11.2 KB
  • scripts/tool_linter.py12.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in data-ai →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.