Skip to main content
Glama

MyAIServ MCP Server

MCP サーバー - モデルコンテキストプロトコル API

MCP サーバーは、LLM モデルとアプリケーション間の相互作用のための標準化されたインターフェイスを提供するモデル コンテキスト プロトコル (MCP) の FastAPI ベースの実装です。

特徴

  • 🚀 FastAPIと非同期操作に基づく高性能API
  • 🔄 リソース、機器、プロンプト、サンプリングによる完全な MCP サポート
  • 📊 PrometheusとGrafanaによるモニタリングとメトリクス
  • 🧩 シンプルなインターフェースで新しいツールを追加できる拡張性
  • 📝 データを柔軟に操作できるGraphQL API
  • 💬 リアルタイムインタラクションのためのWebSocketサポート
  • 🔍 Elasticsearchとの統合によるセマンティック検索
  • 🗃️ Redis によるキャッシュでパフォーマンスを向上
  • 📦 信頼性の高いパッケージ管理のために、Poetry で依存関係を管理します

はじめる

インストール

  1. リポジトリのクローン:
    git clone https://github.com/yourusername/myaiserv.git cd myaiserv
  2. Poetry をインストールします (まだインストールされていない場合):
    curl -sSL https://install.python-poetry.org | python3 -
  3. Poetry 経由で依存関係をインストールします。
    poetry install

サーバーの起動

poetry run uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload

または just ユーティリティ経由で:

just run

起動後、APIは次の場所で利用できます: http://localhost:8000

APIドキュメント

プロジェクト構造

myaiserv/ ├── app/ │ ├── core/ # Базовые компоненты MCP │ │ ├── base_mcp.py # Абстрактные классы MCP │ │ └── base_sampling.py # Базовые классы для сэмплирования │ ├── models/ # Pydantic модели │ │ ├── mcp.py # Модели данных MCP │ │ └── graphql.py # GraphQL схема │ ├── services/ # Бизнес-логика │ │ └── mcp_service.py # Сервис MCP │ ├── storage/ # Хранилище данных │ ├── tools/ # Инструменты MCP │ │ ├── example_tool.py # Примеры инструментов │ │ └── text_processor.py # Инструмент обработки текста │ ├── utils/ # Утилиты │ └── main.py # Точка входа FastAPI ├── app/tests/ # Тесты ├── docs/ # Документация │ └── MCP_API.md # Описание API ├── pyproject.toml # Конфигурация Poetry и инструментов └── .justfile # Задачи для утилиты just

利用可能なツール

ファイルシステムツール

ファイルの��み取り、書き込み、削除、一覧表示をサポートするファイル システム ツール。

curl -X POST "http://localhost:8000/tools/file_operations" \ -H "Content-Type: application/json" \ -d '{"operation": "list", "path": "."}'

天気ツール

座標によって天気データを取得するためのツール。

curl -X POST "http://localhost:8000/tools/weather" \ -H "Content-Type: application/json" \ -d '{"latitude": 37.7749, "longitude": -122.4194}'

テキスト分析ツール

感情の検出や要約を含むテキスト分析ツール。

curl -X POST "http://localhost:8000/tools/text_analysis" \ -H "Content-Type: application/json" \ -d '{"text": "Example text for analysis", "analysis_type": "sentiment"}'

テキストプロセッサツール

書式設定、統計計算、エンティティ抽出などのテキスト処理ツール。

curl -X POST "http://localhost:8000/tools/text_processor" \ -H "Content-Type: application/json" \ -d '{"operation": "statistics", "text": "Example text", "stat_options": ["chars", "words"]}'

画像処理ツール

サイズ変更、切り取り、フィルターの適用をサポートする画像処理ツール。

curl -X POST "http://localhost:8000/tools/image_processing" \ -H "Content-Type: application/json" \ -d '{"operation": "resize", "image_data": "base64...", "params": {"width": 800, "height": 600}}'

WebSocket API

WebSocket API に接続するには:

