MCP integration
Model Context Protocol — client mode. Connect to external MCP servers and let the chatbot use their tools via function calling.
What it does
- Connect to external MCP servers (streamable HTTP or SSE transport) from the Settings → MCP tab.
- Discover & cache each server’s tool list (click Discover).
- Discovered tools are normalized to an OpenAI function-calling schema and offered to the LLM.
- The chatbot runs a bounded tool-call loop (max 5 iterations), invoking
tools/callon the MCP server and feeding the results back into the conversation. - Tool invocations surface as a
🔧 Using tool: Xbadge in the chat stream.
Protocol details
The MCP client implements JSON-RPC 2.0 over streamable HTTP:
initializenotifications/initializedtools/listtools/call
Session-id capture and SSE-aware response extraction are handled automatically, so both streamable-HTTP and SSE transports work.
Adding a server
- Go to ItihRag → Settings → MCP.
- Click Add server and enter the server’s URL (and any auth required).
- Click Discover to fetch and cache the tool list.
- Enable the server. Its tools are now available to the chatbot.
Admin REST endpoints
| Method | Path | Purpose |
|---|---|---|
GET / POST | /mcp/servers | List / add MCP servers |
POST / DELETE | /mcp/servers/<id> | Update / delete a server |
POST | /mcp/servers/<id>/discover | Refresh a server’s tool list |
All MCP endpoints require the manage_options capability.