Skip to main content

MCP Overview

MCP (Model Context Protocol) enables AI models to interact with external tools and services. Bifrost’s MCP integration provides:
  • Automatic tool discovery from external MCP servers
  • Built-in tool execution with proper error handling
  • Custom tool registration for in-process tools
  • Multiple connection types (HTTP, STDIO, SSE)

Basic MCP Configuration

STDIO Connection (Most Common)

Connect to MCP servers via standard input/output:

HTTP Connection

Connect to MCP servers via HTTP:

SSE Connection

Connect to MCP servers via Server-Sent Events:

Using MCP Tools

Automatic Tool Integration

MCP tools are automatically added to all requests:

Manual Tool Execution

Execute MCP tools directly for security and control. You can pass tool calls directly from assistant message responses:
Security Note: Manual execution gives you full control over tool calls. This allows you to validate arguments, implement access controls, and audit tool usage before execution.

Custom Tool Registration

Register In-Process Tools

Register custom tools that run within your application:

Advanced Custom Tools

More complex tools with error handling and validation:

Tool Discovery and Filtering

Tool Filtering by Client (Config Level)

Control which tools from each MCP client are available at the configuration level:
Filtering Rules:
  • ToolsToExecute: Whitelist - only these tools are available (overrides ToolsToSkip)
  • ToolsToSkip: Blacklist - all tools except these are available
  • If both are specified, ToolsToExecute takes precedence

Context-Based Tool Filtering (Request Level)

Filter tools at runtime for specific requests using context keys:
Context Filtering Rules:
  • mcp-include-clients: Whitelist - only tools from these named MCP clients are available
  • mcp-exclude-clients: Blacklist - tools from these named MCP clients are excluded
  • If both are specified, mcp-include-clients takes precedence Similarly you can pass values for mcp-include-tools and mcp-exclude-tools to filter tools at runtime.
  • These filters work at runtime and can be different for each request
  • Useful for user-based permissions, request-specific security, or A/B testing different tool sets

Dynamic Client Management

Adding Clients at Runtime

Add new MCP clients after initialization:

Removing Clients

Remove MCP clients when no longer needed:

Editing Client Tool Filters

Dynamically modify which tools are available from a client:

Listing All Clients

Get information about all connected MCP clients:

Reconnecting Disconnected Clients

Reconnect clients that have lost their connection:

Dynamic Client Management Example

Complete example showing dynamic client lifecycle:

🔄 Multi-Turn Tool Conversations

Handling Tool Call Loops

Implement proper tool calling conversations:

📊 MCP Monitoring and Debugging

Tool Execution Monitoring

Track tool usage and performance:

Debug Tool Execution

Enable detailed logging for MCP operations:

🧪 Testing MCP Integration

Unit Testing Custom Tools

Test your custom tools in isolation:

Integration Testing with MCP

Test MCP integration with real tools:

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