Skip to content

Latest commit

 

History

History
865 lines (719 loc) · 29.7 KB

File metadata and controls

865 lines (719 loc) · 29.7 KB

Changelog

All notable changes to NextMCP will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[0.6.0] - 2025-11-16

Added

OAuth 2.0 Authentication System

A complete, production-ready OAuth 2.0 implementation with PKCE support, ready-to-use providers, session management, and comprehensive testing.

  • Core OAuth Framework (nextmcp/auth/oauth.py):

    • OAuthProvider: Base class for OAuth 2.0 providers
    • OAuthConfig: Configuration dataclass for OAuth settings
    • PKCEChallenge: Secure PKCE verifier and challenge generation
    • Full Authorization Code Flow with PKCE support
    • Automatic token exchange and refresh handling
    • URL parameter encoding for OAuth redirect URLs
  • Ready-to-use OAuth Providers (nextmcp/auth/oauth_providers.py):

    • GitHubOAuthProvider: GitHub OAuth with sensible defaults
      • Scopes: user:email, read:user
      • User info retrieval from GitHub API
      • Built-in error handling
    • GoogleOAuthProvider: Google OAuth with offline access support
      • Scopes: openid, email, profile
      • User info retrieval from Google API
      • Refresh token support
    • Extensible base class for custom OAuth providers
  • Session Management System (nextmcp/session/session_store.py):

    • SessionStore: Abstract base class for session storage
    • MemorySessionStore: In-memory session storage for development
    • FileSessionStore: Persistent file-based session storage
      • JSON-based session persistence
      • Automatic session cleanup
      • Configurable cleanup intervals
      • Thread-safe file operations
    • Automatic token refresh handling
    • Session expiration management
  • Auth Metadata Protocol (nextmcp/protocol/auth_metadata.py):

    • AuthMetadata: Server authentication requirement announcements
    • AuthRequirement: NONE, OPTIONAL, or REQUIRED authentication
    • AuthFlowType: API_KEY, JWT, OAUTH, or CUSTOM flows
    • Server metadata exposure for MCP hosts (Claude Desktop, Cursor, etc.)
    • Authorization and token URL configuration
    • OAuth scope declarations
  • Request Enforcement Middleware (nextmcp/auth/request_middleware.py):

    • create_auth_middleware(): Factory for auth middleware
    • Runtime token validation
    • OAuth scope verification
    • Permission and role checking
    • Automatic token refresh
    • Integration with session stores
  • Permission Manifest System (nextmcp/auth/manifest.py):

    • PermissionManifest: Declarative YAML/JSON permission definitions
    • Tool-level permission requirements
    • Scope requirements for OAuth
    • Role-based access control integration
    • Manifest validation and loading
  • Enhanced Error Handling (nextmcp/auth/errors.py):

    • OAuthError: Base OAuth error class
    • TokenExpiredError: Expired token handling
    • InvalidScopeError: Scope validation errors
    • AuthenticationFailedError: Authentication failures
    • Enhanced error context and messages

Comprehensive Documentation

  • ARCHITECTURE.md (726 lines): Deep dive into OAuth system design

    • Component architecture and data flow
    • OAuth flow diagrams
    • Session management details
    • Integration patterns
  • OAUTH_TESTING_SETUP.md (436 lines): Complete OAuth setup guide

    • GitHub OAuth app creation
    • Google OAuth app creation
    • Environment variable configuration
    • Testing workflows
  • MIGRATION_GUIDE.md (594 lines): Adding auth to existing servers

    • Step-by-step migration instructions
    • Code examples for each auth type
    • Best practices and patterns
  • HOST_INTEGRATION.md (733 lines): Guide for MCP host developers

    • Implementing OAuth support in MCP hosts
    • Auth metadata protocol usage
    • Token management strategies
    • User experience considerations
  • ENV_SETUP.md (228 lines): Environment configuration guide

    • OAuth credential setup
    • Configuration best practices
    • Security considerations

