mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
Adds two new tools to the depot_tools MCP server related to retrieving recent builds from Buildbucket. get_recent_builds retrieves the N most recent completed builds from the specified builder, while get_recent_failed_builds retrieves the N most recent failed (i.e. red) builds. Bug: 438226961 Change-Id: I55d93140fcf405276e622525a833c5717b5aca90 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6842576 Reviewed-by: Struan Shrimpton <sshrimp@google.com> Commit-Queue: Struan Shrimpton <sshrimp@google.com> Commit-Queue: Brian Sheedy <bsheedy@chromium.org> Auto-Submit: Brian Sheedy <bsheedy@chromium.org>
48 lines
1.3 KiB
Python
Executable File
48 lines
1.3 KiB
Python
Executable File
#!/bin/env vpython3
|
|
# Copyright 2025 The Chromium Authors
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
"""The MCP server that provides tools"""
|
|
from collections.abc import Sequence
|
|
import pathlib
|
|
import os
|
|
import sys
|
|
|
|
sys.path.insert(
|
|
0,
|
|
os.path.abspath(
|
|
pathlib.Path(__file__).resolve().parent.parent.joinpath(
|
|
pathlib.Path('infra_lib'))))
|
|
import telemetry
|
|
|
|
import buildbucket
|
|
|
|
from absl import app
|
|
|
|
from mcp.server import fastmcp
|
|
|
|
mcp = fastmcp.FastMCP('chrome-infra-mcp')
|
|
|
|
|
|
def main(argv: Sequence[str]) -> None:
|
|
if len(argv) > 1:
|
|
raise app.UsageError('Too many command-line arguments.')
|
|
|
|
# Only initialize telemetry if the user is opted in. The MCP does not
|
|
# currently have the ability to show the banner so we need to rely on other
|
|
# tools to get consent
|
|
if telemetry.opted_in():
|
|
telemetry.initialize('chromium.mcp')
|
|
|
|
mcp.add_tool(buildbucket.get_build)
|
|
mcp.add_tool(buildbucket.get_build_from_build_number)
|
|
mcp.add_tool(buildbucket.get_build_from_id)
|
|
mcp.add_tool(buildbucket.get_build_status)
|
|
mcp.add_tool(buildbucket.get_recent_builds)
|
|
mcp.add_tool(buildbucket.get_recent_failed_builds)
|
|
mcp.run()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
app.run(main)
|