File size: 3,988 Bytes
241d71f
de69834
94d2cba
241d71f
 
 
 
 
 
de69834
53e239f
241d71f
 
de69834
53e239f
de69834
53e239f
 
 
de69834
53e239f
 
 
de69834
53e239f
 
 
de69834
53e239f
 
 
 
 
 
 
 
 
 
 
de69834
53e239f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
de69834
53e239f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
de69834
53e239f
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
---
title: Open Floor Protocol <> MCP Bridge
emoji: πŸŒ‰
colorFrom: yellow
colorTo: pink
sdk: gradio
sdk_version: 5.35.0
app_file: app.py
pinned: false
short_description: A Bridge between Open Floor Agents and MCP
license: apache-2.0
---

# Open Floor Protocol <> MCP Bridge

An MCP server that bridges [Model Control Protocol](https://modelcontextprotocol.io/) with [Open Floor](https://github.com/open-voice-interoperability/openfloor-docs) agents, enabling dynamic agent discovery and capability-based routing.

## Overview

This bridge automatically discovers Open Floor agents (from an ENV var or HTTP header), retrieves their manifests, and provides intelligent routing through a fixed set of MCP tools that dynamically select the best agent based on capabilities.

## Features

- **πŸ” Dynamic Agent Discovery**: Automatically finds and registers Open Floor agents
- **🧠 Smart Routing**: Built-in floor manager selects optimal agents based on discovered capabilities  
- **⚑ Capability-Based Matching**: Fixed MCP tools that route tasks using real agent manifest data
- **🌐 Flexible Deployment**: Environment variables + request headers support
- **πŸ“‘ Open Floor Compliant**: Proper envelope handling for manifest/utterance events

## Quick Start

### Installation

```bash
pip install -r requirements.txt
```

### Configuration

Set your Open Floor agents via environment variable:

```bash
export OPENFLOOR_AGENTS="https://agent1.com,https://agent2.com,https://agent3.com"
```

### Launch MCP Server

```bash
python app.py
```

The MCP server will be available at: `http://localhost:7860/gradio_api/mcp/sse`

### Claude Desktop Setup

Add to your `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "openfloor-bridge": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "http://localhost:7860/gradio_api/mcp/sse",
        "--transport",
        "sse-only"
      ]
    }
  }
}
```

## Available Agents

The bridge works with any Open Floor-compliant agent. Example agents:

- **Pete** (`https://beaconforge.pythonanywhere.com`) - General purpose assistant for daily tasks
- **Verity** (`https://secondassistant.pythonanywhere.com/verity`) - Fact-checking and hallucination detection  
- **Athena** (`...`) - Book and literature information specialist

## MCP Tools

The bridge exposes these MCP tools for agent interaction:

| Tool | Description |
|------|-------------|
| `discover_openfloor_agents` | Find and list all available agents with capabilities |
| `send_to_best_openfloor_agent` | Smart routing - sends task to most suitable agent |
| `execute_agent_capability` | Target agents with specific capability keywords |
| `list_all_agent_capabilities` | Show detailed capabilities of all agents |
| `send_message_to_openfloor_agent` | Direct communication with specific agent |
| `send_task_to_agents_with_keywords` | Broadcast to all agents matching keywords |

## Usage Examples

### Smart Routing
```
"I need help with Shakespeare's Hamlet analysis"
β†’ Automatically routes to Athena (literature specialist)
```

### Capability-Based Selection
```
Keywords: "fact,check,verify"  
Task: "Is this statement accurate?"
β†’ Routes to Verity (fact-checking agent)
```

### Direct Agent Communication
```
Agent: https://example.com
Message: "Tell me how much pounds is 1kg"
β†’ Direct communication with the agent
```

## Technical Details

### Architecture
- **Floor Manager**: Intelligent agent selection based on discovered capabilities
- **Manifest Caching**: Runtime discovery and matching of agent capabilities
- **Session Isolation**: Independent conversations per user

### Open Floor Compliance
- Proper envelope construction with conversation IDs
- Manifest discovery via `GetManifestsEvent`
- Utterance handling via `UtteranceEvent`

### Environment Variables
- `OPENFLOOR_AGENTS`: Comma-separated list of agent URLs
- 
---

**Demo**: Try it live at [Hugging Face Spaces](https://huggingface.co/spaces/azettl/ofp_mcp) πŸš€