### Example config.json for Manual Installation Source: https://github.com/lutzleonhardt/mcp-bridge/blob/master/README.md An example JSON configuration file for MCP-Bridge, specifying the inference server details and MCP server commands. ```json { "inference_server": { "base_url": "http://example.com/v1", "api_key": "None" }, "mcp_servers": { "fetch": { "command": "uvx", "args": ["mcp-server-fetch"] } } } ``` -------------------------------- ### Full MCP-Bridge Configuration Example Source: https://github.com/lutzleonhardt/mcp-bridge/blob/master/README.md An example of a comprehensive config.json file for MCP-Bridge, illustrating various configuration options including inference server settings, sampling parameters, MCP server configurations, network settings, logging levels, and the API key. ```json { "inference_server": { "base_url": "http://localhost:8000/v1", "api_key": "None" }, "sampling": { "timeout": 10, "models": [ { "model": "gpt-4o", "intelligence": 0.8, "cost": 0.9, "speed": 0.3 }, { "model": "gpt-4o-mini", "intelligence": 0.4, "cost": 0.1, "speed": 0.7 } ] }, "mcp_servers": { "fetch": { "command": "uvx", "args": [ "mcp-server-fetch" ] } }, "network": { "host": "0.0.0.0", "port": 9090 }, "logging": { "log_level": "DEBUG" }, "api_key": "your-secure-api-key-here" } ``` -------------------------------- ### Example MCP Bridge Config JSON Source: https://github.com/lutzleonhardt/mcp-bridge/blob/master/docs/config.md This JSON object demonstrates the structure and typical values for the MCP Bridge configuration file. It includes settings for the inference server, sampling models, MCP server connections, network, and logging. ```json { "inference_server": { "base_url": "http://localhost:8000/v1", "api_key": "None" }, "sampling": { "timeout": 10, "models": [ { "model": "gpt-4o", "intelligence": 0.8, "cost": 0.9, "speed": 0.3 }, { "model": "gpt-4o-mini", "intelligence": 0.4, "cost": 0.1, "speed": 0.7 } ] }, "mcp_servers": { "fetch": { "command": "uvx", "args": [ "mcp-server-fetch" ] }, "sse-example-server": { "url": "http://localhost:8000/mcp-server/sse" }, "docker-example-server": { "image": "example-server:latest" } }, "network": { "host": "0.0.0.0", "port": 9090 }, "logging": { "log_level": "DEBUG" } } ``` -------------------------------- ### Manual Installation Dependencies and Run Command Source: https://github.com/lutzleonhardt/mcp-bridge/blob/master/README.md Provides the commands for setting up dependencies using 'uv' and running the MCP-Bridge application manually without Docker. ```bash uv sync ``` ```bash uv run mcp_bridge/main.py ``` -------------------------------- ### Docker Config Loading: Volume Mount Example Source: https://github.com/lutzleonhardt/mcp-bridge/blob/master/docs/config.md This YAML snippet illustrates the Docker volume mount configuration required to make the `config.json` file accessible within the container, corresponding to the `MCP_BRIDGE__CONFIG__FILE` environment variable. ```yaml volumes: - ./config.json:/mcp_bridge/config.json ``` -------------------------------- ### MCP-Bridge as Sampling Middleware Source: https://github.com/lutzleonhardt/mcp-bridge/blob/master/docs/usecases.md Explains the use of MCP-Bridge as sampling middleware for clients that do not natively support sampling. It integrates with SSE connectors to add sampling support to limited STDIO clients. ```APIDOC MCP-Bridge Sampling Middleware: - Addresses lack of native sampling support in many clients. - Integrates with SSE connectors (e.g., lightconetech/mcp-gateway). - Adds sampling support to STDIO clients (e.g., claude desktop). - Facilitates sampling for clients without native support. ``` -------------------------------- ### Docker Config Loading: HTTP URL Source: https://github.com/lutzleonhardt/mcp-bridge/blob/master/docs/config.md This bash snippet demonstrates configuring the MCP Bridge to download its configuration file from a specified HTTP URL using the `MCP_BRIDGE__CONFIG__HTTP_URL` environment variable. ```bash environment: - MCP_BRIDGE__CONFIG__HTTP_URL=http://10.88.100.170:8888/config.json ``` -------------------------------- ### Get Application URL for LoadBalancer Service Source: https://github.com/lutzleonhardt/mcp-bridge/blob/master/charts/mcp-bridge/templates/NOTES.txt Retrieves the application URL for a LoadBalancer service. It includes a note about potential delays for LoadBalancer IP availability and provides a command to monitor the service status. It then exports the service IP and prints the URL. ```go-template {{- else if contains "LoadBalancer" .Values.service.type }} NOTE: It may take a few minutes for the LoadBalancer IP to be available. You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "mcp-bridge.fullname" . }} export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "mcp-bridge.fullname" . }} --template "{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}") echo http://$SERVICE_IP:{{ .Values.service.port }} {{- end }} ``` -------------------------------- ### MCP-Bridge Docker Deployment Source: https://github.com/lutzleonhardt/mcp-bridge/blob/master/docs/usecases.md Details the use of Docker with MCP-Bridge for creating isolated servers and connecting to them via SSE. This approach supports larger-scale, homelab-style deployments by enabling numerous isolated MCP server instances. ```APIDOC MCP-Bridge Docker Deployment: - Utilizes Docker in Docker for isolated server instances. - Connects multiple isolated servers over SSE. - Enables large-scale homelab deployments. - Facilitates spawning many isolated MCP servers. ``` -------------------------------- ### Get Application URL for NodePort Service Source: https://github.com/lutzleonhardt/mcp-bridge/blob/master/charts/mcp-bridge/templates/NOTES.txt Retrieves the application URL when the Kubernetes service type is NodePort. It exports the NodePort and Node IP, then prints the combined URL. ```go-template {{- if contains "NodePort" .Values.service.type }} export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "mcp-bridge.fullname" . }}) export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT {{- end }} ``` -------------------------------- ### Docker Config Loading: Direct JSON String Source: https://github.com/lutzleonhardt/mcp-bridge/blob/master/docs/config.md This bash snippet shows how to provide the entire configuration directly as a JSON string within an environment variable using `MCP_BRIDGE__CONFIG__JSON`. This is useful for simple or dynamically generated configurations. ```bash environment: - MCP_BRIDGE__CONFIG__JSON={"inference_server":{"base_url":"http://example.com/v1","api_key":"None"},"mcp_servers":{"fetch":{"command":"uvx","args":["mcp-server-fetch"]}}} ``` -------------------------------- ### MCP-Bridge REST API and SSE Server Usage Source: https://github.com/lutzleonhardt/mcp-bridge/blob/master/docs/usecases.md Demonstrates how to interact with the MCP-Bridge using its REST API and Server-Sent Events (SSE) server for custom program development. This allows offloading MCP server complexity and session management to the bridge, simplifying client implementations. ```APIDOC MCP-Bridge REST API: - Allows custom programs to call MCP tools. - Offloads MCP server complexity to the MCP-Bridge. - Useful for testing MCP server configurations. MCP-Bridge SSE Server: - Enables custom programs to call MCP tools via SSE. - Manages configuration and session management. - Simplifies client support by connecting to a single MCP server. - Eliminates the need to map tools to specific servers. ``` -------------------------------- ### Docker Config Loading: File Mount Source: https://github.com/lutzleonhardt/mcp-bridge/blob/master/docs/config.md This bash snippet shows how to configure the MCP Bridge to load its configuration from a JSON file mounted as a volume in a Docker container. The `MCP_BRIDGE__CONFIG__FILE` environment variable points to the mounted file. ```bash environment: - MCP_BRIDGE__CONFIG__FILE=config.json ``` -------------------------------- ### Testing SSE Bridge with mcp-cli Source: https://github.com/lutzleonhardt/mcp-bridge/blob/master/README.md Demonstrates how to use the 'mcp-cli' tool to connect to a running MCP-Bridge server over SSE for testing purposes. ```bash npx @wong2/mcp-cli --sse http://localhost:8000/mcp-server/sse ``` -------------------------------- ### Docker Configuration Options Source: https://github.com/lutzleonhardt/mcp-bridge/blob/master/README.md Demonstrates different methods for configuring MCP-Bridge within a Docker environment, including mounting a config file, using an HTTP URL, or providing the JSON directly as an environment variable. ```yaml environment: - MCP_BRIDGE__CONFIG__FILE=config.json # mount the config file for this to work - MCP_BRIDGE__CONFIG__HTTP_URL=http://10.88.100.170:8888/config.json - MCP_BRIDGE__CONFIG__JSON={"inference_server":{"base_url":"http://example.com/v1","api_key":"None"},"mcp_servers":{"fetch":{"command":"uvx","args":["mcp-server-fetch"]}}} ``` ```yaml volumes: - ./config.json:/mcp_bridge/config.json ``` -------------------------------- ### Access Application via Port-Forward for ClusterIP Service Source: https://github.com/lutzleonhardt/mcp-bridge/blob/master/charts/mcp-bridge/templates/NOTES.txt Provides instructions to access the application when the Kubernetes service type is ClusterIP. It forwards a local port (8080) to the application's container port and instructs the user to access it via localhost. ```go-template {{- else if contains "ClusterIP" .Values.service.type }} export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "mcp-bridge.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") echo "Visit http://127.0.0.1:8080 to use your application" kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT {{- end }} ``` -------------------------------- ### MCP-Bridge Workflow Sequence Diagram Source: https://github.com/lutzleonhardt/mcp-bridge/blob/master/README.md A sequence diagram illustrating the workflow of MCP-Bridge, showing the interaction between Open Web UI, MCP Proxy, MCP Server, and the Inference Engine for request processing and tool management. ```mermaid sequenceDiagram participant OpenWebUI as Open Web UI participant MCPProxy as MCP Proxy participant MCPserver as MCP Server participant InferenceEngine as Inference Engine OpenWebUI ->> MCPProxy: Request MCPProxy ->> MCPserver: list tools MCPserver ->> MCPProxy: list of tools MCPProxy ->> InferenceEngine: Forward Request InferenceEngine ->> MCPProxy: Response MCPProxy ->> MCPserver: call tool MCPserver ->> MCPProxy: tool response MCPProxy ->> InferenceEngine: llm uses tool response InferenceEngine ->> MCPProxy: Response MCPProxy ->> OpenWebUI: Return Response ``` -------------------------------- ### MCP-Bridge REST API and SSE Bridge Endpoints Source: https://github.com/lutzleonhardt/mcp-bridge/blob/master/README.md Details the primary interaction points for MCP-Bridge: the REST API for native MCP primitives and the SSE Bridge for external chat applications supporting MCP. ```APIDOC MCP-Bridge API Documentation: REST API Endpoints: - Description: Exposes numerous REST API endpoints for interacting with native MCP primitives, allowing outsourcing of MCP server complexity. - Access: View detailed examples in the OpenAPI documentation at http://yourserver:8000/docs. - Functionality: Provides access to all MCP tools available on the server. SSE Bridge: - Description: Offers an SSE (Server-Sent Events) bridge for external clients, enabling MCP-aware chat applications to use MCP-Bridge as an MCP server. - Endpoint: http://yourserver:8000/mcp-server/sse - Testing: Can be used with tools like wong2/mcp-cli to verify server configuration. - Integration: Can be used with tools like lightconetech/mcp-gateway for STDIO-only MCP clients (e.g., claude desktop). ``` -------------------------------- ### Authorization Header Format Source: https://github.com/lutzleonhardt/mcp-bridge/blob/master/README.md This snippet demonstrates the correct format for including the API key in the Authorization header when making requests to the MCP-Bridge server. ```bash Authorization: Bearer your-secure-api-key-here ``` -------------------------------- ### API Key Authentication Configuration Source: https://github.com/lutzleonhardt/mcp-bridge/blob/master/README.md This snippet shows how to configure API key authentication for MCP-Bridge by adding an 'api_key' field to the config.json file. This key is used in the Authorization header for requests. ```json { "api_key": "your-secure-api-key-here" } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.