
cognitive-stack/mcphub
Developer toolsЭта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал
cognitive-stack/mcphub - кандидат на сервер MCP, импортированный из T0
Обзор
cognitive-stack/mcphub - кандидат на сервер MCP, импортированный из T0
Обзор (машинный перевод)
MCPHub - это встраиваемое решение Model Context Protocol (MCP) для служб ИИ. Он обеспечивает бесшовную интеграцию MCP-серверов в любую структуру ИИ, позволяя разработчикам легко настраивать, настраивать и управлять MCP-серверами в своих приложениях. Независимо от того, используете ли вы OpenAI Agents, LangChain или Autogen, MCPHub предоставляет единый способ подключения ваших услуг ИИ к инструментам и ресурсам MCP.
Документация
CLI Documentation - интерфейс командной строки для управления серверами MCP API Документация - Python API reference
- Руководство по конфигурации - детали конфигурации сервера
- Примеры - Примеры использования и учебные пособия
Быстрый старт
Предпосылки
Убедитесь, что у вас установлены следующие инструменты:
Конфигурация
Создайте файл .mcphub.json в корне вашего проекта:
Добавление новых MCP-серверов
Добавить новые MCP-серверы можно двумя способами:
-
** Современная конфигурация**: Добавьте конфигурацию сервера непосредственно в файл
.mcphub.json. -
** Автоматическая конфигурация из GitHub**: Используйте метод
add_server_from_repoдля автоматической настройки сервера из репозитория GitHub:
Автоматическая конфигурация: Получает README из репозитория GitHub
Эта страница переведена автоматически. Технические детали смотрите в оригинале.
README
Показан фрагмент оригинального README. Открыть оригинал.
MCPHub
MCPHub is an embeddable Model Context Protocol (MCP) solution for AI services. It enables seamless integration of MCP servers into any AI framework, allowing developers to easily configure, set up, and manage MCP servers within their applications. Whether you’re using OpenAI Agents, LangChain, or Autogen, MCPHub provides a unified way to connect your AI services with MCP tools and resources.
Documentation
- CLI Documentation - Command-line interface for managing MCP servers
- API Documentation - Python API reference
- Configuration Guide - Server configuration details
- Examples - Usage examples and tutorials
Quick Start
Prerequisites
Ensure you have the following tools installed:
# Install uv (Python package manager)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install git (for repository cloning)
sudo apt-get install git # Ubuntu/Debian
brew install git # macOS
# Install npx (comes with Node.js)
npm install -g npx
# Install MCPHub
pip install mcphub # Basic installation
# Optional: Install with framework-specific dependencies
pip install mcphub[openai] # For OpenAI Agents integration
pip install mcphub[langchain] # For LangChain integration
pip install mcphub[autogen] # For Autogen integration
pip install mcphub[all] # Install all optional dependencies
Configuration
Create a .mcphub.json file in your project root:
{
"mcpServers": {
"sequential-thinking-mcp": {
"package_name": "smithery-ai/server-sequential-thinking",
"command": "npx",
"args": [
"-y",
"@smithery/cli@latest",
"run",
"@smithery-ai/server-sequential-thinking"
]
}
}
}
Adding New MCP Servers
You can add new MCP servers in two ways:
-
Manual Configuration: Add the server configuration directly to your
.mcphub.jsonfile. -
Automatic Configuration from GitHub: Use the
add_server_from_repomethod to automatically configure a server from its GitHub repository:
from mcphub import MCPHub
# Initialize MCPHub
hub = MCPHub()
# Add a new server from GitHub
hub.servers_params.add_server_from_repo(
server_name="my-server",
repo_url="https://github.com/username/repo"
)
The automatic configuration:
- Fetches the README from the GitHub repository
- Uses OpenAI to analyze the README and extract the server configuration
- Adds the configuration to your
.mcphub.jsonfile - Requires an OpenAI API key (set via
OPENAI_API_KEYenvironment variable)
Usage with OpenAI Agents
import asyncio
import json
from agents import Agent, Runner
from mcphub import MCPHub
async def main():
"""
Example of using MCPHub to integrate MCP servers with OpenAI Agents.
This example demonstrates:
1. Initializing MCPHub
Установка
npx -y @smithery/cli@latest run @smithery-ai/server-sequential-thinkingКонфигурация
{
"mcpServers": {
"sequential-thinking-mcp": {
"package_name": "smithery-ai/server-sequential-thinking",
"command": "npx",
"args": [
"-y",
"@smithery/cli@latest",
"run",
"@smithery-ai/server-sequential-thinking"
]
}
}
}