Skip to main content

MCP Overview (File Based)

You can directly use the UI (http://localhost:{port}/mcp-clients) to configure the MCP clients.
MCP (Model Context Protocol) configuration enables:
  • External tool integration (filesystem, web scraping, databases)
  • STDIO, HTTP, and SSE connections to MCP servers
  • Tool filtering and access control
  • HTTP endpoint for manual tool execution (/v1/mcp/tool/execute)

Connection Types

STDIO Connection

Most common for local MCP servers:

HTTP Connection

For remote MCP servers:
🔒 Security: Use env.PREFIX for secure connection strings: "connection_string": "env.MCP_CONNECTION_STRING"

SSE Connection

For server-sent events:

Filesystem Tools

Database Access

Git Integration


Tool Filtering

Whitelist Approach

Only allow specific tools:

Blacklist Approach

Allow all tools except dangerous ones:

Using MCP Tools via HTTP

Automatic Tool Integration

Tools are automatically available in chat completions:

Manual Tool Execution

Execute tools directly via HTTP endpoint:

Multi-Turn Conversations with MCP Tools

When MCP is configured, Bifrost automatically adds available tools to requests. Here’s an example of a multi-turn conversation where the AI uses tools: Initial Request (AI decides to use a tool):
Response includes tool calls:
Execute Tool (Use Bifrost’s MCP tool execution endpoint): 💡 Note: The request body of this endpoint is a tool call block you received from /v1/chat/completions route - you can directly copy and paste the tool call block as the request body.
Response with tool result:
Continue Conversation (Add tool result and get final response):
Final response:
Tool Execution Flow Summary:
  1. Send chat completion request → AI responds with tool_calls
  2. Send tool_calls to /v1/mcp/tool/execute → Get tool_result message
  3. Append tool_result to conversation → Send back for final response

Request-Level Tool Filtering

Control which MCP tools are available per request using context:

MCP Management API Endpoints

Bifrost HTTP transport provides REST API endpoints for dynamic MCP client management.

GET /api/mcp/clients - List All MCP Clients

Get information about all configured MCP clients:

POST /api/mcp/client - Add New MCP Client

Add a new MCP client at runtime:

PUT /api/mcp/client/ - Edit Client Tools

Modify which tools are available from a client:

DELETE /api/mcp/client/ - Remove MCP Client

Remove an MCP client and disconnect it:

POST /api/mcp/client//reconnect - Reconnect Client

Reconnect a disconnected or errored MCP client:

POST /v1/mcp/tool/execute - Execute MCP Tool

Execute an MCP tool directly (see detailed examples above):

Error Responses

All endpoints return consistent error responses:

Management Workflow Example

Complete client lifecycle management via API:

Environment Variables

Required Variables for MCP Servers

Docker with MCP

⚠️ Important: Docker currently does NOT support STDIO connection for MCP. Use Go binary if STDIO connection is required.

Go Binary with MCP (Supports all connection types)


Testing MCP Integration

Verify MCP Tools Are Available

Test Manual Tool Execution

Check Server Logs


Multi-Tool Workflow Example

Complete Configuration

Complex Request

Architecture: For MCP system design and performance details, see Architecture Documentation.