Agent skill

Generate MCP Server

by trycompai in trycompai/comp

A skill your agent uses when generating an MCP server from an OpenAPI spec with Speakeasy.

Apache-2.0Auto-check passedAgent Workflows

Install Generate MCP Server

skills CLI
$ npx skills add trycompai/comp --skill generate-mcp-server -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install trycompai/comp generate-mcp-server --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/trycompai/comp.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/generate-mcp-server .claude/skills/generate-mcp-server && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
generate-mcp-server
GitHub stars
2k
Token cost
~2.7k tokens
SKILL.md length
804 words
Files
1
Skills in repo
31
Repo updated
First seen
Licence
Apache-2.0

At a glance

A skill your agent uses when generating an MCP server from an OpenAPI spec with Speakeasy.

  • Works in 4 steps: Create the Scopes Overlay → Create the Workflow Configuration → Configure gen.yaml → …
  • Generating an MCP server from an OpenAPI spec with Speakeasy
  • SKILL.md covers When to Use, Inputs, Outputs and Prerequisites, plus 7 more sections
  • Calls npx, docker-compose and claude; needs SPEAKEASY_API_KEY and API_TOKEN

What it does

Generate MCP Server is an agent skill from trycompai/comp. Use when generating an MCP server from an OpenAPI spec with Speakeasy. Triggers on "generate MCP server", "MCP server", "Model Context Protocol", "AI assistant tools", "Claude tools", "speakeasy MCP", "mcp-typescript"

Its SKILL.md is about 2.7k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Agent Workflows, covering MCP servers and OpenAPI specifications. It works with Model Context Protocol, OpenAPI, TypeScript and Docker. The repository describes itself as: AI Native platform to get companies compliant - Vanta & Drata Alternative. The licence is Apache-2.0.

When your agent uses it

  • Generating an MCP server from an OpenAPI spec with Speakeasy
  • Generate MCP server
  • Model Context Protocol
  • AI assistant tools

Example prompts

  • “generate MCP server”
  • “MCP server”
  • “Model Context Protocol”
  • “/generate-mcp-server”

Requirements

  • Node.js
  • Docker
  • A credential in SPEAKEASY_API_KEY
  • A credential in YOUR_TOKEN

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Create the Scopes Overlay
  2. Create the Workflow Configuration
  3. Configure gen.yaml
  4. Generate

What it can do on your machine

Read from SKILL.md and the folder at commit 1bf4d52. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npx
    • docker-compose
    • claude

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use npx, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • SPEAKEASY_API_KEY
    • API_TOKEN

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Generate MCP Server loads about 2.7k tokens when it runs. Until then it costs about 59 tokens; SKILL.md has 804 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~59
When it runs · the whole SKILL.md, loaded when a task matches
~2.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from trycompai/comp at commit 1bf4d52, republished under its Apache-2.0 licence (© trycompai). 804 words, ~2,747 tokens.

