Skip to content

MCP Integration EN

zhenhun edited this page Sep 4, 2026 · 1 revision

中文 | English

BIT can connect to external MCP (Model Context Protocol) servers to extend its tool set.

Configuration

MCP server configuration is stored in mcp_servers.json in the data directory:

[
  {
    "id": "my-server",
    "name": "my-server",
    "url": "http://127.0.0.1:9801/mcp"
  }
]
  • Transport protocol: Streamable HTTP
  • On startup, BIT automatically performs the initialize handshake with each server, negotiates the protocol version, and stores the returned Mcp-Session-Id (all subsequent requests must carry it)
  • Non-MCP servers are rejected (endpoints that fail the initialize check are not adopted)
  • Once connected, the tools reported by the server appear automatically on the Tools page, ready for the AI to call

Data Directory Locations

App data directory (identifier: com.bit.hub):

Platform Path
macOS ~/Library/Application Support/com.bit.hub/
Linux ~/.local/share/com.bit.hub/ (or the XDG data dir)
Windows %APPDATA%/com.bit.hub/

Tool Activation

MCP integration triggers a tools-updated event; the frontend and the tool registry hot-reload without restarting the app.

BIT Itself Is Also a Standard MCP Server

BIT's remote HTTP service also exposes a standard MCP endpoint (POST /mcp, Streamable HTTP / JSON-RPC 2.0). Any standard MCP client (Claude Desktop, Cherry Studio, MCP Inspector, etc.) can connect to every enabled BIT tool:

  • Authentication: same as the OpenAI-compatible endpoints — Authorization: Bearer <Client Key> or the ?key= query parameter
  • Protocol version negotiation: supports 2024-11-05 / 2025-03-26 / 2025-06-18; if the client's requested version is in the supported list it is echoed back, otherwise the latest supported version is returned
  • Session management: the initialize response returns an Mcp-Session-Id header that all subsequent requests must carry (missing → 400 / expired → 404; sessions idle out after 30 minutes)
  • JSON-RPC batch: a POST with an array is processed entry by entry; DELETE /mcp explicitly terminates a session; GET /mcp returns 405 (no server-push stream)

Troubleshooting

  • Server unreachable: that server's tools won't appear in the tool list; check the URL and the network
  • Version negotiation failure: check the mcp.* records in the Audit Log
  • Session invalidated (server restarted): BIT re-runs initialize after the next call fails

Clone this wiki locally