Skip to main content

A simple wrapper library for FastMCP + Starlette

Project description

README.md

viyv_mcp

viyv_mcp is a simple Python wrapper library for FastMCP and Starlette.
It enables you to quickly create a fully‐configured MCP server project with sample tools, resources, prompts, and external configuration support.

Features

  • Quick Project Creation:
    Use the provided CLI command create-viyv-mcp new <project_name> to generate a new project template with a complete directory structure and sample files.
  • Integrated MCP Server:
    Automatically sets up FastMCP with Starlette and provides an SSE-based API.
  • Decorator APIs:
    Simplify registration of tools, resources, prompts, and agents with built-in decorators (@tool, @resource, @prompt, and @agent).
  • External MCP Bridge Support:
    Automatically launches and registers external MCP servers based on JSON config files in app/mcp_server_configs.
  • Health Check Endpoint:
    Provides a /health endpoint to verify server status (returns {"status":"ok"}).
  • Template Inclusion:
    The generated project templates include:
    • Configuration Files: (e.g. app/config.py)
    • Prompts: (e.g. app/prompts/sample_prompt.py)
    • Resources: (e.g. app/resources/sample_echo_resource.py)
    • Tools: (e.g. app/tools/sample_math_tools.py)
    • MCP Server Configs: (e.g. app/mcp_server_configs/sample_slack.json)
    • Dockerfile, pyproject.toml, and main.py for the generated project.

Installation

From PyPI

Install viyv_mcp via pip:

pip install viyv_mcp

This installs the package as well as provides the CLI command create-viyv-mcp.

Usage

Creating a New Project Template

After installing the package, run:

create-viyv-mcp new my_mcp_project

This command creates a new directory called my_mcp_project with the following structure:

my_mcp_project/
├── Dockerfile
├── pyproject.toml
├── main.py
└── app/
    ├── config.py
    ├── mcp_server_configs/
    │   └── sample_slack.json
    ├── prompts/
    │   └── sample_prompt.py
    ├── resources/
    │   └── sample_echo_resource.py
    └── tools/
        └── sample_math_tools.py

Running the MCP Server

  1. Change into your new project directory:

    cd my_mcp_project
    
  2. Use uv to resolve dependencies (this uses the pyproject.toml for dependency management):

    uv sync
    
  3. Start the server with:

    uv run python main.py
    

The server will start on 0.0.0.0:8000 by default. It exposes an SSE-based API at / and /messages, provides a health-check endpoint at /health (returns {"status":"ok"}), automatically registers local modules (tools, resources, prompts), and bridges external MCP servers defined in app/mcp_server_configs.

Package Structure

viyv_mcp/
├── __init__.py           # Exports version, ViyvMCP, and decorators
├── core.py               # FastMCP integration and ASGI app setup
├── cli.py                # CLI command (create-viyv-mcp)
├── decorators.py         # Decorators for tool, resource, prompt, and agent registration
├── app/
│   ├── config.py         # Configuration (HOST, PORT, BRIDGE_CONFIG_DIR)
│   ├── lifespan.py       # Lifecycle context manager
│   ├── registry.py       # Module auto-registration logic
│   └── bridge_manager.py # External bridge management (init and close)
└── templates/
    ├── Dockerfile
    ├── pyproject.toml
    ├── main.py
    └── app/              # Sample project scaffold
        ├── config.py
        ├── mcp_server_configs/sample_slack.json
        ├── prompts/sample_prompt.py
        ├── resources/sample_echo_resource.py
        └── tools/sample_math_tools.py

pyproject.toml
README.md

Contributing

Contributions are welcome! If you find a bug or have a feature request, please open an issue or create a pull request on GitHub.

License

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

Contact

For any inquiries, please contact:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

viyv_mcp-0.1.3.tar.gz (31.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

viyv_mcp-0.1.3-py3-none-any.whl (41.8 kB view details)

Uploaded Python 3

File details

Details for the file viyv_mcp-0.1.3.tar.gz.

File metadata

  • Download URL: viyv_mcp-0.1.3.tar.gz
  • Upload date:
  • Size: 31.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for viyv_mcp-0.1.3.tar.gz
Algorithm Hash digest
SHA256 2d6446479de1fe9de837eac73c17d4784e53c9feed3ca04f5c1d2c7c28000a20
MD5 996968e535cf52cb5fdf4c3cc9207436
BLAKE2b-256 a877da6f44496cd84fcb0430b71b635eb15cf3d2ed4dbd9580d4c220e06fb0f7

See more details on using hashes here.

File details

Details for the file viyv_mcp-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: viyv_mcp-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 41.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for viyv_mcp-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c8a589a6acdfdf63d73a47d52617cbbdfaa2b3bc75fc266f3835ac412ad05498
MD5 94021a13f7e0db41169e8bea0c317859
BLAKE2b-256 c2fa711d1f2d62a04c874c6cfcce7591875a298056f92b4b4ec8ced472bcc86b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page