-
Notifications
You must be signed in to change notification settings - Fork 340
Add dart.mcpServerLogFile setting for MCP server logging #5577
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
Conversation
Co-authored-by: DanTup <1078012+DanTup@users.noreply.github.com>
package.json
Outdated
| "description": "Whether to register the Dart SDK's MCP server with VS Code. This only applies to Dart SDKs >= v3.9.0 which added the server.", | ||
| "scope": "window" | ||
| }, | ||
| "dart.mcpServerLogFile": { |
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.
We should add this new setting in the "Logging" section rather than the "SDK" section.
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.
Moved the setting to the Logging section in commit dd1662e.
| if (config.mcpServerLogFile) | ||
| args.push(`--log-file=${config.mcpServerLogFile}`); |
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.
Push the flag name and the value as two different values in the args array.
Also, we need to ensure that we are using at least Dart 3.9.0-303 so add a new field for whether this is supported to DartCapabilities and check it here.
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.
Updated to push flag and value separately, and added version check for 3.9.0-303 in DartCapabilities in commit dd1662e.
| if (this.dartCapabilities.mcpServerRequiresExperimentalFlag) | ||
| args.push("--experimental-mcp-server"); |
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.
This experimental flag is not required since 3.9.0-293 so update mcpServerRequiresExperimentalFlag to only provide this for versions up until then.
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.
Updated mcpServerRequiresExperimentalFlag to only return true for versions before 3.9.0-293 in commit dd1662e.
…, add version checks Co-authored-by: DanTup <1078012+DanTup@users.noreply.github.com>
DanTup
left a comment
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.
There is a lint failure:
/home/runner/work/Dart-Code/Dart-Code/src/extension/providers/mcp_server_definition_provider.ts
Error: 38:1 error Trailing spaces not allowed no-trailing-spaces
✖ 1 problem (1 error, 0 warnings)
1 error and 0 warnings potentially fixable with the `--fix` option.
Co-authored-by: DanTup <1078012+DanTup@users.noreply.github.com>
... Fixed the trailing spaces lint error in commit a5b3c8d. |
|
|
Address PR feedback: move setting to Logging section, fix args format, add version checks Co-authored-by: DanTup 1078012+DanTup@users.noreply.github.com |
This PR adds support for configuring a log file for the Dart SDK's MCP server through a new
dart.mcpServerLogFilesetting.Changes Made
1. Configuration Setting
dart.mcpServerLogFilesetting inpackage.jsonwith:["null", "string"](optional string setting)nullmachine-overridable2. Config Implementation
mcpServerLogFilegetter inconfig.tsfollowing the same pattern as other log file settingscreateFolderForFile(insertWorkspaceName(resolvePaths(...)))for proper path resolution with workspace name substitution3. MCP Server Provider Updates
DartMcpServerDefinitionProviderto conditionally add--log-file=${config.mcpServerLogFile}argument when the setting is configureddart.mcpServerLogFileto the configuration change listener so VS Code updates the MCP server definition when the log file setting changesUsage Example
Users can now configure MCP server logging by setting:
{ "dart.mcpServerLogFile": "~/logs/mcp-server-${workspaceName}.log" }This will result in the MCP server being launched with:
Implementation Notes
--log-fileflag when the setting is actually configured (not null/empty)Fixes #5556.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.