Skip to main content

Overview

Bifrost can connect to any MCP-compatible server to discover and execute tools. Each connection is called an MCP Client in Bifrost terminology.

Connection Types

Bifrost supports three connection protocols:
TypeDescriptionBest For
STDIOSpawns a subprocess and communicates via stdin/stdoutLocal tools, CLI utilities, scripts
HTTPSends requests to an HTTP endpointRemote APIs, microservices, cloud functions
SSEServer-Sent Events for persistent connectionsReal-time data, streaming tools

STDIO Connections

STDIO connections launch external processes and communicate via standard input/output. Best for local tools and scripts.
{
  "name": "filesystem",
  "connection_type": "stdio",
  "stdio_config": {
    "command": "npx",
    "args": ["-y", "@anthropic/mcp-filesystem"],
    "envs": ["HOME", "PATH"]
  },
  "tools_to_execute": ["*"]
}
Use Cases:
  • Local filesystem operations
  • Python/Node.js MCP servers
  • CLI utilities and scripts
  • Database tools with local credentials
Docker Users: When running Bifrost in Docker, STDIO connections may not work if the required commands (e.g., npx, python) are not installed in the container. For STDIO-based MCP servers, build a custom Docker image that includes the necessary dependencies, or use HTTP/SSE connections to externally hosted MCP servers.

HTTP Connections

HTTP connections communicate with MCP servers via HTTP requests. Ideal for remote services and microservices.
{
  "name": "web-search",
  "connection_type": "http",
  "connection_string": "https://mcp-server.example.com/mcp",
  "headers": {
    "Authorization": "Bearer your-api-key",
    "X-Custom-Header": "value"
  },
  "tools_to_execute": ["*"]
}
Use Cases:
  • Remote API integrations
  • Cloud-hosted MCP services
  • Microservice architectures
  • Third-party tool providers

SSE Connections

Server-Sent Events (SSE) connections provide real-time, persistent connections to MCP servers.
{
  "name": "live-data",
  "connection_type": "sse",
  "connection_string": "https://stream.example.com/mcp/sse",
  "headers": {
    "Authorization": "Bearer your-api-key"
  },
  "tools_to_execute": ["*"]
}
Use Cases:
  • Real-time market data
  • Live system monitoring
  • Event-driven workflows

Gateway Setup

Adding an MCP Client

  1. Navigate to MCP Clients in the sidebar - you’ll see a table of all registered servers
MCP Servers Table
  1. Click New MCP Server button to open the creation form
  2. Fill in the connection details:
Add MCP Client Form
Fields:
  • Name: Unique identifier (no spaces or hyphens, ASCII only)
  • Connection Type: STDIO, HTTP, or SSE
  • For STDIO: Command, arguments, and environment variables
  • For HTTP/SSE: Connection URL
  1. Click Create to connect

Viewing and Managing Connected Tools

Once connected, click on any client row to open the configuration sheet:
MCP Client Configuration and Tools
Here you can:
  • View all discovered tools with their descriptions and parameters
  • Enable/disable individual tools via toggle switches
  • Configure auto-execution for specific tools
  • Edit custom headers for HTTP/SSE connections
  • View the full connection configuration as JSON

Go SDK Setup

Configure MCP in your Bifrost initialization:
package main

import (
    "context"
    bifrost "github.com/maximhq/bifrost/core"
    "github.com/maximhq/bifrost/core/schemas"
)

