Skip to content

MCP Server Management

rolecraft can install and manage Model Context Protocol (MCP) servers alongside skills. This means you can provision both behavior (skills) and capabilities (MCP tools) for your AI agents in a single workflow.

Why MCP + Skills Together?

  • Skill → changes how an agent behaves (coding rules, style guides, conventions)
  • MCP → expands what an agent can do (query databases, call APIs, access GitHub, search the web)

When a SKILL.md declares mcp_servers: in its frontmatter, rolecraft install installs both the skill and its required MCP servers in one command — no manual config editing.

Quick Start

bash
# Install from npm (Node.js)
rolecraft mcp install npm:@modelcontextprotocol/github --cursor --claude

# Install from GitHub (Node.js)
rolecraft mcp install gh:github/github-mcp-server --all

# Install from Python (uvx)
rolecraft mcp install uvx:@anthropic/postgres-mcp --cursor

# Install from Python (pipx)
rolecraft mcp install pipx:postgres-mcp --cursor

# Install from Go
rolecraft mcp install go:github.com/org/mcp-server --all

# Install from Deno
rolecraft mcp install deno:jsr:@org/mcp-server --all

# Install from Rust (cargo)
rolecraft mcp install cargo:my-mcp-server --cursor

# Pin to a specific version
rolecraft mcp install npm:@modelcontextprotocol/github@1.2.3 --cursor

# Pin to a branch or tag (GitHub source)
rolecraft mcp install gh:github/github-mcp-server@main --all
rolecraft mcp install gh:github/github-mcp-server@v1.0.0 --cursor

# Install from a local path
rolecraft mcp install ./my-mcp-server --cursor

# List configured MCP servers
rolecraft mcp list

# Search for MCP servers (GitHub)
rolecraft mcp search github

# Search npm registry for MCP packages
rolecraft mcp search postgres --npm

# Interactive search + install
rolecraft mcp search filesystem --interactive

# Check for MCP server updates
rolecraft mcp check

# Update a MCP server to latest version
rolecraft mcp update npm:@modelcontextprotocol/github --cursor

# Remove an MCP server
rolecraft mcp remove github-mcp-server --cursor

# Validate MCP configurations
rolecraft doctor

Onboarding Example

Suppose your team has three developers using different agents — Cursor, Claude Code, and Windsurf. You want everyone to use the same PostgreSQL conventions and have database access via MCP:

1. Create a skill with mcp_servers

yaml
---
name: my-postgres-rules
description: Team PostgreSQL style guide
mcp_servers:
  - name: github
    source: gh:github/github-mcp-server
  - name: postgres
    source: npm:@anthropic/postgres-mcp
---

- Always prefer `JOIN` over subqueries
- `SELECT *` is forbidden
- All queries must be parameterized

2. Install with a single command

bash
rolecraft install ./my-postgres-rules --cursor --claude --windsurf

This does three things automatically:

  1. Skill installation → copies my-postgres-rules to ~/.cursor/skills/, ~/.claude/skills/, ~/.windsurf/skills/
  2. MCP installation → reads mcp_servers from SKILL.md, resolves the sources
  3. Config wiring → writes MCP config in each agent's native format:
    • Cursor: ~/.cursor/mcp.json
    • Claude Code: ~/.claude.json
    • Windsurf: ~/.windsurf/mcp_config.json

3. Each agent can now

  • Follow rules — never writes SELECT *, always uses JOIN
  • Query the database — via the Postgres MCP server
  • Access GitHub — via the GitHub MCP server

4. Team onboarding with bundle

bash
# Team lead creates a bundle once
rolecraft bundle create team-onboarding

# Every developer runs
rolecraft bundle install team-onboarding.json
# → All skills installed
# → All MCP servers configured automatically
# → Each agent's config written in the correct format

Supported MCP Agents

AgentConfig FileFormat
opencode~/.agents/mcp.jsonStandard mcpServers object
claude-code~/.claude.jsonStandard mcpServers object
cursor~/.cursor/mcp.jsonStandard mcpServers object
windsurf~/.windsurf/mcp_config.jsonStandard mcpServers object
devin~/.devin/mcp.jsonStandard mcpServers object
copilot./.github/copilot/.mcp.json{ inputs: [], servers: {} }
continue~/.continue/config.json{ experimental: { mcpServers: [] } }

More agents will be added as their MCP standards solidify.

Source Types

SourceExampleDescription
npm:npm:@modelcontextprotocol/githubInstall from npm, runs via npx -y
gh:gh:github/github-mcp-serverClone from GitHub, runs via node
uvx:uvx:@anthropic/postgres-mcpPython package via uvx
pipx:pipx:postgres-mcpPython package via pipx run
go:go:github.com/org/mcp-serverGo package via go run
deno:deno:jsr:@org/mcp-serverDeno module via deno run
cargo:cargo:my-mcp-serverRust crate via cargo run
Local path./my-mcp-server/index.jsRun directly with node

Security Scanning

When installing from gh: sources, rolecraft automatically scans the cloned repository for security issues before installation:

SeverityExampleScore Impact
🔴 CriticalCommand injection (curl | bash)-20
🔴 HighCredential access (process.env.TOKEN), data exfiltration-10
🟡 MediumNetwork requests, file access, shell execution, env access-3
⚪ LowUntrusted publisher, npm registry source-1

The scan produces a score (0-100):

ScoreLabelBehavior
90-100✅ SafeInstalls normally
70-89⚠️ ReviewShows warning, continues
0-69❌ DangerBlocks install unless --yes is passed
bash
# Security scan runs automatically during install
rolecraft mcp install gh:untrusted-user/mcp-server
# → Shows scan report before confirmation prompt

# Skip security block with --yes
rolecraft mcp install gh:untrusted-user/mcp-server --yes

Trusted Publishers

Repositories from these publishers are not flagged with low-severity untrusted publisher warnings: github, modelcontextprotocol, anthropic, vercel, openai

Lockfile & CI Restore

Every MCP server you install is tracked in ~/.agents/.mcp-lock.json. This lockfile records:

  • The original source string (e.g. npm:@modelcontextprotocol/github)
  • Which agents the server is installed to

When you run rolecraft ci, MCP servers from the lockfile are automatically re-installed to their configured agents — just like skills.

bash
# After git clone — restores skills + MCP servers
rolecraft ci

The lockfile updates automatically:

  • Install → server is added to the lockfile
  • Remove → server is removed from the lockfile (or agents are unlinked if installed elsewhere)
  • Update → lockfile is refreshed with the new source

Commands

See docs/commands/mcp.md for the full command reference.

SKILL.md Integration

When a skill declares mcp_servers: in its YAML frontmatter, rolecraft install automatically installs those MCP servers to the same agent targets. You don't need to run a separate rolecraft mcp install command.

yaml
---
name: my-skill
mcp_servers:
  - name: server-name
    source: npm:@org/mcp-server
---

If you only want the skill without MCP servers, pass --no-mcp during installation.