change the MCP server build script to point at the custom binary
update package:ai in deps, add entrypoint script for the mcp server which injects an analytics instance
Change-Id: I1fd770a061085e7303c24b0c76e48d208687d9ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/437080
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
diff --git a/DEPS b/DEPS
index cdf0a5d..f95e741 100644
--- a/DEPS
+++ b/DEPS
@@ -131,7 +131,7 @@
### /third_party/pkg dependencies
# 'tools/rev_sdk_deps.dart' will rev pkg dependencies to their latest; put an
# EOL comment after a dependency to instead pin at the current revision.
- "ai_rev": "5f9c50fc93c978e059a3ab2a071faeca6f81fd68",
+ "ai_rev": "706d22444f2ca6123aeb8f1f4508b1d4451b6d0d",
"core_rev": "b59ecf4ceebe6153e1c0166b7c9a7fdd9458a89d",
"dartdoc_rev": "f1fe17752b1193ad52d69271ceb686cc3e4712b0",
"ecosystem_rev": "d5233c6dd0767cffa5742e32c4bc7c230c9c4b12",
diff --git a/utils/dart_mcp_server/BUILD.gn b/utils/dart_mcp_server/BUILD.gn
index 839ceb8..06c3bc2 100644
--- a/utils/dart_mcp_server/BUILD.gn
+++ b/utils/dart_mcp_server/BUILD.gn
@@ -13,12 +13,12 @@
}
aot_snapshot("dart_mcp_server_aot_snapshot") {
- main_dart = "../../third_party/pkg/ai/pkgs/dart_mcp_server/bin/main.dart"
+ main_dart = "dart_mcp_server.dart"
output = "$root_gen_dir/dart_mcp_server_aot.dart.snapshot"
}
aot_snapshot("dart_mcp_server_aot_product_snapshot") {
- main_dart = "../../third_party/pkg/ai/pkgs/dart_mcp_server/bin/main.dart"
+ main_dart = "dart_mcp_server.dart"
output = "$root_gen_dir/dart_mcp_server_aot_product.dart.snapshot"
# dartaotruntime has dart_product_config applied to it,
diff --git a/utils/dart_mcp_server/dart_mcp_server.dart b/utils/dart_mcp_server/dart_mcp_server.dart
new file mode 100644
index 0000000..90becff
--- /dev/null
+++ b/utils/dart_mcp_server/dart_mcp_server.dart
@@ -0,0 +1,23 @@
+// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// A custom entrypoint used by `dart mcp-server`. Injects an analytics instance
+/// using the [DashTool.dartTool] tool.
+library;
+
+import 'dart:io';
+
+import 'package:dart_mcp_server/dart_mcp_server.dart';
+import 'package:unified_analytics/unified_analytics.dart';
+
+void main(List<String> args) async {
+ exitCode = await DartMCPServer.run(
+ args,
+ analytics: Analytics(
+ tool: DashTool.dartTool,
+ // The actual version is part up to the first space.
+ dartVersion: Platform.version.split(' ').first,
+ ),
+ );
+}