[0.4.0] - 2026-01-03
Phase 3: Production Readiness COMPLETE - All 4 sub-phases finished, project is production-ready
Added
- Phase 3.4 Documentation COMPLETE - Comprehensive documentation (4,893 lines across 5 guides)
docs/API.md(1,029 lines) - Complete API reference for all 11 tools and 5 MCP resourcesdocs/CONFIGURATION.md(778 lines) - Configuration guide (CLI, TOML, env vars) with deployment examplesdocs/TROUBLESHOOTING.md(1,188 lines) - 30+ common issues with step-by-step solutionsdocs/EXAMPLES.md(952 lines) - 40+ use cases with code examples (schema discovery, data exploration, performance analysis)docs/DEVELOPMENT.md(946 lines) - Developer guide (architecture, testing patterns, contribution workflow)- Updated README.md with enhanced features list, tools table (11 tools), and documentation links
- Phase 3.3 Error Handling COMPLETE - Robust error handling with retry logic
src/mssql_mcp_server/errors.py- 5 typed exception classes (55 lines, 98.18% coverage)ConnectionError- Database connection failuresQueryError- SQL execution errorsSecurityError- Blocked dangerous queriesValidationError- Invalid input parametersTimeoutError- Query timeout exceeded
format_error_response()- Consistent JSON error format with error codes and detailsis_transient_error()- Detects retryable errors (connection failures, timeouts, deadlocks)retry_with_backoff()- Exponential backoff retry logic (configurable max_retries, retry_delay)@handle_tool_errorsdecorator applied to all 11 tools for consistent error handling- Extended config.py with error handling parameters (query_timeout, max_retries, retry_delay)
- Updated config.example.toml with error handling configuration examples
tests/test_errors.py- 20 comprehensive error handling tests- Test Results: 193 tests passing (up from 173), 83.36% coverage (up from 79.83%)
- Phase 3.2 Configuration Improvements COMPLETE - Professional configuration management system
- CLI argument support (
--server,--database,--driver,--connection-timeout,--query-timeout,--max-retries,--retry-delay) - TOML configuration file support via
--configflag with example config file (config.example.toml) - Configuration priority system: CLI args > Config file > Environment variables > Defaults
- Startup health check with database connection validation and helpful error messages
--validate-onlyflag for configuration testing without starting server- New modules:
src/mssql_mcp_server/config.py- ServerConfig class, TOML loading, CLI parsing, validation (95 lines, 90.98% coverage)src/mssql_mcp_server/health.py- Database health checks with specific error detection (48 lines, 100% coverage)
- Comprehensive test coverage:
tests/test_config.py- 31 tests for configuration management (validation, env vars, TOML files, CLI args, priority)tests/test_health.py- 12 tests for health checks (connection success, timeout, login failures, driver errors)
- Test Results: 173 tests passing (up from 130), 79.83% coverage (up from 77.07%)
- Backward compatibility maintained with environment variables (MSSQL_SERVER, MSSQL_DATABASE, ODBC_DRIVER, MSSQL_CONNECTION_TIMEOUT)
- CLI argument support (
- Phase 3.1 Testing Infrastructure COMPLETE - Comprehensive test suite with 77% coverage
tests/conftest.pywith mock pyodbc fixtures (MockRow, mock_cursor, mock_connection)- Sample data fixtures for all 11 tools (tables, columns, indexes, constraints, procedures, functions, triggers, FKs)
- Integration tests in
tests/test_integration.py(8 test classes, 14 integration tests) - Resource endpoint tests in
tests/test_resources.py(5 test classes, 10 tests for all MCP resources) - Async behavior tests in
tests/test_async.py(4 test classes, 11 tests for concurrency and thread safety) - Enhanced security filtering edge case tests (11 additional tests)
- Test Results: 130 tests passing (up from 88), 77.07% coverage (up from 13.80%)
Changed
- Server now loads configuration on startup via
load_config()with CLI argument support main()function performs health check before starting servercreate_connection()uses global config when available, falling back to legacy environment variables- All 11 tools wrapped with
@handle_tool_errorsdecorator for consistent error handling - CLI args now use
is not Nonechecks to allow empty string values (important for validation testing) - Dependencies: Added
tomli>=2.0.0for TOML config file support (Python <3.11; stdlib tomllib used for 3.11+) - Coverage threshold increased to 15% (from 13%) due to comprehensive test suite
- README.md significantly enhanced with features list, tools table, documentation section
Fixed
- PEP 257 docstring compliance issues (imperative mood) in server.py and test_errors.py
- Type annotation issues in handle_tool_errors decorator (explicit str() cast)
- Unpacking error in lifespan context manager (now unpacks all 7 config values)