Skip to content

Feature Proposal: Modular Router System for MCP Python SDK #767

Closed as not planned

Description

@DamyanBG

This proposal suggests enhancing the Model Context Protocol Python SDK with a modular router system similar to FastAPI's APIRouter. This would allow developers to organize MCP tools, resources, and prompts across multiple files and modules, improving code organization and maintainability for larger applications.

Current limitation

Currently, the MCP Python SDK requires defining all tools, resources, and prompts on a single FastMCP instance:

# main.py
from mcp.server.fastmcp import FastMCP

mcp = FastMCP("My App")

@mcp.tool()
def tool_one():
    # implementation

@mcp.resource()
def resource_one():
    # implementation

For larger applications, this leads to several issues:

  • All MCP components must be defined in a single file or imported into a single namespace
  • Difficult to organise code by domain or feature
  • No clear way to create reusable tool/resource modules
  • Challenging to maintain separation of concerns in larger projects

Request

It would be beneficial to have a modular router system similar to FastAPI's APIRouter that allows developers to:

  1. Define tools, resources, and prompts in separate files
  2. Group related functionality in domain-specific modules
  3. Import and combine these modules in a main MCP application

This would significantly improve code organization and maintainability for larger MCP-based applications, especially those with many tools and resources spanning different domains or features.

Activity

  1. added
    enhancementRequest for a new feature that's not currently supported
    ready for workEnough information for someone to start working on
    P3Nice to haves, rare edge cases
    on Oct 6, 2025
  2. added
    needs decisionIssue is actionable, needs maintainer decision on whether to implement
    and removed
    ready for workEnough information for someone to start working on
    on Apr 17, 2026
  3. maxisbey commented on Jul 24, 2026

    @maxisbey
    Contributor

    Thanks for the report. Tracking this in #1281 instead. Closing as part of a general backlog cleanup ahead of the v2 release. If this is still relevant against current main, feel free to reopen.

    AI Disclaimer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Nice to haves, rare edge casesenhancementRequest for a new feature that's not currently supportedneeds decisionIssue is actionable, needs maintainer decision on whether to implement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions