Skip to main content
Glama

MCP-YNU FastMCP Server

Official
by ynu

MCP-YNU - FastMCP サーバー

各ディレクトリからツール、リソース、プロンプトを自動的に読み込む FastMCP を使用した動的 MCP サーバー実装。

特徴

  • tools/resources/prompts/ディレクトリからのモジュールの動的ロード
  • モジュールの自動検出と登録
  • シンプルな構成と拡張性
  • コードの明確さと静的解析を向上させる型ヒント
  • サーバーアクティビティを監視するための包括的なログ記録

最近の更新

  • コードベース全体に型ヒントを追加しました
  • MCPインスタンス処理の改善
  • ログ機能の追加
  • MITライセンスを追加
  • 参照リンクを含むドキュメントを更新しました

ディレクトリ構造

mcp-ynu/ ├── tools/ # Directory for tool modules │ ├── __init__.py │ ├── example.py ├── resources/ # Directory for resource modules │ ├── __init__.py │ ├── example.py ├── prompts/ # Directory for prompt modules │ ├── __init__.py │ ├── example.py ├── logger.py # Logger implementation ├── main.py # Main implementation ├── mcp_server.py # MCP server implementation ├── README.md # Project documentation ├── LICENSE # MIT License └── pyproject.toml # Project configuration

使用法

  1. 適切なディレクトリにモジュールを作成する
  2. from mcp_server import mcp経由で mcp をインポートします。
  3. サーバーを実行します。
python main.py

サンプルモジュール

ツールモジュールの例 (tools/example.py)

from mcp_server import mcp import httpx @mcp.tool() def calculate_bmi(weight_kg: float, height_m: float) -> float: """Calculate BMI given weight in kg and height in meters""" return weight_kg / (height_m**2) @mcp.tool() async def fetch_weather(city: str) -> str: """Fetch current weather for a city""" async with httpx.AsyncClient() as client: response = await client.get(f"https://api.weather.com/{city}") return response.text

リソースモジュールの例 (resources/example.py)

from mcp_server import mcp @mcp.resource("config://app") def get_config() -> str: """Static configuration data""" return "App configuration here" @mcp.resource("users://{user_id}/profile") def get_user_profile(user_id: str) -> str: """Dynamic user data""" return f"Profile data for user {user_id}"

プロンプトモジュールの例 (prompts/example.py)

from mcp_server import mcp from mcp.server.fastmcp.prompts import base @mcp.prompt() def review_code(code: str) -> str: return f"Please review this code:\n\n{code}" @mcp.prompt() def debug_error(error: str) -> list[base.Message]: return [ base.UserMessage("I'm seeing this error:"), base.UserMessage(error), base.AssistantMessage("I'll help debug that. What have you tried so far?"), ]

デバッグ

  1. .envMCP_TRANSPORT_TYPEを更新し、 python main.pyを実行して mcp サーバーを起動します。
  2. npx @modelcontextprotocol/inspectorを実行してinspectを開きます。
  3. URL http://localhost:<mcp_server_port>/sseSSEトランスポート タイプを選択するか、コマンドpythonと引数/path/to/main.pySTDIOトランスポート タイプを選択します。

@modelcontextprotocol/インスペクター

要件

  • Python >= 3.10
  • ファストMCP

参考リンク

ライセンス

このプロジェクトは MIT ライセンスに基づいてライセンスされています - 詳細についてはLICENSEファイルを参照してください。

-
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 サーバー実装。

  1. 特徴
    1. 最近の更新
      1. ディレクトリ構造
        1. 使用法
          1. サンプルモジュール
            1. ツールモジュールの例 (tools/example.py)
            2. リソースモジュールの例 (resources/example.py)
            3. プロンプトモジュールの例 (prompts/example.py)
          2. デバッグ
            1. 要件
              1. 参考リンク
                1. ライセンス

                  Related MCP Servers

                  • A
                    security
                    A
                    license
                    A
                    quality
                    An MCP server to run commands.
                    Last updated -
                    2
                    933
                    160
                    TypeScript
                    MIT License
                    • Apple
                  • A
                    security
                    A
                    license
                    A
                    quality
                    MCP server that builds itself by creating new tools as needed based on user requests (Requires restart of Claude Desktop to use newly created tools).
                    Last updated -
                    4
                    13
                    Python
                    The Unlicense
                  • -
                    security
                    F
                    license
                    -
                    quality
                    A configurable MCP server that dynamically loads capabilities from a remote configuration to bridge MCP clients with remote APIs for executing actions, accessing resources, and utilizing prompt templates.
                    Last updated -
                    839
                    4
                    TypeScript
                  • A
                    security
                    A
                    license
                    A
                    quality
                    A tool that dynamically generates and configures MCP servers by automatically creating necessary directories and files according to user specifications.
                    Last updated -
                    1
                    9
                    9
                    JavaScript
                    MIT License

                  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/ynu/mcp-ynu'

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