What
Add a --log-level CLI flag to control logging verbosity. Currently the log level is hardcoded to INFO on line 23 of server.py:
logging.basicConfig(level=logging.INFO, stream=sys.stderr)
Why
When troubleshooting connection issues or debugging tool behavior, users need DEBUG level logging to see:
- Which RPC backend was selected (local node vs Satoshi API)
- Individual RPC call details
- Response timing
Currently there is no way to enable debug output without editing the source code.
Implementation
In the main() function (line ~1864 of server.py):
parser.add_argument(
"--log-level",
choices=["DEBUG", "INFO", "WARNING", "ERROR"],
default="INFO",
help="Logging verbosity (default: INFO)",
)
args = parser.parse_args()
logging.basicConfig(level=getattr(logging, args.log_level), stream=sys.stderr)
Move the logging.basicConfig call from the module level into main() so it respects the flag.
Where to look
src/bitcoin_mcp/server.py — line 23 (current logging.basicConfig) and main() function at the bottom
tests/test_server.py — TestCLI class for test patterns
Acceptance criteria
What
Add a
--log-levelCLI flag to control logging verbosity. Currently the log level is hardcoded toINFOon line 23 ofserver.py:Why
When troubleshooting connection issues or debugging tool behavior, users need
DEBUGlevel logging to see:Currently there is no way to enable debug output without editing the source code.
Implementation
In the
main()function (line ~1864 ofserver.py):Move the
logging.basicConfigcall from the module level intomain()so it respects the flag.Where to look
src/bitcoin_mcp/server.py— line 23 (currentlogging.basicConfig) andmain()function at the bottomtests/test_server.py—TestCLIclass for test patternsAcceptance criteria
bitcoin-mcp --log-level DEBUGproduces debug output on stderrbitcoin-mcpwith no flag defaults to INFO (no breaking change)bitcoin-mcp --log-level WARNINGsuppresses info messageslogging.basicConfigremoved or guarded