dataflow.mcp.discovery

MCP Server Discovery for haive-dataflow.

This module provides discovery capabilities for MCP (Model Context Protocol) servers from various sources and integrates them with the haive-dataflow registry system.

The discovery system can find MCP servers from: - npm packages (@modelcontextprotocol/) - PyPI packages (mcp-) - GitHub repositories - Local configurations - Existing haive-mcp downloaded servers

Classes:

MCPDiscovery: Main discovery engine for MCP servers

Functions:

discover_mcp_servers: Discover and register MCP servers in dataflow registry

Classes

MCPDiscovery

Discovery engine for MCP servers.

Functions

discover_mcp_servers([registry_system])

Discover MCP servers and create registry items.

Module Contents

class dataflow.mcp.discovery.MCPDiscovery(registry_system=None)

Discovery engine for MCP servers.

This class provides comprehensive discovery of MCP servers from various sources and creates appropriate registry entries for integration with haive-dataflow.

registry_system

Reference to the dataflow registry system

discovered_servers

Cache of discovered server configurations

Examples

Basic usage:

discovery = MCPDiscovery() servers = await discovery.discover_all()

# Register with dataflow registry await discovery.register_with_dataflow()

Initialize MCP discovery.

Parameters:

registry_system – Optional registry system instance

async discover_all()

Discover MCP servers from all available sources.

Returns:

List of discovered MCP server configurations

Return type:

list[haive.dataflow.registry.models.MCPServerConfig]

async discover_from_haive_mcp()

Discover servers from the haive-mcp package data.

This integrates with the existing haive-mcp package to load the 941 downloaded servers into the dataflow registry.

Returns:

List of MCP server configurations from haive-mcp

Return type:

list[haive.dataflow.registry.models.MCPServerConfig]

async discover_local_servers()

Discover locally configured MCP servers.

Returns:

List of locally configured MCP server configurations

Return type:

list[haive.dataflow.registry.models.MCPServerConfig]

async discover_npm_servers()

Discover MCP servers from npm packages.

Returns:

List of npm-based MCP server configurations

Return type:

list[haive.dataflow.registry.models.MCPServerConfig]

async discover_pip_servers()

Discover MCP servers from pip packages.

Returns:

List of pip-based MCP server configurations

Return type:

list[haive.dataflow.registry.models.MCPServerConfig]

async register_with_dataflow()

Register discovered MCP servers with the dataflow registry.

Returns:

List of registry IDs for registered servers

Return type:

list[str]

async dataflow.mcp.discovery.discover_mcp_servers(registry_system=None)

Discover MCP servers and create registry items.

This function provides a simple interface for discovering MCP servers and creating appropriate registry items for the dataflow system.

Parameters:

registry_system – Optional registry system for registration

Returns:

List of RegistryItem objects for discovered MCP servers

Return type:

list[haive.dataflow.registry.models.RegistryItem]

Examples

from haive.dataflow.mcp.discovery import discover_mcp_servers from haive.dataflow import registry_system

# Discover and register MCP servers registry_items = await discover_mcp_servers(registry_system) print(f”Discovered {len(registry_items)} MCP servers”)