Production Examples (3,343 lines)

  • complete_oauth_server.py (347 lines): Production-ready Google OAuth

    • Session management with file storage
    • Auth metadata exposure
    • Protected and public tools
    • Comprehensive error handling
  • github_oauth_server.py (330 lines): GitHub OAuth example

    • GitHub API integration
    • Scope management
    • User profile access
  • google_oauth_server.py (394 lines): Google OAuth example

    • Google API integration
    • Calendar access example
    • Drive integration example
  • multi_provider_server.py (425 lines): Multiple providers

    • GitHub + Google in one server
    • Provider-specific tools
    • Session management
  • session_management_example.py (347 lines): Advanced session workflows

    • Session lifecycle management
    • Token refresh handling
    • Session persistence
  • combined_auth_server.py (608 lines): OAuth + RBAC

    • OAuth with permission system
    • Role-based access control
    • Scope and permission validation
  • manifest_server.py (462 lines): Permission manifests

    • YAML-based permission definitions
    • Tool-level access control
    • Manifest validation
  • oauth_token_helper.py (430 lines): Interactive OAuth testing

    • CLI tool for OAuth flow testing
    • Token generation and validation
    • API call testing

Comprehensive Testing (1,846 lines)

  • OAuth Tests (tests/test_oauth.py): 29 tests

    • PKCE challenge generation and uniqueness
    • OAuth configuration
    • Authorization URL generation
    • Token exchange (success and error cases)
    • Token refresh (success and error cases)
    • User authentication flows
    • Provider-specific implementations
  • Integration Tests (tests/test_oauth_integration.py): 11 tests

    • Real GitHub OAuth flows
    • Real Google OAuth flows
    • Live API token validation
    • User info retrieval
    • Error handling with real services
  • Session Tests (tests/test_session_store.py): 33 tests

    • Memory store operations
    • File store persistence
    • Session cleanup
    • Expiration handling
    • Thread safety
  • Auth Metadata Tests (tests/test_auth_metadata.py): 14+ tests

    • Metadata serialization
    • Protocol validation
    • Host integration
  • Middleware Tests (tests/test_request_middleware.py): 14+ tests

    • Request enforcement
    • Token validation
    • Scope checking
    • Permission validation
  • Manifest Tests (tests/test_manifest.py): 15+ tests

    • Manifest loading
    • Permission validation
    • Tool-level enforcement
  • Scope Tests (tests/test_scopes.py): 12+ tests

    • Scope validation
    • Scope matching
    • Wildcard scopes
  • Error Tests (tests/test_auth_errors.py): 8+ tests

    • Error handling
    • Error context
    • Error messages

Changed

  • Main Exports (nextmcp/__init__.py):

    • Added OAuth providers: OAuthProvider, OAuthConfig, PKCEChallenge
    • Added provider implementations: GitHubOAuthProvider, GoogleOAuthProvider
    • Added session management: SessionStore, FileSessionStore, MemorySessionStore
    • Added auth protocol: AuthMetadata, AuthRequirement, AuthFlowType
    • Added middleware: create_auth_middleware
  • Dependencies (pyproject.toml):

    • Added aiohttp>=3.8.0 as core dependency (for OAuth HTTP requests)
    • OAuth functionality included in base installation
  • README.md:

    • Added comprehensive OAuth 2.0 documentation section
    • Updated installation instructions with OAuth details
    • Added OAuth examples to examples list
    • Updated feature list with OAuth capabilities
    • Added links to OAuth documentation files
    • Updated comparison table with FastMCP

Features

Quick Start with Google OAuth

from fastmcp import FastMCP
from nextmcp.auth import GoogleOAuthProvider, create_auth_middleware
from nextmcp.session import FileSessionStore
from nextmcp.protocol import AuthRequirement, AuthMetadata, AuthFlowType

mcp = FastMCP("My Secure Server")

# Set up Google OAuth
google = GoogleOAuthProvider(
    client_id=os.getenv("GOOGLE_CLIENT_ID"),
    client_secret=os.getenv("GOOGLE_CLIENT_SECRET"),
    scopes=["openid", "email", "profile"]
)

