-
Notifications
You must be signed in to change notification settings - Fork 231
Add detailed logs from the MCP Server #778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enables detailed MCP Server logging for live test visibility by adding comprehensive logging configuration options. The changes allow tests to capture logs through both verbose stderr output and file-based logging without requiring additional debugging tools.
Key changes:
- Added configurable logging levels and verbose mode through command line options and environment variables
- Implemented file-based logging with placeholder support for timestamps and process IDs
- Enhanced logging configuration for both STDIO and HTTP server modes
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
SimpleFileLoggerProvider.cs | New lightweight file logger implementation for structured log output |
ServiceStartOptions.cs | Added logging configuration properties (LogLevel, Verbose, LogFile) |
ServiceOptionDefinitions.cs | Defined new command line options for logging controls |
ServiceStartCommand.cs | Integrated logging options with environment variable support and enhanced logging setup |
Comments suppressed due to low confidence (1)
core/Azure.Mcp.Core/src/Services/Logging/SimpleFileLoggerProvider.cs:1
- The Verbose option should be of type Option instead of Option<string?> since it represents a boolean flag. The DefaultValueFactory should return a boolean value false instead of the string "false".
// Copyright (c) Microsoft Corporation.
core/Azure.Mcp.Core/src/Areas/Server/Commands/ServiceStartCommand.cs
Outdated
Show resolved
Hide resolved
core/Azure.Mcp.Core/src/Services/Logging/SimpleFileLoggerProvider.cs
Outdated
Show resolved
Hide resolved
84b2be2
to
dffbee1
Compare
What does this PR do?
Enable detailed MCP Server logging for live test visibility.
This change allows tests to capture and attach detailed logs without requiring tools like PerfView or dotnet-trace.
Two mechanisms are now supported:
Verbose logging on STDERR – activated via --verbose, or environment variables (AZMCP_LOG_LEVEL, AZMCP_VERBOSE), allowing the test harness to stream logs in real time.
File-based logging – activated via --log-file or AZMCP_LOG_FILE, which writes logs to a specified file for test attachment.
Adds a lightweight SimpleFileLoggerProvider for writing structured logs to disk.
Improves debuggability and reduces friction during live test runs by making server logs directly accessible through the test harness.
GitHub issue number?
#142
Pre-merge Checklist
servers/Azure.Mcp.Server/CHANGELOG.md
and/orservers/Fabric.Mcp.Server/CHANGELOG.md
for product changes (features, bug fixes, UI/UX, updated dependencies
)