Skip to main content
Glama

🌐 MCP Hub Router

Python Version License: MIT MCP Spec Compliant

Anthropic tomonidan ishlab chiqilgan Model Context Protocol (MCP) spetsifikatsiyasiga to'liq mos keluvchi, AI agentlar (Claude Desktop, Cursor, Antigravity, LLM agentlar) uchun yengil vaznli vositalar shlyuzi (Tool Gateway), marshrutizator va telemetriya tizimi.


🌟 Imkoniyatlari

  • MCP Spetsifikatsiyasi: initialize, ping, tools/list, tools/call kabi barcha standart JSON-RPC 2.0 protokollarini qo'llab-quvvatlaydi.

  • Qulay Dekorator: Python funksiyalarini @router.tool(...) orqali bir zumda AI vositasiga aylantirish.

  • Asinxron va Sinxron: Asinxron async def va sinxron def vositalarni bir xil marshrutlash.

  • Jonli Telemetriya (Router Telemetry): Har bir vosita qancha millisekundda ishlagani, muvaffaqiyat foizi va xatoliklarni kuzatib boradi.

  • Zero-Dependency: Tashqi og'ir paketlarsiz, Python standart kutubxonasida tez ishlaydi.


Related MCP server: Smart MCP Proxy

πŸš€ O'rnatish

git clone https://github.com/afzalbek-dev/mcp-hub-router.git
cd mcp-hub-router
pip install .

πŸ› οΈ Foydalanish

import asyncio
from mcp_router import MCPRouter

router = MCPRouter(server_name="developer-toolkit", server_version="1.0.0")

# 1. AI agent uchun yangi instrument (tool) ro'yxatdan o'tkazish
@router.tool(
    name="get_weather_forecast",
    description="Berilgan shahar bo'yicha ob-havo ma'lumotini qaytaradi",
    input_schema={
        "type": "object",
        "properties": {
            "city": {"type": "string", "description": "Shahar nomi (masalan: Tashkent)"}
        },
        "required": ["city"]
    }
)
async def weather_tool(city: str):
    return f"{city} shahrida havo ochiq, harorat +24Β°C"

# 2. JSON-RPC so'rovini qabul qilish va javob qaytarish
async def main():
    test_request = '''
    {
        "jsonrpc": "2.0",
        "id": "req-1",
        "method": "tools/call",
        "params": {
            "name": "get_weather_forecast",
            "arguments": {"city": "Tashkent"}
        }
    }
    '''
    response = await router.handle_request(test_request)
    print("MCP Javobi:", response)
    print("Telemetriya:", router.telemetry.summary())

asyncio.run(main())

πŸ§ͺ Testlash

python3 -m unittest discover tests -v

πŸ“„ Litsenziya

MIT License. Muallif: Afzalbek.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Federating gateway for AI agents to discover and call tools from multiple MCP servers with intelligent search and dynamic tool registration.
      20 PyPI
      39
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      A high-performance MCP gateway for Python with Rust core, enabling fast JSON-RPC routing and tool dispatch.
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Provides a JSON-RPC MCP server that exposes policy-governed agent tools, including paid tools, tool muxing, and OpenAPI-to-MCP conversion, enabling agents to discover, coordinate, and execute tasks within the ProtoOS ecosystem.
      5
      1
      Apache 2.0