# Create auth middleware with session storage
auth_middleware = create_auth_middleware(
    provider=google,
    requirement=AuthRequirement.REQUIRED,
    session_store=FileSessionStore("./sessions")
)

mcp.use(auth_middleware)

# Tools now require authentication
@mcp.tool()
async def get_user_data(ctx: Context) -> str:
    return f"Hello {ctx.auth.username}!"

GitHub OAuth

from nextmcp.auth import GitHubOAuthProvider

github = GitHubOAuthProvider(
    client_id=os.getenv("GITHUB_CLIENT_ID"),
    client_secret=os.getenv("GITHUB_CLIENT_SECRET"),
    scopes=["user:email", "read:user"]
)

Session Management

from nextmcp.session import FileSessionStore

# File-based session storage (persists across restarts)
file_store = FileSessionStore(
    directory="./sessions",
    auto_cleanup=True,
    cleanup_interval=3600
)

# Sessions automatically handle token refresh
auth_middleware = create_auth_middleware(
    provider=google,
    session_store=file_store,
    auto_refresh=True
)

Notes

  • 100% Backward Compatible: All 423 existing tests pass
  • 148 New Tests: Comprehensive OAuth system coverage (including 11 integration tests)
  • 571 Total Tests: All passing
  • Production Ready: Battle-tested with real OAuth providers
  • 5,628 Lines Added: 2,853 lines of framework, 1,846 lines of tests, 3,343 lines of examples
  • Comprehensive Docs: 2,717 lines of documentation across 5 files

Code Statistics

  • New Modules: 7 core modules, 8 example servers, 8 test suites
  • Test Coverage: 148 new tests covering all OAuth flows
  • Documentation: 2,717 lines across ARCHITECTURE.md, OAUTH_TESTING_SETUP.md, MIGRATION_GUIDE.md, HOST_INTEGRATION.md, ENV_SETUP.md
  • Examples: 8 production-ready example servers with 3,343 lines of code

Breaking Changes

None - all changes are additive and backward compatible with v0.5.0

[0.5.0] - 2025-11-04

Added

Production Deployment System

  • Health Check System (nextmcp/deployment/health.py):

    • HealthCheck class for monitoring application health
    • Liveness checks (is the app running?)
    • Readiness checks (is the app ready to serve traffic?)
    • Support for custom health checks
    • Status types: Healthy, Unhealthy, Degraded
    • Automatic duration measurement for checks
    • Integration-ready for Kubernetes/Docker health probes
  • Graceful Shutdown (nextmcp/deployment/lifecycle.py):

    • GracefulShutdown class for clean application termination
    • SIGTERM and SIGINT signal handling
    • Cleanup handler registration
    • Configurable shutdown timeout
    • Async and sync cleanup handler support
    • Prevents data loss during deployment
  • Template System (nextmcp/deployment/templates.py):

    • TemplateRenderer for deployment configuration generation
    • Jinja2-like template syntax
    • Variable substitution with defaults: {{ var | default("value") }}
    • Conditional blocks: {% if condition %} ... {% endif %}
    • Auto-detection of project configuration
    • Template variable extraction
  • Docker Templates (nextmcp/templates/docker/):

    • Dockerfile.template: Multi-stage optimized build
      • Python 3.10 slim base image
      • Non-root user (UID 1000)
      • Built-in health check
      • Minimal image size (<100MB)
    • docker-compose.yml.template: Complete local dev environment
      • Optional PostgreSQL integration
      • Optional Redis integration
      • Volume management
      • Health checks for all services
    • .dockerignore.template: Optimized for minimal context

Enhanced CLI Commands

  • mcp init --docker: Generate Docker deployment files

    • Auto-detects app configuration
    • --with-database: Include PostgreSQL
    • --with-redis: Include Redis
    • --port: Custom port configuration
    • Creates Dockerfile, docker-compose.yml, .dockerignore
  • mcp deploy: One-command deployment

    • Platform auto-detection (Docker, Railway, Render, Fly.io)
    • --platform: Specify deployment target
    • --build/--no-build: Control build behavior
    • Validates platform CLI availability
    • Provides deployment status and next steps

