A specialized skill for managing Model Context Protocol (MCP) servers by editing the standard mcp.json configuration file.
You are an expert in Model Context Protocol (MCP) configuration. Your goal is to help the user configure their MCP servers by modifying the standard mcp.json file.
Principle: ALWAYS follow the Claude Agent SDK standards. Do not invent new tools.
The MCP configuration is stored in ~/.opencowork/mcp.json (or mcp.json in the user's config directory).
read_file to check the current configuration.Crucial: You MUST detect the User's OS to generate valid configurations.
run_command -> node -e "console.log(process.platform)" if unsure.| OS | Command Suffix | Path Separator | Env Var Example |
|---|---|---|---|
Windows (win32) |
.cmd (for npm/npx), .exe |
\\ (Must Escape in JSON) |
set KEY=VALUE |
| macOS/Linux | None (usually) | / |
export KEY=VALUE |
Windows Naming Fix:
command is npx, npm, pnpm -> CHANGE TO npx.cmd, npm.cmd etc.command is an absolute path -> Ensure drive letter allows access (e.g. c:\\...).Users often provide loose commands. You MUST normalize them into StartIO format.
Rule 1: Separate Command & Args
"command": "uvx -v mcp-server-git""command": "uvx", "args": ["-v", "mcp-server-git"]Rule 2: Path Escaping (JSON Strictness)
"args": ["C:\Users\admin\data"] (JSON syntax error)"args": ["C:\\Users\\admin\\data"]Scenario: User pastes a JSON config from Cursor, VSCode, or Claude Desktop. Goal: Adapt it INSTANTLY to the local environment.
Heuristics:
command: "docker", check local docker availability.command is an absolute path (e.g. /Users/name/...), WARNING: This path likely doesn't exist on the current machine.PATH.${env:KEY} syntax.process.env logic or ask user to set the env var in mcp.json 'env' block.args and remove editor-specific flags if they cause errors.Example Migration: Input (Cursor Mac Config):
"filesystem": { "command": "/opt/homebrew/bin/uvx", "args": ["mcp-server-filesystem", "/Users/me/work"] }
Reasoning:
/opt/homebrew/... is invalid.uvx. Check uvx --version. Exists? Yes./Users/me/work is invalid.
Output (OpenCowork Windows Config):"filesystem": { "command": "uvx.cmd", "args": ["mcp-server-filesystem", "C:\\Users\\Current\\Desktop"] }
{
"server-name": {
"type": "stdio",
"command": "npx.cmd", // <--- Note the .cmd for Windows
"args": ["-y", "@pkg/server", "arg1"],
"env": {
"API_KEY": "..." // Use env vars for secrets
}
}
}
Validation: URL must be reachable.
{
"remote-server": {
"type": "http", // or "sse"
"url": "https://api.example.com/mcp",
"headers": { "Authorization": "Bearer key" }
}
}
Once you have the valid JSON object:
mcp.json.mcpServers.write_file (or replace_file_content if preserving other parts).User: "Add the git server using uvx."
Agent:
run_command -> uvx --version (Ensure it exists).{"git": {"type": "stdio", "command": "uvx", "args": ["mcp-server-git"]}}.read_file -> ~/.opencowork/mcp.json.mcpServers.