-
Notifications
You must be signed in to change notification settings - Fork 18
add analytics support to the Dart MCP server #174
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
PR HealthChangelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. |
In the [latest schema](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/schema/2025-03-26/schema.json) the ClientImplementation and ServerImplementation types were merged into a single Implementation type, this updates things to match. Also closes #173 which will make #174 slightly cleaner, and matches what we do for ServerConnection as well.
@@ -40,6 +40,7 @@ void main(List<String> args) async { | |||
), | |||
forceRootsFallback: parsedArgs.flag(forceRootsFallback), | |||
sdk: Sdk.find(dartSdkPath: dartSdkPath, flutterSdkPath: flutterSdkPath), | |||
analytics: null, |
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.
Can we actually create the Analytics instance 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.
If we are allowed to that would simplify things, otherwise we need a custom entry point in the SDK which does create one.
I just don't know if it is kosher or not, it feels a bit weird to be putting the current tool as the dartTool
, when this is actually a binary that can be ran in other ways (from source, or as a git dep).
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.
cc @anderdobo
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.
Another option would be a command line flag to enable analytics.
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.
Can we look up the resolved executable to see if the starting script was from the dart mcp-server
command?
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.
I don't think so, we will just get the dart native runtime as the resolved executable afaik.
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.
Hmm. Then if we need to use the Dart CLI as the parent tool, adding a hidden flag that is set from the dart mcp-server command only could be a good workaround. We should get clarity on that first from Ander though.
Based on dart-lang/tools#2112
Adds analytics events for all tool calls as well as for the runtime errors resource.
We could consider a generic resource read event which includes the URI, but we could accidentally create URIs that have some information we don't want to capture, so I chose to instead just customize this and not provide the URI, but a field that describes the type of resource that was read.
I did not add any debouncing because I don't think it is necessary, LLMs do not invoke tools in super rapid succession generally, but let me know if you all disagree and think I should do some debouncing.