Examples

  • Simple Deployment (examples/deployment_simple/):

    • Basic health checks
    • Graceful shutdown
    • Production logging
    • Docker deployment ready
    • Comprehensive README with tutorials
  • Docker Deployment (examples/deployment_docker/):

    • Complete production example
    • Database integration with health checks
    • Metrics collection
    • Advanced health checks (disk space, database)
    • Multi-service Docker Compose
    • Environment configuration
    • Production best practices

Tests

  • Health Check Tests (tests/test_deployment_health.py): 21 tests

    • HealthCheckResult creation and defaults
    • Liveness and readiness checks
    • Multiple check handling
    • Error handling in checks
    • Status aggregation (healthy/unhealthy/degraded)
    • Duration measurement
  • Lifecycle Tests (tests/test_deployment_lifecycle.py): 15 tests

    • Graceful shutdown initialization
    • Signal handler registration/unregistration
    • Async and sync cleanup handlers
    • Cleanup handler ordering
    • Error handling in cleanup
    • Shutdown state management
  • Template Tests (tests/test_deployment_templates.py): 30 tests

    • Variable substitution
    • Default values
    • Conditional rendering
    • Dockerfile rendering
    • docker-compose rendering with options
    • Auto-detection of project configuration
    • Template variable extraction

Changed

  • CLI (nextmcp/cli.py):

    • Enhanced init command with Docker support
    • Made project name optional for Docker-only generation
    • Added deployment platform detection
  • Main Exports (nextmcp/__init__.py):

    • Will be updated to export deployment utilities

Features

Deployment Workflow

# Initialize project with Docker
cd my-mcp-project
mcp init --docker --with-database

# Deploy to Docker
mcp deploy --platform docker

# Or deploy to cloud platforms
mcp deploy --platform railway
mcp deploy --platform fly

Health Checks

from nextmcp import NextMCP
from nextmcp.deployment import HealthCheck

app = NextMCP("my-app")
health = HealthCheck()

# Add custom readiness check
def check_database():
    return db.is_connected()

health.add_readiness_check("database", check_database)

Graceful Shutdown

from nextmcp.deployment import GracefulShutdown

shutdown = GracefulShutdown(timeout=30.0)

def cleanup():
    db.close()

shutdown.add_cleanup_handler(cleanup)
shutdown.register()

Notes

  • 100% Backward Compatible: All 297 existing tests pass
  • 66 New Tests: Complete deployment system coverage
  • 363 Total Tests: All passing
  • Production Ready: Battle-tested deployment patterns
  • Multiple Platforms: Docker, Railway, Render, Fly.io support
  • Kubernetes Ready: Health checks compatible with K8s probes

Platform Support

Platform Status CLI Required Testing Notes
Docker ✅ Full docker, docker compose ✅ Automated CI Fully tested, production-ready
Kubernetes ✅ Ready kubectl ✅ Manifests validated Health checks tested
Railway 🧪 Beta railway ⚠️ Manual only CLI integration, needs testing
Render 🧪 Beta render ⚠️ Manual only CLI integration, needs testing
Fly.io 🧪 Beta flyctl ⚠️ Manual only CLI integration, needs testing

Testing Status: Cloud platform deployments (Railway, Render, Fly.io) use their respective CLI tools. We test that commands are invoked correctly, but full platform integration requires manual verification. Community testing and feedback welcome!

[0.4.0] - 2025-11-04

Added

