mcp.downloader.discoveryΒΆ
Server discovery module for finding MCP servers from various sources.
This module provides functionality to discover MCP servers from multiple registries and sources including npm, PyPI, GitHub, and custom registries.
Examples
Basic discovery:
discovery = ServerDiscovery(config) servers = await discovery.discover_all(limit_per_source=10)
Discover from specific source:
servers = await discovery.discover_from_npm(query="mcp server", limit=20)
- Classes:
ServerDiscovery: Main discovery class DiscoveredServer: Information about a discovered server
Version: 1.0.0 Author: Haive MCP Team
AttributesΒΆ
ClassesΒΆ
Information about a discovered MCP server. |
|
Discovers MCP servers from various sources. |
Module ContentsΒΆ
- class mcp.downloader.discovery.DiscoveredServer(/, **data: Any)ΒΆ
Bases:
pydantic.BaseModel
Information about a discovered MCP server.
- nameΒΆ
Server name
- sourceΒΆ
Where it was discovered (npm, github, etc.)
- source_urlΒΆ
URL where it was found
- descriptionΒΆ
Server description
- package_nameΒΆ
Package name (for npm/pypi)
- repo_urlΒΆ
Repository URL (for git)
- authorΒΆ
Author/owner name
- versionΒΆ
Latest version
- starsΒΆ
GitHub stars or similar metric
- tagsΒΆ
Extracted tags
- metadataΒΆ
Additional metadata
Examples
Discovered server info:
- class mcp.downloader.discovery.ServerDiscovery(config: haive.mcp.downloader.config.DiscoveryConfig)ΒΆ
Discovers MCP servers from various sources.
This class provides methods to discover MCP servers from multiple registries and sources, with support for various search patterns and filtering options.
- configΒΆ
Discovery configuration
- discovered_cacheΒΆ
Cache of discovered servers
- sessionΒΆ
Aiohttp session for HTTP requests
Examples
Using discovery:
- async __aenter__()ΒΆ
Async context manager entry.
- async __aexit__(exc_type, exc_val, exc_tb)ΒΆ
Async context manager exit.
- determine_template(server_data: dict[str, Any]) str ΒΆ
Determine the appropriate template for a discovered server.
- Parameters:
server_data β Discovered server information
- Returns:
Template name to use
Examples
Determining template:
- async discover_all(limit_per_source: int | None = None) list[dict[str, Any]] ΒΆ
Discover servers from all configured sources.
- Parameters:
limit_per_source β Maximum servers to discover per source. Uses config default if not specified.
- Returns:
List of discovered server dictionaries
Examples
Discovering from all sources:
- async discover_from_github(api_url: str, limit: int = 100) list[dict[str, Any]] ΒΆ
Discover servers from GitHub.
- Parameters:
api_url β GitHub API search URL
limit β Maximum results
- Returns:
List of discovered servers
Examples
GitHub discovery:
- async discover_from_npm_registry(registry_url: str, limit: int = 100) list[dict[str, Any]] ΒΆ
Discover servers from npm registry.
- Parameters:
registry_url β NPM registry search URL
limit β Maximum results to return
- Returns:
List of discovered servers
Examples
NPM discovery:
- async discover_from_pypi(search_url: str, limit: int = 100) list[dict[str, Any]] ΒΆ
Discover servers from PyPI.
- Parameters:
search_url β PyPI search URL
limit β Maximum results
- Returns:
List of discovered servers
- async discover_from_url(url: str, limit: int = 100) list[dict[str, Any]] ΒΆ
Discover servers from a generic URL (e.g., README).
- Parameters:
url β URL to parse for server information
limit β Maximum results
- Returns:
List of discovered servers
- async search_servers(query: str, sources: list[str] | None = None, limit: int = 50) list[dict[str, Any]] ΒΆ
Search for servers across sources with a specific query.
- Parameters:
query β Search query
sources β Specific sources to search (npm, pypi, github)
limit β Maximum results
- Returns:
List of matching servers
Examples
Searching for servers:
- configΒΆ
- discovered_cache: dict[str, DiscoveredServer]ΒΆ
- mcp.downloader.discovery.loggerΒΆ