Download SKILL.mdSave it as .claude/skills/generate-mcp-server/SKILL.md (or your agent's skills folder).
name
generate-mcp-server
description
Use when generating an MCP server from an OpenAPI spec with Speakeasy. Triggers on "generate MCP server", "MCP server", "Model Context Protocol", "AI assistant tools", "Claude tools", "speakeasy MCP", "mcp-typescript"
license
Apache-2.0

generate-mcp-server

Generate a Model Context Protocol (MCP) server from an OpenAPI spec using Speakeasy. The MCP server exposes API operations as tools that AI assistants like Claude can call directly.

When to Use

  • User wants to create an MCP server from their API
  • User asks about Model Context Protocol integration
  • User wants AI assistants to interact with their API
  • User says: "generate MCP server", "create MCP server", "speakeasy MCP"
  • User asks: "How do I make my API available to Claude?"
  • User mentions: "mcp-typescript", "AI assistant tools", "Claude tools"

Inputs

InputRequiredDescription
OpenAPI specYesPath or URL to the OpenAPI specification
Package nameYesnpm package name for the MCP server (e.g., my-api-mcp)
Auth methodYesHow the API authenticates (bearer token, API key, etc.)
Env var prefixNoPrefix for environment variables (e.g., MYAPI)
Scope strategyNoHow to map operations to scopes (default: read/write by HTTP method)

Outputs

OutputDescription
MCP serverTypeScript MCP server with one tool per API operation
CLI entry pointCommand-line interface with stdio and SSE transports
Scope definitionsScope-based access control for filtering tools
Docker supportDockerfile and compose config for containerized deployment
Workflow config.speakeasy/workflow.yaml configured for MCP generation

Prerequisites

  1. Speakeasy CLI installed and authenticated:
bash
speakeasy auth login
# Or for CI/AI agents:
export SPEAKEASY_API_KEY="<your-api-key>"
  1. Node.js 20+ installed (for the generated MCP server).

  2. A valid OpenAPI spec (3.0 or 3.1). Validate first:

bash
speakeasy lint openapi --non-interactive -s ./openapi.yaml

Run speakeasy auth login to authenticate interactively, or set the SPEAKEASY_API_KEY environment variable.

Command

The generation uses speakeasy run after configuring the workflow, overlays, and gen.yaml. There is no single command -- follow the step-by-step workflow below.

bash
# After all config files are in place:
speakeasy run

Step-by-Step Workflow

Step 1: Create the Scopes Overlay

Create mcp-scopes-overlay.yaml in the project root. This controls which API operations become MCP tools and what scopes they require:

yaml
# mcp-scopes-overlay.yaml
openapi: 3.1.0
overlay: 1.0.0
info:
  title: Add MCP scopes
  version: 0.0.0
actions:
  # Enable read operations
  - target: $.paths.*["get","head"]
    update:
      x-speakeasy-mcp:
        scopes: [read]
        disabled: false

  # Enable write operations
  - target: $.paths.*["post","put","delete","patch"]
    update:
      x-speakeasy-mcp:
        scopes: [write]
        disabled: false

  # Disable specific sensitive endpoints (customize as needed)
  # - target: $.paths["/admin/danger-zone"]["delete"]
  #   update:
  #     x-speakeasy-mcp:
  #       disabled: true
Step 2: Create the Workflow Configuration

Create .speakeasy/workflow.yaml:

yaml
# .speakeasy/workflow.yaml
workflowVersion: 1.0.0
speakeasyVersion: latest
sources:
  My-API:
    inputs:
      - location: ./openapi.yaml
    overlays:
      - location: mcp-scopes-overlay.yaml
    output: openapi.yaml
targets:
  mcp-server:
    target: mcp-typescript
    source: My-API

Replace ./openapi.yaml with the actual spec path or URL.

Important: Use the standalone mcp-typescript target, not typescript with enableMCPServer: true. The embedded approach (enableMCPServer flag) is deprecated.

Step 3: Configure gen.yaml

Create .speakeasy/gen.yaml:

yaml
# .speakeasy/gen.yaml
configVersion: 2.0.0
generation:
  sdkClassName: MyApiMcp
  maintainOpenAPIOrder: true
  devContainers:
    enabled: true
    schemaPath: ./openapi.yaml
typescript:
  version: 1.0.0
  packageName: my-api-mcp
  envVarPrefix: MYAPI

Key settings:

  • target: mcp-typescript in workflow.yaml -- this is what triggers MCP server generation
  • packageName -- the npm package name users will npx
  • envVarPrefix -- prefix for auto-generated env var names
Step 4: Generate
bash
speakeasy run

For AI-friendly output:

bash
speakeasy run --output console 2>&1 | tail -50

Using the Generated MCP Server

CLI Usage
bash
# Start with stdio transport (default, for local AI assistants)
npx my-api-mcp mcp start --bearer-auth "YOUR_TOKEN"

# Start with SSE transport (for networked deployment)
npx my-api-mcp mcp start --transport sse --port 3000 --bearer-auth "YOUR_TOKEN"

# Filter by scope (only expose read operations)
npx my-api-mcp mcp start --scope read --bearer-auth "YOUR_TOKEN"

# Mount specific tools only
npx my-api-mcp mcp start --tool users-get-users --tool users-create-user --bearer-auth "YOUR_TOKEN"
CLI Options
FlagDescriptionDefault
--transportTransport type: stdio or ssestdio
--portPort for SSE transport2718
--bearer-authAPI authentication tokenRequired
--server-urlOverride API base URLFrom spec
--scopeFilter by scope (repeatable)All scopes
--toolMount specific tools (repeatable)All tools
--log-levelLogging levelinfo
Claude Desktop Configuration

Add to claude_desktop_config.json:

json
{
  "mcpServers": {
    "my-api": {
      "command": "npx",
      "args": [
        "-y", "--package", "my-api-mcp",
        "--",
        "mcp", "start",
        "--bearer-auth", "<API_TOKEN>"
      ]
    }
  }
}
Claude Code Configuration

Add to .claude/settings.json or use claude mcp add:

json
{
  "mcpServers": {
    "my-api": {
      "command": "npx",
      "args": [
        "-y", "--package", "my-api-mcp",
        "--",
        "mcp", "start",
        "--bearer-auth", "<API_TOKEN>"
      ]
    }
  }
}
Docker Deployment

For production, use SSE transport with Docker:

bash
# Build and run
docker-compose up -d

# Configure MCP client to use SSE endpoint
# "url": "http://localhost:32000/sse"

The generated project includes a Dockerfile and docker-compose.yaml.

Example

Full example generating an MCP server for a pet store API:

bash
# 1. Validate the spec
speakeasy lint openapi --non-interactive -s ./petstore.yaml

# 2. Create scopes overlay
cat > mcp-scopes-overlay.yaml << 'EOF'
openapi: 3.1.0
overlay: 1.0.0
info:
  title: Add MCP scopes
  version: 0.0.0
actions:
  - target: $.paths.*["get","head"]
    update:
      x-speakeasy-mcp:
        scopes: [read]
        disabled: false
  - target: $.paths.*["post","put","delete","patch"]
    update:
      x-speakeasy-mcp:
        scopes: [write]
        disabled: false
EOF

# 3. Create workflow (assumes .speakeasy/ dir exists)
mkdir -p .speakeasy
cat > .speakeasy/workflow.yaml << 'EOF'
workflowVersion: 1.0.0
speakeasyVersion: latest
sources:
  petstore:
    inputs:
      - location: ./petstore.yaml
    overlays:
      - location: mcp-scopes-overlay.yaml
    output: openapi.yaml
targets:
  mcp-server:
    target: mcp-typescript
    source: petstore
EOF

# 4. Create gen.yaml
cat > .speakeasy/gen.yaml << 'EOF'
configVersion: 2.0.0
generation:
  sdkClassName: PetStoreMcp
  maintainOpenAPIOrder: true
typescript:
  version: 1.0.0
  packageName: petstore-mcp
  envVarPrefix: PETSTORE
EOF

# 5. Generate
speakeasy run

# 6. Test locally
npx petstore-mcp mcp start --bearer-auth "test-token"
Expected Output
Workflow completed successfully.
Generated TypeScript MCP server in ./

The generated project contains:

  • src/mcp-server/server.ts -- Main MCP server factory
  • src/mcp-server/tools/ -- One tool per API operation
  • src/mcp-server/mcp-server.ts -- CLI entry point
  • src/mcp-server/scopes.ts -- Scope definitions
Show full SKILL.md (317 more words)Show less

Best Practices

  1. Use overlays for MCP config -- never edit the source OpenAPI spec directly
  2. Enhance descriptions for AI -- add documentation overlays so AI assistants understand tool purpose
  3. Filter tools at runtime -- use --scope and --tool flags to limit what is exposed
  4. Use environment variables -- never hardcode tokens in config files
  5. Start with read-only scopes -- add write scopes only when needed
  6. Create a dedicated MCP package -- keep MCP separate from your main SDK

What NOT to Do

  • Do NOT modify the source OpenAPI spec to add x-speakeasy-mcp -- use overlays instead
  • Do NOT hardcode API tokens in Claude Desktop or Claude Code config files -- use environment variables or secrets managers
  • Do NOT expose all operations without reviewing them -- disable sensitive admin endpoints
  • Do NOT skip spec validation -- invalid specs produce broken MCP servers
  • Do NOT use the deprecated enableMCPServer: true flag in gen.yaml -- use the standalone mcp-typescript target in workflow.yaml instead
  • Do NOT generate without a scopes overlay -- tools will lack scope definitions
  • Do NOT use the generated MCP server as a general SDK -- it is purpose-built for AI assistant integration

Troubleshooting

MCP server fails to start

Symptom: npx my-api-mcp mcp start errors immediately.

Cause: Missing or invalid authentication flags.

Fix:

bash
# Ensure auth flag matches your API's auth scheme
npx my-api-mcp mcp start --bearer-auth "YOUR_TOKEN"

# Check --help for available auth flags
npx my-api-mcp mcp start --help
No tools appear in AI assistant

Symptom: MCP server starts but AI assistant shows no tools.

Cause: Missing x-speakeasy-mcp extensions or all operations disabled.

Fix: Verify the scopes overlay is listed in workflow.yaml under overlays: and that operations have disabled: false.

Generation fails with mcp-typescript target

Symptom: speakeasy run fails when using target: mcp-typescript.

Cause: Usually a spec validation issue, missing workflow config, or using the deprecated enableMCPServer flag instead of the mcp-typescript target.

Fix:

bash
# Validate spec first
speakeasy lint openapi --non-interactive -s ./openapi.yaml

# Ensure workflow.yaml uses target: mcp-typescript (NOT target: typescript with enableMCPServer)
cat .speakeasy/workflow.yaml

# Remove enableMCPServer from gen.yaml if present -- it is deprecated
Tools missing expected operations

Symptom: Some API operations are not available as MCP tools.

Cause: Operations not targeted by the scopes overlay or explicitly disabled.

Fix: Review mcp-scopes-overlay.yaml target selectors. Ensure paths and methods match your spec.

© trycompai, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/generate-mcp-server of trycompai/comp.

Open the folder on GitHubat commit 1bf4d52

Compare with similar skills

Generate MCP Server next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Generate MCP Server compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Generate MCP Server this skilltrycompai/comp2k—~2.7kAutomated safety check: PassApache-2.0
MCP Server Builderalirezarezvani/claude-skills28k—~985Automated safety check: PassMIT
MCP Server Builderborghei/Claude-Skills874—~1.9kAutomated safety check: PassMIT
OpenAPI to MCP Servermcp-use/mcp-use11k—~5.2kAutomated safety check: PassApache-2.0
PR Reviewconfluentinc/mcp-confluent167—~4.6kAutomated safety check: NotesMIT
Frontmcp Developmentagentfront/frontmcp146—~11kAutomated safety check: PassApache-2.0

Similar skills

  • MCP Server Builder

    alirezarezvani/claude-skills

    Design and ship production-ready MCP (Model Context Protocol) servers from OpenAPI contracts instead of hand-written tool wrappers.

    28k GitHub stars~985 tokensUpdated 1 mo ago
    Agent WorkflowsAuto-check passed
  • MCP Server Builder

    borghei/Claude-Skills

    Build MCP (Model Context Protocol) servers with tool definitions, resource providers, prompt templates, and transports.

    874 GitHub stars~1.9k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • OpenAPI to MCP Server

    mcp-use/mcp-use

    Turns an OpenAPI or Swagger spec into an MCP server with the mcp-use TypeScript SDK, mapping each operation to a tool, wiring auth, testing and deploying.

    11k GitHub stars~5.2k tokensUpdated today
    Backend & APIsAuto-check passed
  • PR Review

    confluentinc/mcp-confluent

    Reviews pull requests for the Confluent MCP server. An agent skill from confluentinc/mcp-confluent.

    167 GitHub stars~4.6k tokensUpdated today
    DevelopmentAuto-check: notes
  • Frontmcp Development

    agentfront/frontmcp

    A skill your agent uses when building any FrontMCP server component other than a tool (for tools, use create-tool).

    146 GitHub stars~11k tokensUpdated today
    Backend & APIsAuto-check passed
  • Project Release

    swimmwatch/cloakbrowser-mcp

    Prepare, publish, verify, or recover a cloakbrowser-mcp release only when the user explicitly requests release work.

    161 GitHub stars~1.9k tokensUpdated 5 days ago
    Agent WorkflowsAuto-check passed

More from trycompai/comp

All 31 skills in this repo
  • API Endpoint Contract

    trycompai/comp

    The contract every new or modified API endpoint must follow so it is correct for the public OpenAPI spec, the MCP server (npm @trycompai/mcp-server), the ValidationPipe, and the docs.

    2k GitHub stars~2.7k tokensUpdated 5 days ago
    Auto-check passed
  • Check Results Service

    trycompai/comp

    How to reuse ANY integration check's results in a feature via the universal CheckResultsService (apps/api integration-platform).

    2k GitHub stars~2.1k tokensUpdated 5 days ago
    Auto-check passed
  • Data

    trycompai/comp

    A skill your agent uses when implementing data fetching, API calls, server/client components, or SWR hooks

    2k GitHub stars~955 tokensUpdated 5 days ago
    Auto-check passed
  • A skill your agent uses when SDK generation failed or seeing errors.

    2k GitHub stars~938 tokensUpdated 5 days ago
    Auto-check passed
  • Forms

    trycompai/comp

    A skill your agent uses when building forms - covers React Hook Form, Zod validation, and form patterns

    2k GitHub stars~1k tokensUpdated 5 days ago
    Auto-check passed
  • Code

    trycompai/comp

    A skill your agent uses when writing TypeScript/React code - covers type safety, component patterns, and file organization

    2k GitHub stars~909 tokensUpdated 5 days ago
    Auto-check: warnings

Categories

Questions about Generate MCP Server

What does Generate MCP Server do?

A skill your agent uses when generating an MCP server from an OpenAPI spec with Speakeasy. Generate MCP Server is an agent skill from trycompai/comp. Use when generating an MCP server from an OpenAPI spec with Speakeasy.

When should I use Generate MCP Server?

Generate MCP Server fits situations like: generating an MCP server from an OpenAPI spec with Speakeasy; generate MCP server; model Context Protocol; AI assistant tools.

How do I install Generate MCP Server in Claude Code?

Run `npx skills add trycompai/comp --skill generate-mcp-server -a claude-code`. Or copy the skill folder (.agents/skills/generate-mcp-server in trycompai/comp) into .claude/skills/generate-mcp-server in your project. Claude Code loads it when a task matches its description.

How do I install Generate MCP Server in Codex?

Run `npx skills add trycompai/comp --skill generate-mcp-server -a codex`. Or copy the skill folder (.agents/skills/generate-mcp-server in trycompai/comp) into .agents/skills/generate-mcp-server in your project. Codex loads it when a task matches its description.

Can I use Generate MCP Server in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add trycompai/comp --skill generate-mcp-server -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/generate-mcp-server, .gemini/skills/generate-mcp-server, .github/skills/generate-mcp-server and .opencode/skills/generate-mcp-server in your project.

What does Generate MCP Server need to run?

Going by SKILL.md and its folder, Generate MCP Server needs the command-line tools its instructions call (npx, docker-compose and claude) and credentials named SPEAKEASY_API_KEY and API_TOKEN. Our summary lists: Node.js; Docker; A credential in SPEAKEASY_API_KEY; A credential in YOUR_TOKEN.

Does Generate MCP Server access the network?

SKILL.md contains no URLs. Its commands use npx, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Generate MCP Server safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Generate MCP Server use?

Generate MCP Server is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Generate MCP Server use?

About 2.7k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Generate MCP Server?

Skills that share tags, products or a category with Generate MCP Server: MCP Server Builder (alirezarezvani/claude-skills, 28k stars), MCP Server Builder (borghei/Claude-Skills, 874 stars), OpenAPI to MCP Server (mcp-use/mcp-use, 11k stars) and PR Review (confluentinc/mcp-confluent, 167 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Generate MCP Server?

trycompai (a GitHub organization) maintains it in trycompai/comp, which has 2,016 GitHub stars. The repository holds 31 skills in this directory. The repository was last updated on October 2, 2026.

Source: trycompai/comp on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.