Authentication & Authorization System

  • Complete Auth Framework (nextmcp/auth/): Production-ready authentication and authorization

    • AuthContext: Authentication context with user info, roles, and permissions
    • AuthProvider: Base class for authentication strategies
    • AuthResult: Authentication result with success/failure and context
    • Permission: Fine-grained permission model with wildcard support
    • Role: Role class with permission collections
  • Built-in Auth Providers:

    • APIKeyProvider: API key authentication with role/permission mapping
      • Pre-configured key validation
      • Custom validation function support
      • Secure key generation utility
    • JWTProvider: JSON Web Token authentication
      • HS256/RS256 algorithm support
      • Automatic expiration validation
      • Token creation and verification
      • Requires PyJWT library
    • SessionProvider: Session-based authentication
      • In-memory session storage
      • Automatic session expiration
      • Session creation and destruction
      • Expired session cleanup
  • RBAC System (nextmcp/auth/rbac.py):

    • RBAC class for role and permission management
    • Define custom permissions and roles
    • Assign permissions to roles
    • Check and require permissions/roles
    • Load configuration from dictionaries
    • Export configuration to dictionaries
    • PermissionDeniedError exception
  • Auth Middleware Decorators:

    • @requires_auth / @requires_auth_async: Require authentication
    • @requires_role / @requires_role_async: Require specific roles
    • @requires_permission / @requires_permission_async: Require specific permissions
    • Auth context injected as first parameter to protected tools
    • Supports middleware stacking
  • Permission Features:

    • Exact permission matching (read:posts)
    • Wildcard permissions (admin:*, *)
    • Resource-scoped permissions
    • Permission inheritance through roles

Examples

  • API Key Auth Example (examples/auth_api_key/):

    • 3 pre-configured API keys (admin, user, viewer)
    • Role-based access control demonstration
    • Public and protected tools
    • Comprehensive README
  • JWT Auth Example (examples/auth_jwt/):

    • Login endpoint with JWT token generation
    • Token expiration handling
    • Token generation utility script
    • Role-based access demonstration
  • RBAC Example (examples/auth_rbac/):

    • Fine-grained permission control
    • Permission wildcards demonstration
    • RBAC configuration loading
    • Permission-based access control

Tests

  • Auth Provider Tests (tests/test_auth_providers.py): 26 tests

    • APIKeyProvider: initialization, authentication, validation, key generation
    • JWTProvider: token creation, verification, expiration, custom claims
    • SessionProvider: session management, expiration, cleanup
  • RBAC Tests (tests/test_rbac.py): 36 tests

    • Permission: creation, matching, wildcards, hashing
    • Role: creation, permission management
    • AuthContext: role and permission checking
    • RBAC: configuration loading, permission checking, access control
    • PermissionDeniedError

Changed

  • Main Exports (nextmcp/__init__.py):
    • Added all auth classes and functions to public API
    • 15 new authentication-related exports

Notes

  • 100% Backward Compatible: All 235 existing tests pass
  • 62 New Tests: Comprehensive auth system coverage
  • 297 Total Tests: All passing
  • Optional Dependency: PyJWT required only for JWT provider

[0.3.0] - 2025-11-04

Added

Convention-Based Project Structure

  • Auto-Discovery Engine (nextmcp/discovery.py): Automatically discover and register tools, prompts, and resources from directory structure

    • AutoDiscovery class for scanning directories
    • Discovers tools from tools/ directory
    • Discovers prompts from prompts/ directory
    • Discovers resources from resources/ directory
    • Supports nested directory structures
    • Skips __init__.py and test_*.py files automatically
  • NextMCP.from_config(): Create applications with convention-based structure

    • Load configuration from nextmcp.config.yaml
    • Auto-discover all primitives from standard directories
    • Zero-boilerplate server setup
    • Configurable discovery paths
    • Can be disabled with auto_discover: false
  • Configuration System Enhancements:

    • Support for nextmcp.config.yaml configuration files
    • Project manifest with metadata (name, version, description)
    • Discovery path configuration
    • Server settings (host, port, transport)
    • Middleware configuration
    • Feature flags (metrics, hot_reload, auto_docs)
  • Project Validation:

    • validate_project_structure() function
    • Validates convention-based directory structure
    • Counts Python files in each directory
    • Warns about missing __init__.py files
    • Checks for config file presence

Examples

  • Blog Server Example (examples/blog_server/): Complete convention-based example
    • 5 Tools in tools/posts.py
    • 3 Prompts in prompts/workflows.py
    • 4 Resources in resources/blog_resources.py
    • nextmcp.config.yaml configuration file
    • Single-line server setup with NextMCP.from_config()
    • Comprehensive README with comparison to manual approach

