Low level MCP server now uses FastMCP log level #1485
Low level MCP server now uses FastMCP log level #1485daamitt wants to merge 2 commits intomodelcontextprotocol:mainfrom
Conversation
…erver", debug=True, log_level='DEBUG')
felixweinberger
left a comment
There was a problem hiding this comment.
Hi @daamitt thank you for this contribution!
Could you add a small test in tests/server/fastmcp/test_server.py that demonstrates the new logging behavior?
The description suggests this is a bugfix and that FastMCP wasn't receiving the logging level information before. It'd be great to have a regression test for this to prevent this in future.
|
I'd also appreciate some testing evidence showing how it wasn't working before the fix, and how it is working now after the fix (along side the unit tests requested by @felixweinberger ) |
|
Not sure if this can be captured by a test case, its a very small change that only affects the low level server logs (which i found very useful to track down a race condition Merged PR) Here is the before and after of this fix using BeforeAfter |
There are already tests in there that assert on logging - you could take inspiration from those for example? python-sdk/tests/server/fastmcp/test_server.py Lines 972 to 973 in b8e758b |
Low level MCP server now uses log level set by FastMCP(name="My MCP Server", debug=True, log_level='DEBUG')
Motivation and Context
When logging level is set in code at the FastMCP server, this change percolates it to the low lever server by configuring the logging before low level server init.
How Has This Been Tested?
uv run pytest :
Results (18.58s):
653 passed
2 skipped
1 xfailed
Breaking Changes
No
Types of changes
Checklist
Additional context