mcp.apiΒΆ
FastAPI web interface for MCP bulk management.
This module provides a complete REST API for managing MCP servers with bulk operations, real-time progress tracking, and a clean web interface for browsing and managing the 1900+ available MCP servers.
- Features:
Bulk server installation and management
Real-time progress tracking via WebSockets
Category-based server organization
Health monitoring and status reporting
Server browser and search interface
Operation history and logging
Examples
Running the FastAPI server:
# Start the server
poetry run python -m haive.mcp.api
# Or with uvicorn directly
poetry run uvicorn haive.mcp.api:app --reload --host 0.0.0.0 --port 8000
Using the API programmatically:
import httpx
# Get available categories
response = httpx.get("http://localhost:8000/api/mcp/categories")
categories = response.json()
# Install a category
response = httpx.post("http://localhost:8000/api/mcp/categories/development/install")
operation = response.json()
# Track progress
operation_id = operation["operation_id"]
progress = httpx.get(f"http://localhost:8000/api/mcp/operations/{operation_id}")
AttributesΒΆ
ClassesΒΆ
Response for bulk operations. |
|
Request to install servers from a category. |
|
Request to install MCP servers. |
|
Request to remove servers. |
|
Response for server status. |
FunctionsΒΆ
Perform health check on all connected servers. |
|
Get all available server categories. |
|
|
Get the status of a bulk operation. |
Get overall MCP system status. |
|
|
Install all servers in a category. |
|
Install multiple MCP servers. |
|
Manage the lifecycle of the FastAPI app. |
List all configured servers and their status. |
|
|
Run the FastAPI server. |
|
Remove multiple servers from the manager. |
|
Serve the main web interface. |
Update all installed MCP servers to latest versions. |
|
|
WebSocket endpoint for real-time progress updates. |
Module ContentsΒΆ
- class mcp.api.BulkOperationResponse(/, **data: Any)ΒΆ
Bases:
pydantic.BaseModel
Response for bulk operations.
- started_at: datetime.datetimeΒΆ
- class mcp.api.CategoryInstallRequest(/, **data: Any)ΒΆ
Bases:
pydantic.BaseModel
Request to install servers from a category.
- class mcp.api.ConnectionManagerΒΆ
-
- async connect(websocket: fastapi.WebSocket)ΒΆ
- disconnect(websocket: fastapi.WebSocket)ΒΆ
- active_connections: List[fastapi.WebSocket] = []ΒΆ
- class mcp.api.ServerInstallRequest(/, **data: Any)ΒΆ
Bases:
pydantic.BaseModel
Request to install MCP servers.
- class mcp.api.ServerRemoveRequest(/, **data: Any)ΒΆ
Bases:
pydantic.BaseModel
Request to remove servers.
- class mcp.api.ServerStatusResponse(/, **data: Any)ΒΆ
Bases:
pydantic.BaseModel
Response for server status.
- async mcp.api.bulk_health_check()ΒΆ
Perform health check on all connected servers.
- async mcp.api.get_categories()ΒΆ
Get all available server categories.
- async mcp.api.get_status()ΒΆ
Get overall MCP system status.
- async mcp.api.install_category(category_name: str, request: CategoryInstallRequest = CategoryInstallRequest(category_name='', max_concurrent=5), background_tasks: fastapi.BackgroundTasks = None)ΒΆ
Install all servers in a category.
- async mcp.api.install_servers(request: ServerInstallRequest)ΒΆ
Install multiple MCP servers.
- async mcp.api.lifespan(app: fastapi.FastAPI)ΒΆ
Manage the lifecycle of the FastAPI app.
- async mcp.api.list_servers()ΒΆ
List all configured servers and their status.
- mcp.api.main()ΒΆ
Run the FastAPI server.
- async mcp.api.remove_servers(request: ServerRemoveRequest)ΒΆ
Remove multiple servers from the manager.
- async mcp.api.root()ΒΆ
Serve the main web interface.
- async mcp.api.update_all_servers()ΒΆ
Update all installed MCP servers to latest versions.
- async mcp.api.websocket_endpoint(websocket: fastapi.WebSocket)ΒΆ
WebSocket endpoint for real-time progress updates.
- mcp.api.appΒΆ
- mcp.api.connection_managerΒΆ
- mcp.api.loggerΒΆ