KonfigurasiMCP

MCP di Bob Shell

Konfigurasi dan gunakan Model Context Protocol (MCP) server dengan Bob Shell.

What is MCP?

An MCP (Model Context Protocol) server acts as a bridge between Bob and external services like databases, APIs, or custom scripts. With MCP, you can extend Bob's capabilities beyond its built-in features.

MCP servers provide Bob with:

  • Tool discovery: Access to available tools with their descriptions and parameters
  • Tool invocation: The ability to call specific tools with arguments and receive structured responses
  • Resource access: The capability to read data from specific resources

Why use MCP?

  • Extend functionality: Add custom capabilities to Bob that aren't available out-of-the-box
  • Integrate with services: Connect Bob to your databases, APIs, and other systems
  • Automate workflows: Create specialized tools for your specific needs
  • Share capabilities: Distribute useful tools across your team

Configuring MCP servers

You can manage MCP server configurations at two levels:

  1. Global configuration: Settings in <USER_HOME>/.bob/mcp_settings.json apply to all workspaces
  2. Project-level configuration: Settings in .bob/mcp.json apply only to the current project

When a server name exists in both global and project configurations, the project-level configuration takes precedence.

Edit MCP settings files

Use Bob IDE, or another text editor, to modify your MCP settings files.

Refer to the following example:

{
  "mcpServers": {
    "server1": {
      "command": "python",
      "args": ["/path/to/server.py"],
      "env": {
        "API_KEY": "your_api_key"
      },
      "alwaysAllow": ["tool1", "tool2"],
      "disabled": false
    }
  }
}

Configuration properties

Each server configuration requires one of these properties:

  • command: Path to the executable for Stdio transport
  • url: SSE endpoint URL for remote servers
  • httpURL: HTTP endpoint URL for streamable http

Optional properties include:

  • args: Command-line arguments for Stdio transport
  • headers: Custom HTTP headers for SSE transport
  • env: Environment variables for the server process
  • cwd: Working directory for Stdio transport
  • timeout: Request timeout in milliseconds (default: 600,000ms; 10min)
  • alwaysAllow: Tool names to approve automatically
  • disabled: Set to true to disable the server

Transport types

MCP supports two ways to communicate with servers:

STDIO transport

STDIO transport runs servers locally on your machine:

  • Uses standard input/output streams for communication
  • Provides lower latency and better security
  • Runs as a child process on your machine

Example configuration:

{
 "mcpServers": {
   "local-server": {
     "command": "node",
     "args": ["server.js"],
     "cwd": "/path/to/project/Bob",
     "env": {
       "API_KEY": "your_api_key"
     },
     "alwaysAllow": ["tool1", "tool2"]
   }
 }
}

SSE transport

SSE transport connects to remote servers over HTTP/HTTPS:

  • Uses Server-Sent Events protocol
  • Works with servers hosted on different machines
  • Requires network access

Example configuration:

{
 "mcpServers": {
   "remote-server": {
     "url": "https://your-server-url.com/mcp",
     "headers": {
       "Authorization": "Bearer your-token"
     },
     "alwaysAllow": ["tool3"]
   }
 }
}

Platform-specific examples

Windows configuration

{
  "mcpServers": {
    "puppeteer": {
      "command": "cmd",
      "args": [
        "/c",
        "npx",
        "-y",
        "@modelcontextprotocol/server-puppeteer"
      ]
    }
  }
}

macOS and Linux configuration

{
  "mcpServers": {
    "puppeteer": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-puppeteer"
      ]
    }
  }
}

Runtime version manager configuration

When using version managers like asdf or mise:

{
  "mcpServers": {
    "mcp-batchit": {
      "command": "mise",
      "args": [
        "x",
        "--",
        "node",
        "/Users/myself/workspace/mcp-batchit/build/index.js"
      ],
      "alwaysAllow": [
        "search",
        "batch_execute"
      ]
    }
  }
}
Bagaimana topik ini?