mcp.pluginsΒΆ
MCP Plugins Module.
This module provides plugin implementations for the unified MCP platform architecture. All plugins inherit from PluginPlatform and implement the Pydantic-first design pattern with intelligent inheritance from our Phase 1 base platform models.
Plugin ArchitectureΒΆ
Base Inheritance ChainΒΆ
BasePlatform (haive-dataflow) - Foundation with core capabilities
PluginPlatform (haive-dataflow) - Plugin-specific enhancements
MCPBrowserPlugin (haive-mcp) - Browser automation plugin
Key FeaturesΒΆ
Pydantic-First Design: Full type safety and validation
Intelligent Inheritance: Automatic capability composition
Phase 2 Implementation: Advanced plugin functionality
Available PluginsΒΆ
Browser PluginΒΆ
MCPBrowserPlugin
- Browser automation and web interactionFeatures: Page navigation, element interaction, screenshot capture
Integration: Works with Playwright and Selenium
Plugin RegistryΒΆ
get_plugin_registry()
- Get available plugin registryget_plugin_class()
- Load plugin class by name
Note
This is a Phase 2 implementation focusing on advanced plugin capabilities with full Pydantic integration and intelligent inheritance patterns.
SubmodulesΒΆ
ClassesΒΆ
Plugin for managing our 63 downloaded MCP servers. |
Package ContentsΒΆ
- class mcp.plugins.MCPBrowserPluginΒΆ
Bases:
haive.dataflow.platform.models.PluginPlatform
Plugin for managing our 63 downloaded MCP servers.
This plugin inherits from PluginPlatform and specializes in managing the MCP servers we successfully downloaded during our bulk download session. It demonstrates the intelligent inheritance pattern by extending platform capabilities while maintaining the Pydantic-first design philosophy.
Inheritance Features: - Inherits: platform_id, status, metadata, lifecycle methods from BasePlatform (via PluginPlatform) - Inherits: entry_point, routes, priorities, dependencies from PluginPlatform - Extends: MCP-specific server management and discovery capabilities - Specializes: Downloaded server data integration and caching
Real Integration: - Works with our actual mcp_servers_data.csv file - Uses our install report JSON files - Loads our 63 successfully downloaded servers - Provides web interface for browsing servers
Examples
Basic plugin creation:
plugin = MCPBrowserPlugin() # Uses intelligent defaults for all inherited fields
With custom data paths:
plugin = MCPBrowserPlugin( servers_data_file=Path("custom/path/servers.csv"), install_reports_pattern="custom_install_*.json" )
Plugin initialization:
await plugin.initialize() servers = plugin.get_servers() print(f"Loaded {len(servers)} downloaded servers")
- get_plugin_stats() Dict[str, Any] ΒΆ
Get comprehensive plugin statistics.
- Returns:
Dictionary with plugin statistics and server information
- get_server_by_name(server_name: str) haive.dataflow.platform.models.DownloadedServerInfo | None ΒΆ
Get a specific server by name.
- Parameters:
server_name β Server name to search for
- Returns:
Server if found, None otherwise
- get_servers() List[haive.dataflow.platform.models.DownloadedServerInfo] ΒΆ
Get our 63 downloaded servers with intelligent caching.
This method implements intelligent caching to avoid repeatedly loading and processing our server data. It uses the cache TTL to determine when to refresh the data.
- Returns:
List of DownloadedServerInfo instances for our downloaded servers
Examples
>>> plugin = MCPBrowserPlugin() >>> servers = plugin.get_servers() >>> len(servers) 63 >>> all(s.source == ServerSource.DOWNLOADED for s in servers) True
- get_servers_by_language(language: str) List[haive.dataflow.platform.models.DownloadedServerInfo] ΒΆ
Get servers filtered by programming language.
- Parameters:
language β Programming language to filter by
- Returns:
List of servers matching the language
- get_servers_by_stars(min_stars: int = 0) List[haive.dataflow.platform.models.DownloadedServerInfo] ΒΆ
Get servers with at least the specified number of stars.
- Parameters:
min_stars β Minimum number of GitHub stars
- Returns:
List of servers sorted by star count (descending)
- async initialize() None ΒΆ
Initialize plugin with validation and server loading.
This method extends the base PluginPlatform initialization with MCP-specific setup and validation.
- register_routes(app: fastapi.FastAPI) None ΒΆ
Register plugin routes with FastAPI app.
This method creates FastAPI routes for browsing our downloaded servers. Itβs called by the platform during plugin initialization.
- Parameters:
app β FastAPI application instance to register routes with
- classmethod validate_servers_data_file_exists(v: pathlib.Path) pathlib.Path ΒΆ
Validate that servers data file exists (when not using defaults).
- cache_timestamp: datetime.datetime | None = NoneΒΆ
- downloaded_servers_path: pathlib.Path = NoneΒΆ
- model_configΒΆ
- servers_data_file: pathlib.Path = NoneΒΆ