const socket = new WebSocket("ws://localhost:8000/ws"); socket.onopen = () => { socket.send(JSON.stringify({ type: "initialize", id: "my-request-id" })); }; socket.onmessage = (event) => { const data = JSON.parse(event.data); console.log("Received:", data); };

GraphQL API

GraphQL 経由のクエリの例:

# Получение списка всех инструментов query { getTools { name description } } # Выполнение инструмента mutation { executeTool(input: { name: "text_processor", parameters: { operation: "statistics", text: "Example text for analysis" } }) { content { type text } is_error } }

テストの実行

テストを実行するには、Poetry を使用します。

poetry run pytest

または just ユーティリティ経由で:

just test

ドッカー

Docker Compose によるビルドと実行

docker compose up -d

個々のサービスを起動するには:

docker compose up -d web redis elasticsearch

LLMとの統合

MCP サーバーは、さまざまなベンダーの LLM モデルとの統合のための標準化されたインターフェースを提供します。

import httpx async def query_mcp_with_llm(prompt: str): async with httpx.AsyncClient() as client: # Запрос к MCP для получения контекста и инструментов tools_response = await client.get("http://localhost:8000/tools") tools = tools_response.json()["tools"] # Отправка запроса к LLM с включением MCP контекста llm_response = await client.post( "https://api.example-llm.com/v1/chat", json={ "messages": [ {"role": "system", "content": "You have access to the following tools:"}, {"role": "user", "content": prompt} ], "tools": tools, "tool_choice": "auto" } ) return llm_response.json()

指標と監視

MCP サーバーは/metricsエンドポイントを介して Prometheus 形式のメトリックを提供します。指標には次のものが含まれます:

  • 各ツールへのリクエスト数
  • クエリ実行時間
  • エラーと例外

発達

コードをフォーマットしてリンターでチェックするには:

just fmt just lint

ライセンス

MITライセンス

-
security - not tested
A
license - permissive license
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

大規模言語モデルとのシームレスな統合を実現するモデル コンテキスト プロトコル (MCP) をサポートする高性能 FastAPI サーバー。REST、GraphQL、WebSocket API に加え、リアルタイム監視およびベクトル検索機能を備えています。

  1. 特徴
    1. はじめる
      1. インストール
      2. サーバーの起動
      3. APIドキュメント
    2. プロジェクト構造
      1. 利用可能なツール
        1. ファイルシステムツール
        2. 天気ツール
        3. テキスト分析ツール
        4. テキストプロセッサツール
        5. 画像処理ツール
      2. WebSocket API
        1. GraphQL API
          1. テストの実行
            1. ドッカー
              1. Docker Compose によるビルドと実行
            2. LLMとの統合
              1. 指標と監視
                1. 発達
                  1. ライセンス

                    Related MCP Servers

                    • -
                      security
                      F
                      license
                      -
                      quality
                      A production-ready MCP server built with FastAPI, providing an enhanced tool registry for creating, managing, and documenting AI tools for Large Language Models (LLMs).
                      Last updated -
                      32
                      Python
                    • -
                      security
                      A
                      license
                      -
                      quality
                      A Model Context Protocol (MCP) compliant server that allows Large Language Models (LLMs) to search and retrieve content from microCMS APIs.
                      Last updated -
                      TypeScript
                      MIT License
                    • -
                      security
                      A
                      license
                      -
                      quality
                      A high-performance Model Context Protocol (MCP) server designed for large language models, enabling real-time communication between AI models and applications with support for session management and intelligent tool registration.
                      Last updated -
                      2
                      Python
                      MIT License
                    • -
                      security
                      F
                      license
                      -
                      quality
                      A FastAPI server implementing the Model Context Protocol (MCP) for structured tool use, providing utility tools including random number generation, image generation via Azure OpenAI DALL-E, and AI podcast generation.
                      Last updated -
                      Python

                    View all related MCP servers

                    MCP directory API

                    We provide all the information about MCP servers via our MCP API.

                    curl -X GET 'https://glama.ai/api/mcp/v1/servers/eagurin/myaiserv'

                    If you have feedback or need assistance with the MCP directory API, please join our Discord server