DCAP Disco
by boorich
README.md
# DCAP Disco - Real-Time Tool Discovery MCP Server
This project implements a DCAP (Dynamic Capability Acquisition Protocol) MCP server that connects to the DCAP intelligence stream and provides real-time access to tool discovery data.
## Features
- **DCAP Stream Connection**: Connects to `ws://159.89.110.236:10191` for real-time tool intelligence
- **FIFO Cache**: Maintains up to 100 most recently discovered tools with deduplication
- **MCP Tools**: Exposes 7 tools for querying AND CALLING discovered tools
- **Autonomous Tool Acquisition**: Call ANY discovered tool at runtime without manual configuration
- **x402 Payment Support**: Automatic payment creation for paid tools using pipe402
- **Multi-Transport Support**: SSE, HTTP streaming for remote MCP servers
- **Auto-Reconnect**: Automatically reconnects if the DCAP stream connection drops
- **Real-time Updates**: Processes semantic_discover, perf_update, observed_sequence, and error_pattern messages
## Installation
1. Clone this repository:
```sh
git clone https://github.com/boorich/dcap_disco.git
cd dcap_disco
```
2. Install dependencies:
```sh
pip install -r requirements.txt
```
3. Configure environment (optional, for x402 payments):
```sh
# Create .env file
echo "X402_PRIVATE_KEY=0x..." > .env
# Or export directly
export X402_PRIVATE_KEY=0x...
```
4. Ensure pipe402 is installed (for x402 payment support):
```sh
which pipe402 # Should return path to pipe402 binary
```
## Usage
### Running the DCAP Disco MCP Server
```sh
python server.py
```
The server will:
- Connect to the DCAP intelligence stream
- Start caching tool discoveries and performance data
- Expose MCP tools for querying the cached data
### Configuring in Claude Desktop
Add to your `claude_desktop_config.json`:
```json
{
"mcpServers": {
"dcap-disco": {
"command": "python",
"args": ["/absolute/path/to/server.py"]
}
}
}
```
### Configuring in Cursor
Add to your MCP settings:
```json
{
"mcpServers": {
"dcap-disco": {
"command": "python",
"args": ["/absolute/path/to/server.py"]
}
}
}
```
## Available MCP Tools
### `list_discovered_tools`
Get all tools currently in the cache (up to 100 most recent).
**Returns:** List of tool discovery messages with capabilities, endpoints, and stats.
### `search_tools_by_capability`
Search for tools by keyword in their capabilities.
**Parameters:**
- `query` (string): Search keywords
**Returns:** Matching tools
### `get_tool_details`
Get detailed information about a specific tool.
**Parameters:**
- `tool_name` (string): Name of the tool
**Returns:** Tool metadata with performance history
### `get_recent_activity`
Get recent performance updates from all tools.
**Parameters:**
- `limit` (number, optional): Max results (default: 20, max: 100)
- `tool_name` (string, optional): Filter by specific tool
**Returns:** Recent performance updates
### `get_tool_sequences`
Get observed tool execution sequences (chains).
**Parameters:**
- `limit` (number, optional): Max sequences (default: 10)
**Returns:** Tool usage patterns
### `get_stream_status`
Get DCAP stream connection status.
**Returns:** Connection stats and cache size
### `call_discovered_tool` ⭐ NEW
**Call a discovered tool at runtime** - enables autonomous tool acquisition!
This is the killer feature: you can invoke ANY tool discovered via DCAP without manual configuration. The server:
1. Looks up the tool in cache (from semantic_discover messages)
2. Creates x402 payment if needed (using pipe402)
3. Establishes MCP connection (SSE/HTTP)
4. Calls the remote tool
5. Returns result
**Parameters:**
- `tool_identifier` (string): Format `"tool_name@server_id"` (e.g., `"validate_daml_business_logic@canton-mcp"`) or just `"tool_name"`
- `arguments` (object): Tool-specific arguments
**Returns:** Tool execution result
**Example:**
```json
{
"tool_identifier": "validate_daml_business_logic@canton-mcp",
"arguments": {
"daml_code": "template MyContract with ..."
}
}
```
**Demo Flow:**
```
1. Canton MCP broadcasts semantic_discover
→ DCAP Disco caches: validate_daml_business_logic@canton-mcp
2. Agent queries: list_discovered_tools
→ Sees: validate_daml_business_logic@canton-mcp
3. Agent calls: call_discovered_tool
→ DCAP Disco:
- Creates x402 payment (pipe402)
- Connects to Canton MCP (SSE)
- Calls validate_daml_business_logic
- Returns result
4. Agent gets result - no manual configuration needed!
```
## Environment Variables
### Required for x402 Payment
- `X402_PRIVATE_KEY`: Private key for creating x402 payments (hex string starting with `0x`)
### Optional Bearer Tokens
For tools requiring bearer token auth, set:
- `<SERVER_ID>_TOKEN`: Token for specific server (e.g., `ROBONET_MCP_TOKEN`)
## Architecture
```
┌─────────────────────────────────────────────────────────────────┐
│ DCAP Disco MCP Server │
│ │
│ ┌──────────────┐ ┌─────────────┐ ┌───────────────┐ │
│ │ DCAP Stream │─────▶│ Cache │─────▶│ MCP Tools │ │
│ │ Client │ │ (Discover) │ │ (Query/List) │ │
│ └──────────────┘ └─────────────┘ └───────────────┘ │
│ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Tool Connection Manager (NEW!) │ │
│ │ │ │
│ │ ┌──────────┐ ┌──────────┐ ┌──────────────────────┐ │ │
│ │ │ x402 │ │ MCP │ │ Dynamic Tool Call │ │ │
│ │ │ Payment │─▶│ Client │─▶│ (SSE/HTTP/stdio) │ │ │
│ │ │ (pipe402)│ │ (httpx) │ │ │ │ │
│ │ └──────────┘ └──────────┘ └──────────────────────┘ │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
│ ▲
│ discovers │ invokes
▼ │
┌──────────────────┐ ┌──────────────────┐
│ Canton MCP │ │ Canton MCP │
│ (broadcasts) │ │ (executes) │
└──────────────────┘ └──────────────────┘
```
## What Makes This Special?
**Traditional MCP Setup:**
```json
// You must manually configure EVERY tool server:
{
"mcpServers": {
"canton-mcp": { "command": "...", "args": [...] },
"robonet-mcp": { "command": "...", "args": [...] },
"workbench-mcp": { "command": "...", "args": [...] }
// ... manually add 100 more ...
}
}
```
**With DCAP Disco:**
```json
// You configure ONLY the dcap-disco server:
{
"mcpServers": {
"dcap-disco": { "command": "python", "args": ["server.py"] }
}
}
// Now you can call ANY tool discovered on the network!
// No manual configuration. Just discovery + acquisition.
```
This is **"Google for AI agents"** - autonomous capability acquisition at runtime.
## Use Cases
### 1. Zero-Config Tool Access
```
Agent: "What DAML validation tools are available?"
DCAP Disco: "validate_daml_business_logic@canton-mcp"
Agent: "Call it with this code..."
DCAP Disco:
- Creates x402 payment automatically
- Connects to Canton MCP
- Calls tool
- Returns result
NO MANUAL CONFIGURATION!
```
### 2. Multi-Server Orchestration
```
Agent task: "Build a DAML contract AND test a trading strategy"
Agent:
1. Calls validate_daml_business_logic@canton-mcp
→ DCAP Disco connects to Canton MCP (first time)
2. Calls get_strategy_code@robonet-mcp
→ DCAP Disco connects to Robonet MCP (first time)
All automatic. All paid via x402. All discovered via DCAP.
```
### 3. Real-Time Network Intelligence
```
Show VC:
- Stream of tools being discovered (semantic_discover)
- Agent querying available tools (list_discovered_tools)
- Agent calling tools dynamically (call_discovered_tool)
- x402 payments flowing
- Intelligence emerging from usage patterns
THIS IS THE FUTURE OF MCP.
```
## License
MIT License
## Contributing
Pull requests welcome! For major changes, please open an issue first.
## Contact
Questions? Reach out via [empeamtk@googlemail.com]
---
**Ready to show VCs the future of autonomous agents? 🚀**
This is what happens when you combine:
- **DCAP** (the open protocol for tool discovery)
- **x402** (streaming micropayments for tool usage)
- **MCP** (the standard for agent-tool communication)
Result: **Agents that can discover and use tools autonomously, with no manual configuration.**
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo issues