Skip to content

Restructure code for clarity: Split MCP tools from single server.py file #15

@RadCod3

Description

@RadCod3

Problem

Currently, all 17+ MCP tools are defined in a single server.py file, which makes the codebase difficult to navigate and maintain. As the project grows, this monolithic structure will become increasingly unwieldy.

Proposed Solution

Restructure the codebase to separate MCP tools into logical modules:

Suggested Structure

src/lampyrid/
├── server.py                 # FastMCP server initialization and configuration
├── tools/
│   ├── __init__.py          # Tool registration
│   ├── accounts.py          # Account management tools (list_accounts, search_accounts, get_account)
│   ├── transactions.py      # Transaction management tools (CRUD operations)
│   └── budgets.py           # Budget management tools (list, get, spending analysis)

Benefits

  • Improved Maintainability: Each module focuses on a specific domain
  • Better Navigation: Easier to locate and modify specific tools
  • Cleaner Code: Reduced file size and better separation of concerns
  • Scalability: Easier to add new tools without cluttering a single file
  • Testing: Can test tool modules independently

Implementation Considerations

  • Maintain existing FastMCP server initialization pattern
  • Keep all tool tags and metadata intact
  • Ensure no breaking changes to the MCP interface
  • Update tests to reflect new structure
  • Update documentation to reference new file locations

Current Stats

  • server.py contains all 17+ MCP tools
  • File is becoming difficult to navigate
  • Clear domain boundaries already exist (accounts, transactions, budgets)

This refactoring aligns with the project's clean architecture principles and will make future development more efficient.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions