Skip to content

v0.3.0 - Convention-based Project Structure

Choose a tag to compare

@KeshavVarad KeshavVarad released this 04 Nov 18:32
· 30 commits to main since this release
271d3cf

Convention-Based Project Structure with Auto-Discovery

This release introduces convention-based project structure with automatic discovery, bringing a Next.js-like developer experience to NextMCP.

🎯 Key Features

Single-Line Server Setup

from nextmcp import NextMCP

# That's it! Auto-discovers everything from directories
app = NextMCP.from_config()

if __name__ == "__main__":
    app.run()

Auto-Discovery Engine

  • Automatically discovers tools from tools/ directory
  • Automatically discovers prompts from prompts/ directory
  • Automatically discovers resources from resources/ directory
  • Supports nested directory structures
  • Handles errors gracefully

Configuration-Based Setup

Create a nextmcp.config.yaml file:

name: my-server
version: 1.0.0
description: My awesome MCP server

auto_discover: true

discovery:
  tools: tools/
  prompts: prompts/
  resources: resources/

📦 What's New

Core Features

  • Auto-Discovery Engine (nextmcp/discovery.py) - Scan directories and automatically register primitives
  • NextMCP.from_config() - Single-line server setup with zero boilerplate
  • Project Validation - validate_project_structure() function
  • Configuration System - Support for nextmcp.config.yaml manifest

Example Project

  • Blog Server (examples/blog_server/) - Complete convention-based example
    • 5 tools, 3 prompts, 4 resources
    • Single-line setup with NextMCP.from_config()
    • Before/after comparison in README

Testing

  • 26 new comprehensive tests (235 total, all passing)
  • Full coverage of auto-discovery, config loading, and integration

🔄 Backward Compatibility

100% Backward Compatible - All existing code continues to work without any changes. The new convention-based features are opt-in.

📊 Key Improvements

Aspect Before After
Setup Manual registration One-line from_config()
Organization Single file Convention-based directories
Structure Unstructured Organized (tools/, prompts/, resources/)
Discovery Manual imports Automatic from directories

📈 Statistics

  • 32 files changed
  • 1,823 additions
  • 235 tests passing (26 new tests)
  • Zero breaking changes

🚀 Getting Started

1. Create Project Structure

my-mcp-server/
├── nextmcp.config.yaml
├── tools/
│   └── my_tools.py
├── prompts/
│   └── my_prompts.py
└── resources/
    └── my_resources.py

2. Use Decorators in Files

# tools/my_tools.py
from nextmcp import tool

@tool()
def my_tool(param: str) -> str:
    return f"Result: {param}"

3. Single-Line Server Setup

# server.py
from nextmcp import NextMCP

app = NextMCP.from_config()

if __name__ == "__main__":
    app.run()

That's it! All tools, prompts, and resources are automatically discovered and registered.

📚 Documentation

🙏 Credits

This release brings NextMCP's vision to life: making MCP server development as easy and enjoyable as Next.js made React development.


Full Changelog: v0.2.1...v0.3.0