Testing

  • 26 new comprehensive tests for auto-discovery (245 total, all passing)
  • tests/test_discovery.py: 19 tests for discovery engine
  • tests/test_integration_discovery.py: 7 integration tests for from_config()
  • Full coverage of:
    • Auto-discovery functionality
    • Config file loading
    • Nested module discovery
    • Error handling
    • Project validation
    • Integration with real project structures

Changed

  • Updated minimum test count from 228 to 235 tests
  • Enhanced Config class with convention-based defaults
  • Improved import handling in discovery engine to avoid conflicts

Technical Details

  • Convention-based structure similar to Next.js
  • Automatic primitive registration eliminates boilerplate
  • File-based organization for scalability
  • Works with or without configuration files
  • All changes are additive - fully backward compatible with v0.2.x

Key Differentiators from FastMCP

  • Organization: Single file → Convention-based directories with auto-discovery
  • Configuration: Imperative Python → Declarative YAML + conventions
  • Project Structure: Unstructured → Organized (tools/, prompts/, resources/)
  • Setup: Manual registration → One-line NextMCP.from_config()
  • Modularity: All in one file → Organized by primitive type
  • Discoverability: Must import/register → Auto-discovery from directories

Breaking Changes

None - all changes are additive and backward compatible with v0.2.x

[0.2.1] - 2025-11-04

Added

Examples

  • Knowledge Base Example (examples/knowledge_base/): Comprehensive example demonstrating all three MCP primitives working together
    • 3 Tools: search_knowledge, add_article, list_categories
    • 3 Prompts: research_prompt, summary_report_prompt, document_prompt
    • 4 Resources: stats, config, articles/{id}, category/{name}
    • Shows practical usage of tools, prompts, and resources in a real application
    • Includes argument/parameter completion examples
    • Demonstrates subscribable resources

Documentation

  • Added comprehensive Prompts section to README

    • Basic prompts with examples
    • Prompts with argument completion
    • Dynamic completion functions
    • Async prompts
    • When to use prompts
  • Added comprehensive Resources section to README

    • Direct resources with examples
    • Resource templates with parameters
    • Subscribable resources with notifications
    • Async resources
    • URI schemes and conventions
    • When to use resources
  • Updated features list to highlight:

    • Full MCP specification support
    • Argument completion
    • Resource subscriptions
    • Cross-primitive middleware

Changed

  • Enhanced feature descriptions to emphasize all three primitives

[0.2.0] - 2025-11-04

Added

Full MCP Primitives Support

  • Prompts: User-driven workflow templates with argument completion

    • @app.prompt() decorator for registering prompts
    • @argument() decorator for defining prompt arguments with suggestions
    • @app.prompt_completion() for dynamic argument suggestions
    • Automatic metadata extraction from function signatures
    • Full async/await support for prompts
    • Middleware support for prompts
  • Resources: Read-only context providers with URI-based access

    • @app.resource() decorator for direct resources
    • @app.resource_template() decorator for parameterized resources
    • URI validation and parameter extraction
    • MIME type auto-detection
    • Full async/await support for resources
    • Middleware support for resources
  • Resource Subscriptions: Real-time notifications for resource changes

    • subscribe_to_resource() method for subscribing to changes
    • unsubscribe_from_resource() method for unsubscribing
    • notify_resource_changed() method for triggering notifications
    • Subscriber limit enforcement with FIFO ordering
    • Per-resource subscription tracking

New Modules

  • nextmcp/prompts.py: Complete prompt management system

    • PromptArgument class for argument metadata
    • PromptRegistry for organizing prompts
    • get_prompt_metadata() for metadata extraction
    • generate_prompt_docs() for documentation generation
  • nextmcp/resources.py: Complete resource management system

    • ResourceMetadata class for resource information
    • ResourceTemplate class for URI templates
    • ResourceRegistry for organizing resources
    • get_resource_metadata() for metadata extraction
    • generate_resource_docs() for documentation generation

Testing

  • 75 new comprehensive tests (209 total, all passing)
  • tests/test_prompts.py: 31 tests for prompt functionality
  • tests/test_resources.py: 44 tests for resource functionality
  • Full coverage of new features including:
    • Decorator functionality
    • Metadata extraction
    • Registry operations
    • Subscription management
    • Async operations
    • NextMCP integration

