feat: Add comprehensive dynamic configuration system v3.3.0
## Major Features Added ### 🎯 Dynamic Configuration System - **Environment-aware model selection**: DEFAULT_MODEL with 'pro'/'flash' shortcuts - **Configurable thinking modes**: DEFAULT_THINKING_MODE_THINKDEEP for extended reasoning - **All tool schemas now dynamic**: Show actual current defaults instead of hardcoded values - **Enhanced setup workflow**: Copy from .env.example with smart customization ### 🔧 Model & Thinking Configuration - **Smart model resolution**: Support both shortcuts ('pro', 'flash') and full model names - **Thinking mode optimization**: Only apply thinking budget to models that support it - **Flash model compatibility**: Works without thinking config, still beneficial via system prompts - **Dynamic schema descriptions**: Tool parameters show current environment values ### 🚀 Enhanced Developer Experience - **Fail-fast Docker setup**: GEMINI_API_KEY required upfront in docker-compose - **Comprehensive startup logging**: Shows current model and thinking mode defaults - **Enhanced get_version tool**: Reports all dynamic configuration values - **Better .env documentation**: Clear token consumption details and model options ### 🧪 Comprehensive Testing - **Live model validation**: New simulator test validates Pro vs Flash thinking behavior - **Dynamic configuration tests**: Verify environment variable overrides work correctly - **Complete test coverage**: All 139 unit tests pass, including new model config tests ### 📋 Configuration Files Updated - **docker-compose.yml**: Fail-fast API key validation, thinking mode support - **setup-docker.sh**: Copy from .env.example instead of manual creation - **.env.example**: Detailed documentation with token consumption per thinking mode - **.gitignore**: Added test-setup/ for cleanup ### 🛠 Technical Improvements - **Removed setup.py**: Fully Docker-based deployment (no longer needed) - **REDIS_URL smart defaults**: Auto-configured for Docker, still configurable for dev - **All tools updated**: Consistent dynamic model parameter descriptions - **Enhanced error handling**: Better model resolution and validation ## Breaking Changes - Removed setup.py (Docker-only deployment) - Model parameter descriptions now show actual defaults (dynamic) ## Migration Guide - Update .env files using new .env.example format - Use 'pro'/'flash' shortcuts or full model names - Set DEFAULT_THINKING_MODE_THINKDEEP for custom thinking depth 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
19
server.py
19
server.py
@@ -32,7 +32,7 @@ from mcp.server.stdio import stdio_server
|
||||
from mcp.types import ServerCapabilities, TextContent, Tool, ToolsCapability
|
||||
|
||||
from config import (
|
||||
GEMINI_MODEL,
|
||||
DEFAULT_MODEL,
|
||||
MAX_CONTEXT_TOKENS,
|
||||
__author__,
|
||||
__updated__,
|
||||
@@ -435,12 +435,16 @@ async def handle_get_version() -> list[TextContent]:
|
||||
Returns:
|
||||
Formatted text with version and configuration details
|
||||
"""
|
||||
# Import thinking mode here to avoid circular imports
|
||||
from config import DEFAULT_THINKING_MODE_THINKDEEP
|
||||
|
||||
# Gather comprehensive server information
|
||||
version_info = {
|
||||
"version": __version__,
|
||||
"updated": __updated__,
|
||||
"author": __author__,
|
||||
"gemini_model": GEMINI_MODEL,
|
||||
"default_model": DEFAULT_MODEL,
|
||||
"default_thinking_mode_thinkdeep": DEFAULT_THINKING_MODE_THINKDEEP,
|
||||
"max_context_tokens": f"{MAX_CONTEXT_TOKENS:,}",
|
||||
"python_version": f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}",
|
||||
"server_started": datetime.now().isoformat(),
|
||||
@@ -453,7 +457,8 @@ Updated: {__updated__}
|
||||
Author: {__author__}
|
||||
|
||||
Configuration:
|
||||
- Gemini Model: {GEMINI_MODEL}
|
||||
- Default Model: {DEFAULT_MODEL}
|
||||
- Default Thinking Mode (ThinkDeep): {DEFAULT_THINKING_MODE_THINKDEEP}
|
||||
- Max Context: {MAX_CONTEXT_TOKENS:,} tokens
|
||||
- Python: {version_info["python_version"]}
|
||||
- Started: {version_info["server_started"]}
|
||||
@@ -486,7 +491,13 @@ async def main():
|
||||
# Log startup message for Docker log monitoring
|
||||
logger.info("Gemini MCP Server starting up...")
|
||||
logger.info(f"Log level: {log_level}")
|
||||
logger.info(f"Using model: {GEMINI_MODEL}")
|
||||
logger.info(f"Using default model: {DEFAULT_MODEL}")
|
||||
|
||||
# Import here to avoid circular imports
|
||||
from config import DEFAULT_THINKING_MODE_THINKDEEP
|
||||
|
||||
logger.info(f"Default thinking mode (ThinkDeep): {DEFAULT_THINKING_MODE_THINKDEEP}")
|
||||
|
||||
logger.info(f"Available tools: {list(TOOLS.keys())}")
|
||||
logger.info("Server ready - waiting for tool requests...")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user