Skip to content

[experimental] Add support for advertising the Dart SDK MCP server#5551

Merged
DanTup merged 5 commits intomasterfrom
mcp-server
Jun 18, 2025
Merged

[experimental] Add support for advertising the Dart SDK MCP server#5551
DanTup merged 5 commits intomasterfrom
mcp-server

Conversation

@DanTup
Copy link
Member

@DanTup DanTup commented Jun 16, 2025

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.

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

@DanTup
Copy link
Member Author

DanTup commented Jun 16, 2025

@jakemac53 I see we have a lm.registerTool API that I missed before, which I think is what you were suggesting we use to provide a way for the LLM to ask for the DTD URI?

@DanTup DanTup added this to the v3.114.0 milestone Jun 16, 2025
@DanTup DanTup added is enhancement An enhancement or improvement that should be listed in release notes but is not a bug fix. in ai Relates to AI, such as use of the MCP APIs labels Jun 16, 2025
@DanTup
Copy link
Member Author

DanTup commented Jun 17, 2025

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:

image

image

@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)?

@DanTup
Copy link
Member Author

DanTup commented Jun 17, 2025

@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:

image

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)

DanTup added 4 commits June 17, 2025 17:32
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.
@DanTup
Copy link
Member Author

DanTup commented Jun 18, 2025

Merging this (behind the experiment flag) and we can follow up with any tweaks in separate commits.

@DanTup DanTup merged commit 34f1071 into master Jun 18, 2025
19 checks passed
@DanTup DanTup deleted the mcp-server branch June 18, 2025 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in ai Relates to AI, such as use of the MCP APIs is enhancement An enhancement or improvement that should be listed in release notes but is not a bug fix.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant