Skip to content

MCP Client Setup

Configure API Bear in Claude Desktop, Cursor, Claude Code, OpenCode, Kiro, VS Code, and Windsurf.

API Bear exposes OpenAPI tools over the standard Model Context Protocol (stdio transport). Every client launches it the same way, with npx -y apibear, so there is nothing to install or build first. Different clients read their configuration from different files and formats.


Configuration Overview

Client Configuration File Location Format
Claude Desktop claude_desktop_config.json mcpServers JSON block
Cursor ~/.cursor/mcp.json (global) or .cursor/mcp.json (project) mcpServers JSON block
Claude Code claude mcp add CLI command or .mcp.json CLI command / JSON
OpenCode opencode.json mcp JSON block
Kiro ~/.kiro/settings/mcp.json (global) or .kiro/settings/mcp.json (workspace) mcpServers JSON block
VS Code .vscode/mcp.json (project) or User MCP config servers JSON block
Windsurf ~/.codeium/windsurf/mcp_config.json mcpServers JSON block

1. Claude Desktop

Configuration File Paths

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

Configuration Example

{
  "mcpServers": {
    "my-api": {
      "command": "npx",
      "args": [
        "-y",
        "apibear",
        "--spec", "https://api.example.com/openapi.json",
        "--header", "Authorization: Bearer YOUR_TOKEN"
      ]
    }
  }
}

2. Cursor

Cursor supports MCP servers both globally and per-project in your repository.

Configuration File Paths

  • Global: ~/.cursor/mcp.json
  • Project: .cursor/mcp.json (in workspace root)

Configuration Example

{
  "mcpServers": {
    "my-api": {
      "command": "npx",
      "args": [
        "-y",
        "apibear",
        "--spec", "./openapi.json",
        "--header", "Authorization: Bearer YOUR_TOKEN"
      ]
    }
  }
}

3. Claude Code

Claude Code provides both an interactive CLI command and project-level .mcp.json support.

Adding via CLI Command

claude mcp add my-api -- npx -y apibear \
  --spec https://api.example.com/openapi.json \
  --header "Authorization: Bearer YOUR_TOKEN"

Project .mcp.json

{
  "mcpServers": {
    "my-api": {
      "command": "npx",
      "args": [
        "-y",
        "apibear",
        "--spec", "https://api.example.com/openapi.json",
        "--header", "Authorization: Bearer YOUR_TOKEN"
      ]
    }
  }
}

4. OpenCode

OpenCode uses opencode.json in the root of your project or user config.

{
  "mcp": {
    "my-api": {
      "type": "local",
      "command": [
        "npx",
        "-y",
        "apibear",
        "--spec", "./openapi.json",
        "--header", "Authorization: Bearer YOUR_TOKEN"
      ],
      "enabled": true
    }
  }
}

5. Kiro

Kiro supports MCP servers both globally (user level) and per-workspace (project level).

Configuration File Paths

  • Workspace: .kiro/settings/mcp.json (in workspace root)
  • Global:
    • macOS / Linux: ~/.kiro/settings/mcp.json
    • Windows: %USERPROFILE%\.kiro\settings\mcp.json

You can also open or create these configuration files directly in Kiro via the Command Palette (Cmd + Shift + P on macOS or Ctrl + Shift + P on Windows/Linux):

  • Kiro: Open workspace MCP config (JSON)
  • Kiro: Open user MCP config (JSON)

Configuration Example

{
  "mcpServers": {
    "my-api": {
      "command": "npx",
      "args": [
        "-y",
        "apibear",
        "--spec", "https://api.example.com/openapi.json",
        "--header", "Authorization: Bearer YOUR_TOKEN"
      ]
    }
  }
}

6. VS Code

Visual Studio Code supports MCP servers natively for GitHub Copilot agent mode as well as via extensions like Cline and Roo Code.

Configuration File Paths

  • Workspace: .vscode/mcp.json (in workspace root)
  • User Profile: Open the Command Palette (Cmd + Shift + P on macOS or Ctrl + Shift + P on Windows/Linux) and select Preferences: Open User MCP Configuration.

Note on Format: Native VS Code and GitHub Copilot use a top-level "servers" key. If you are using the Cline extension, configuration is located in cline_mcp_settings.json and uses the "mcpServers" key instead.

Configuration Example (.vscode/mcp.json)

{
  "servers": {
    "my-api": {
      "command": "npx",
      "args": [
        "-y",
        "apibear",
        "--spec", "https://api.example.com/openapi.json",
        "--header", "Authorization: Bearer YOUR_TOKEN"
      ]
    }
  }
}

7. Windsurf

Windsurf (by Codeium) integrates Model Context Protocol servers directly into Cascade workflows.

Configuration File Paths

  • macOS / Linux: ~/.codeium/windsurf/mcp_config.json
  • Windows: %USERPROFILE%\.codeium\windsurf\mcp_config.json

You can also open the file directly inside Windsurf via the Command Palette (Cmd + Shift + P on macOS or Ctrl + Shift + P on Windows/Linux) by searching for Windsurf: Configure MCP Servers, or navigate to Settings > Cascade > MCP Servers.

Configuration Example

{
  "mcpServers": {
    "my-api": {
      "command": "npx",
      "args": [
        "-y",
        "apibear",
        "--spec", "https://api.example.com/openapi.json",
        "--header", "Authorization: Bearer YOUR_TOKEN"
      ]
    }
  }
}

Platform-Specific Notes

Pinning a Version

npx -y apibear runs the latest published release. To pin one, use apibear@<version> in place of apibear (e.g. "apibear@0.1.0"). If you also use the library, pin the same version there and your client and code will produce identical tools. If you prefer a global install, run npm install -g apibear and set "command": "apibear" with the flags as args.

Windows Quoting & Paths

  • Always use forward slashes (C:/specs/openapi.json) or escaped backslashes (C:\\specs\\openapi.json) for local spec paths in JSON configuration files.
  • Place command-line flags and their values in separate elements in the args array to prevent shell escaping issues.
  • In terminal commands, enclose headers with spaces in standard quotes: --header "Authorization: Bearer <token>".

Verifying Connectivity

If tools do not appear in your client after restarting:

  1. Ensure node (≥ 18.17) and npx are on the PATH your client launches with. GUI apps may not inherit your shell PATH; if so, set "command" to the absolute path of npx (which npx).
  2. Run the command directly in a terminal with --list-tools to ensure there are no network, DNS, or spec syntax errors.
  3. Check your client’s MCP developer logs (e.g. Claude Desktop Developer Tools → Console).