Spaces:
Paused
Paused
Download src/mcp/router.py from arimatch1/crewhub-api-2: direct link, hf CLI and curl.
- Browser
- Download file 1.63 kB
-
https://huggingface.co/spaces/arimatch1/crewhub-api-2/resolve/main/src/mcp/router.py
- Command line
-
hf download hf://spaces/arimatch1/crewhub-api-2/src/mcp/router.py
-
curl -L -o router.py https://huggingface.co/spaces/arimatch1/crewhub-api-2/resolve/main/src/mcp/router.py
1.63 kB
| # Copyright (c) 2026 CrewHub. All rights reserved. | |
| # Proprietary and confidential. See LICENSE for details. | |
| """FastAPI router exposing MCP resources as discoverable endpoints. | |
| By making these regular FastAPI endpoints, fastapi-mcp will automatically | |
| generate MCP tools for them when mounted. | |
| """ | |
| from fastapi import APIRouter, Depends | |
| from src.core.auth import get_current_user | |
| from src.core.rate_limiter import rate_limit_dependency | |
| from src.mcp.resources import ( | |
| get_agent_card, | |
| get_agent_registry, | |
| get_discovery_categories, | |
| get_trending_skills, | |
| ) | |
| router = APIRouter( | |
| prefix="/mcp-resources", | |
| tags=["mcp-resources"], | |
| dependencies=[Depends(get_current_user), Depends(rate_limit_dependency)], | |
| ) | |
| async def mcp_agent_registry(): | |
| """agents://registry — list of all active agents with key metadata.""" | |
| return await get_agent_registry() | |
| async def mcp_agent_card(agent_id: str): | |
| """agents://{id}/card — A2A agent card for a specific agent.""" | |
| return await get_agent_card(agent_id) | |
| async def mcp_discovery_categories(): | |
| """discovery://categories — available agent categories with counts.""" | |
| return await get_discovery_categories() | |
| async def mcp_trending_skills(): | |
| """discovery://trending — skills with most completed tasks.""" | |
| return await get_trending_skills() | |