ollama/examples
code4me2 c747bedbfa server: add declarative auto-enable for MCP servers
Add configuration-driven auto-enable system allowing MCP servers to
declare when they should activate based on context.

MCPDefinitions (server/mcp_definitions.go):
- Static server configuration from config files
- AutoEnableMode: never, always, with_path, if_match
- EnableCondition: file_exists, env_set conditions
- Config loading: ~/.ollama/, /etc/ollama/, OLLAMA_MCP_SERVERS

MCPSessionManager (server/mcp_sessions.go):
- Runtime session tracking with TTL
- Session pooling for API requests

CommandResolver (server/mcp_command_resolver.go):
- CommandResolverInterface for dependency injection
- DefaultCommandResolver singleton for production use

Public API (server/mcp.go):
- GetMCPServersForTools(): CLI tool resolution
- GetMCPManager(): Session-based manager access
- ListMCPServers(): Server discovery

Relates to #7865
2025-12-28 15:06:47 -08:00
..
mcp-servers.json server: add declarative auto-enable for MCP servers 2025-12-28 15:06:47 -08:00