func main() {
    mcpConfig := &schemas.MCPConfig{
        ClientConfigs: []schemas.MCPClientConfig{
            {
                Name:           "filesystem",
                ConnectionType: schemas.MCPConnectionTypeSTDIO,
                StdioConfig: &schemas.MCPStdioConfig{
                    Command: "npx",
                    Args:    []string{"-y", "@anthropic/mcp-filesystem"},
                    Envs:    []string{"HOME", "PATH"},
                },
                ToolsToExecute: []string{"*"},
            },
            {
                Name:             "web_search",
                ConnectionType:   schemas.MCPConnectionTypeHTTP,
                ConnectionString: bifrost.Ptr("http://localhost:3001/mcp"),
                ToolsToExecute:   []string{"search", "fetch_url"},
            },
        },
    }

    client, err := bifrost.Init(context.Background(), schemas.BifrostConfig{
        Account:   account,
        MCPConfig: mcpConfig,
        Logger:    bifrost.NewDefaultLogger(schemas.LogLevelInfo),
    })
    if err != nil {
        panic(err)
    }
}

Tools To Execute Semantics

The ToolsToExecute field controls which tools from the client are available:
ValueBehavior
["*"]All tools from this client are included
[] or nilNo tools included (deny-by-default)
["tool1", "tool2"]Only specified tools are included

Tools To Auto Execute (Agent Mode)

The ToolsToAutoExecute field controls which tools can be automatically executed in Agent Mode:
ValueBehavior
["*"]All tools are auto-executed
[] or nilNo tools are auto-executed (manual approval required)
["tool1", "tool2"]Only specified tools are auto-executed
A tool must be in both ToolsToExecute and ToolsToAutoExecute to be auto-executed. If a tool is in ToolsToAutoExecute but not in ToolsToExecute, it will be skipped.
Example configuration:
{
    Name:           "filesystem",
    ConnectionType: schemas.MCPConnectionTypeSTDIO,
    StdioConfig: &schemas.MCPStdioConfig{
        Command: "npx",
        Args:    []string{"-y", "@anthropic/mcp-filesystem"},
    },
    ToolsToExecute:     []string{"*"},                              // All tools available
    ToolsToAutoExecute: []string{"read_file", "list_directory"},    // Only these auto-execute
}

Environment Variables

Use environment variables for sensitive configuration values: Gateway (config.json):
{
  "name": "secure_api",
  "connection_type": "http",
  "connection_string": "env.SECURE_MCP_URL"
}
Go SDK:
{
    Name:             "secure_api",
    ConnectionType:   schemas.MCPConnectionTypeHTTP,
    ConnectionString: bifrost.Ptr(os.Getenv("SECURE_MCP_URL")),
}
Environment variables are:
  • Automatically resolved during client connection
  • Redacted in API responses and UI for security
  • Validated at startup to ensure all required variables are set

Client State Management

Connection States

StateDescription
connectedClient is active and tools are available
connectingClient is establishing connection
disconnectedClient lost connection but can be reconnected
errorClient configuration or connection failed

Managing Clients at Runtime

Reconnect a client:
curl -X POST http://localhost:8080/api/mcp/client/{id}/reconnect
Edit client configuration:
curl -X PUT http://localhost:8080/api/mcp/client/{id} \
  -H "Content-Type: application/json" \
  -d '{
    "name": "filesystem",
    "connection_type": "stdio",
    "stdio_config": {
      "command": "npx",
      "args": ["-y", "@anthropic/mcp-filesystem"]
    },
    "tools_to_execute": ["read_file", "list_directory"]
  }'
Remove a client:
curl -X DELETE http://localhost:8080/api/mcp/client/{id}

Health Monitoring

Bifrost automatically monitors MCP client health:
  • Periodic Pings: Every 10 seconds by default
  • Auto-Detection: Disconnections are detected automatically
  • State Updates: Client state changes are reflected in API responses
When a client disconnects:
  1. State changes to disconnected
  2. Tools from that client become unavailable
  3. You can reconnect via API or UI

Naming Conventions

MCP client names have specific requirements:
  • Must contain only ASCII characters
  • Cannot contain hyphens (-) or spaces
  • Cannot start with a number
  • Must be unique across all clients
Valid names: filesystem, web_search, myAPI, tool123 Invalid names: my-tools, web search, 123tools, datos-api

Next Steps