Changed

  • Updated Python version requirement to 3.10+ (from 3.8+)
  • Modernized type annotations to use built-in types (e.g., list[str] instead of List[str])
  • Resource subscriptions now use list (FIFO) instead of set for proper ordering

Technical Details

  • NextMCP now supports all three MCP core primitives: Tools, Prompts, and Resources
  • Complete implementation of the Model Context Protocol specification
  • Maintains decorator-based API consistency across all primitives
  • All primitives support middleware and async operations
  • FastMCP integration for prompts and resources

Breaking Changes

None - all changes are additive and backward compatible with v0.1.0

0.1.0 - 2025-11-03

Added

Core Features

  • Initial release of NextMCP - Production-grade MCP server toolkit
  • Decorator-based tool registration with @app.tool()
  • Full async/await support for asynchronous tools
  • Global and tool-specific middleware system
  • Plugin architecture for extensibility

Middleware

  • log_calls - Automatic logging of tool invocations
  • error_handler - Structured error handling and responses
  • require_auth - API key authentication
  • rate_limit - Rate limiting per tool
  • validate_inputs - Input validation middleware
  • cache_results - Response caching
  • timeout - Execution timeout enforcement
  • Async versions of all middleware

Transport

  • WebSocket transport for real-time bidirectional communication
  • WebSocket client for connecting to remote MCP servers
  • Message serialization and deserialization
  • Tool invocation over WebSocket

Metrics & Monitoring

  • Complete metrics collection system
  • Counter, Gauge, Histogram, and Summary metric types
  • Prometheus exporter for metrics
  • JSON exporter for metrics
  • Automatic tool invocation tracking
  • Duration and error metrics
  • Metrics middleware for transparent collection

Configuration

  • Multi-source configuration management
  • Support for .env files
  • Support for YAML configuration files
  • Environment variable overrides
  • Hierarchical configuration with defaults

CLI Tools

  • mcp init - Scaffold new projects from templates
  • mcp run - Run MCP servers
  • mcp docs - Generate documentation
  • mcp version - Show version information
  • Rich terminal output with syntax highlighting

Development Tools

  • Comprehensive logging system with context support
  • Tool metadata and documentation generation
  • Plugin discovery and management
  • Type hints and Pydantic integration support

Examples

  • Weather Bot - Basic MCP server example
  • Async Weather Bot - Asynchronous operations example
  • WebSocket Chat - Real-time communication example
  • Plugin Example - Custom plugin implementation
  • Metrics Example - Monitoring and metrics collection

Testing

  • 134 comprehensive tests covering all features
  • Unit tests for core functionality
  • Integration tests for middleware and plugins
  • Async test support
  • 100% of critical paths tested

Documentation

  • Comprehensive README with examples
  • API documentation in docstrings
  • Example projects with detailed READMEs
  • Configuration guides
  • Middleware usage examples

Technical Details

  • Python 3.8+ support
  • Built on top of FastMCP
  • Type-safe with full type hints
  • Production-ready error handling
  • Thread-safe metrics collection
  • Modular architecture with optional dependencies

Package Structure

  • Core package: nextmcp
  • Optional dependencies for CLI, config, WebSocket, and schema validation
  • Extensible plugin system
  • Clean separation of concerns

Known Limitations

  • Authentication system is basic (enhanced auth planned for v0.2.0)
  • Metrics are in-memory only (persistent storage planned for future release)
  • No built-in OAuth support yet (planned for v0.2.0)

Upcoming Features (Roadmap)

v0.2.0 (Planned)

  • Advanced authentication system with secrets management
  • OAuth 2.0 support
  • Pre-built API clients (GitHub, Stripe, Slack)
  • Persistent metrics storage
  • Enhanced error handling
  • More example integrations

v0.3.0 (Future)

  • Distributed tracing
  • Health check endpoints
  • API versioning support
  • GraphQL transport option
  • Enhanced documentation site