MCP Server Development Framework

by mlzoo

208 stars
394 downloads
Not rated
GitHub

About

A professional framework for enterprise-level Model Context Protocol (MCP) tool development, integrating FastAPI and FastAPI-MCP to automate converting traditional APIs into AI-callable MCP tools.

Details

Author
mlzoo
GitHub stars
208
Downloads
394
Categories
Developer Tools

- Automatically converts FastAPI endpoints into MCP tools
- Supports interface-implementation separation for testing and environment switching
- Leverages FastAPI’s dependency injection for flexible component decoupling
- Provides complete development pipeline from development to deployment
- Includes example-driven documentation and multi-level testing support

Use uv as package manager; run make install to set up the environment and make dev to start the example service. Connect to the MCP endpoint at http://localhost:5000/mcp with an MCP client.

MCP Server Development Framework

中文文档

Overview

A professional framework designed for enterprise-level Model Context Protocol (MCP) tool development, standardizing the MCP server development process to help developers rapidly build high-quality AI tools. By integrating FastAPI with FastAPI-MCP, this framework enables seamless transformation from traditional APIs to AI-callable tools.

Key Features

- MCP Tool Standardization: Automatically convert traditional FastAPI endpoints into AI model-callable MCP tools
- Interface-Implementation Separation: Support clear separation between interface definitions and implementations, facilitating testing and environment switching
- Dependency Injection Design: Leverage FastAPI's dependency injection mechanism for flexible component composition and decoupling
- Complete Development Pipeline: Provide comprehensive toolchain support from development to testing and deployment
- Example-Driven Documentation: Demonstrate best practices through practical examples to accelerate onboarding

This framework is particularly suitable for:
- AI tool development teams
- Developers looking to transform existing APIs into AI tools
- Organizations implementing standardized microservice architectures

Architecture

Core Architecture

┌─────────────┐      ┌───────────────┐      ┌─────────────────┐
│   API Layer │ ──→  │ Service Layer │ ──→  │ Implementation  │
└─────────────┘      └───────────────┘      └─────────────────┘
       ↓
┌─────────────┐
│ MCP Endpoint│ ←── FastAPI-MCP Auto-Conversion
└─────────────┘

Key Components

- FastAPI Application: Provides the HTTP API service foundation
- FastAPI-MCP: Converts API endpoints to MCP tools
- Service Interface Layer: Defines service contracts through abstract base classes
- Dependency Injection Providers: Manages service instance creation and injection
- Implementation Classes: Includes Mock and Real implementations with environment-based switching

Technology Stack

- Python 3.10+: Utilizing latest language features and type annotations
- FastAPI: High-performance asynchronous web framework
- FastAPI-MCP: Automatically exposes FastAPI endpoints as MCP tools
- Development Toolchain: Includes code quality checking and testing tools

Quick Start

Environment Setup

This framework uses uv as its package manager, providing faster dependency resolution and virtual environment management. For installation instructions, see the uv official documentation.

```bash

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.