Skip to main content
Glama

MCP-YNU FastMCP Server

Official
by ynu

MCP-YNU - FastMCP Server

A dynamic MCP server implementation using FastMCP that automatically loads tools, resources, and prompts from respective directories.

Features

  • Dynamic loading of modules from tools/, resources/, and prompts/ directories
  • Automatic discovery and registration of modules
  • Simple configuration and extensibility
  • Type hints for better code clarity and static analysis
  • Comprehensive logging for monitoring server activity

Recent Updates

  • Added type hints throughout the codebase
  • Improved MCP instance handling
  • Added logging functionality
  • Added MIT license
  • Updated documentation with reference links

Directory Structure

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

Usage

  1. Create modules in the appropriate directories
  2. Import mcp via from mcp_server import mcp
  3. Run the server:
python main.py

Example Modules

Tools Module Example (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 Module Example (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 Module Example (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?"), ]

Debugging

  1. Update MCP_TRANSPORT_TYPE in .env, Execute python main.py to start the mcp server
  2. Execute npx @modelcontextprotocol/inspector to open the inspect.
  3. Choose SSE Transport Type with URL http://localhost:<mcp_server_port>/sse or Choose STDIO Transport Type with Command python and Arguments /path/to/main.py

@modelcontextprotocol/inspector

Requirements

  • Python >= 3.10
  • FastMCP

License

This project is licensed under the MIT License - see the LICENSE file for details.

-
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
                    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
                    27
                    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 -
                    580
                    5
                  • 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
                    45
                    15
                    MIT License
                  • A
                    security
                    F
                    license
                    A
                    quality
                    An MCP server that allows users to create custom tools on the fly by stitching together actions from multiple MCP tools into reusable routines.
                    Last updated -
                    4
                    6
                    1

                  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