Add configure_logging opt-out to MCPServer (#1656)

Closed
GE
2mo ago
+42-3

Fixes #1656

MCPServer.__init__ unconditionally calls logging.basicConfig().
This is fine for quick scripts, but for applications that embed
MCPServer as a library, it means:

  • If the app hasn't configured its own logging yet when the server is
    created, the server's config wins the race, and any later
    logging.basicConfig() call by the app becomes a silent no-op
    (per stdlib's own basicConfig contract).

This adds configure_logging: bool = True to MCPServer.__init__.
Default behavior is fully unchanged; embedding applications can pass
configure_logging=False to keep complete control of their own
logging setup.

Added tests covering both the default (no regression) and the new
opt-out behavior.