[experimental] Add support for advertising the Dart SDK MCP server#5551
[experimental] Add support for advertising the Dart SDK MCP server#5551
Conversation
|
@jakemac53 I see we have a |
|
I pushed a change to register a tool for getting the DTD URI. I asked Copilot to explain my Flutter runtime error, and it successfully called the tool and provided it to the MCP server: @jakemac53 could you review the names/descriptions I used and see if you think there should be any tweaks (either for consistency with the MCP server, or that you think would make it clearer to an LLM)? |
|
@jakemac53 I was testing restarting DTD to see how it's handled. It appears that the result of the call to this tool is being cached, so when I ask for runtime errors after restarting DTD, it just reuses the old URI and fails. If I ask it to try again, it works: I wonder if the failure error for "Connect to DTD" could be improved, perhaps hinting that the DTD URI might be stale and the "current" URI provided, to see if that'll cause it to fetch it immediately rather than failing? (if you want me to file this somewhere, lmk where) |
This uses the new VS Code API `registerMcpServerDefinitionProvider` to allow VS Code to ask us for MCP servers. If we're using a >= Dart 3.9.0-0 SDK and the (currently "hidden") `dart.experimentalMcpServer` setting is enabled, we will return the `dart mcp-server` command.
…and available for older versions
|
Merging this (behind the experiment flag) and we can follow up with any tweaks in separate commits. |



This uses the new VS Code API
registerMcpServerDefinitionProviderto allow VS Code to ask us for MCP servers. If we're using a >= Dart 3.9.0-0 SDK and the (currently "hidden")dart.experimentalMcpServersetting is enabled, we will return thedart mcp-servercommand.This allows VS Code to discover our MCP server and tools (which are then available to VS Code and other extensions).
Currently we don't provide a way to pass the DTD URI (at startup, or if we have to restart it, when the MCP server may continue to run - since VS Code controls its lifetime), but this will need adding.
@jakemac53 @kenzieschmoll