haive.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

Classes

DiscoveredServer

Information about a discovered MCP server.

ServerDiscovery

Discovers MCP servers from various sources.

Module Contents

class haive.mcp.downloader.discovery.DiscoveredServer(/, **data)[source]

Bases: pydantic.BaseModel

Information about a discovered MCP server.

Parameters:

data (Any)

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:

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

class haive.mcp.downloader.discovery.ServerDiscovery(config)[source]

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:

Initialize server discovery.

Parameters:

config (haive.mcp.downloader.config.DiscoveryConfig) – Discovery configuration with sources and patterns

determine_template(server_data)[source]

Determine the appropriate template for a discovered server.

Parameters:

server_data (dict[str, Any]) – Discovered server information

Returns:

Template name to use

Return type:

str

Examples

Determining template:

async discover_all(limit_per_source=None)[source]

Discover servers from all configured sources.

Parameters:

limit_per_source (int | None) – Maximum servers to discover per source. Uses config default if not specified.

Returns:

List of discovered server dictionaries

Return type:

list[dict[str, Any]]

Examples

Discovering from all sources:

async discover_from_github(api_url, limit=100)[source]

Discover servers from GitHub.

Parameters:
  • api_url (str) – GitHub API search URL

  • limit (int) – Maximum results

Returns:

List of discovered servers

Return type:

list[dict[str, Any]]

Examples

GitHub discovery:

async discover_from_npm_registry(registry_url, limit=100)[source]

Discover servers from npm registry.

Parameters:
  • registry_url (str) – NPM registry search URL

  • limit (int) – Maximum results to return

Returns:

List of discovered servers

Return type:

list[dict[str, Any]]

Examples

NPM discovery:

async discover_from_pypi(search_url, limit=100)[source]

Discover servers from PyPI.

Parameters:
  • search_url (str) – PyPI search URL

  • limit (int) – Maximum results

Returns:

List of discovered servers

Return type:

list[dict[str, Any]]

async discover_from_url(url, limit=100)[source]

Discover servers from a generic URL (e.g., README).

Parameters:
  • url (str) – URL to parse for server information

  • limit (int) – Maximum results

Returns:

List of discovered servers

Return type:

list[dict[str, Any]]

async search_servers(query, sources=None, limit=50)[source]

Search for servers across sources with a specific query.

Parameters:
  • query (str) – Search query

  • sources (list[str] | None) – Specific sources to search (npm, pypi, github)

  • limit (int) – Maximum results

Returns:

List of matching servers

Return type:

list[dict[str, Any]]

Examples

Searching for servers: