Repository navigation
Conversation
…hboard APIs Adds 54 tools to google-secops-mcp spanning every public Chronicle dashboard service, implemented as direct REST calls through a new shared `chronicle_api_request` helper in `secops_mcp/utils.py` (works across `secops` SDK releases regardless of how `base_url` is exposed). New tool modules under `secops_mcp/tools/`: - `dashboard_management.py` (17): NativeDashboardService (list, get, create, update, duplicate, delete, add/edit/remove/duplicate chart, export, import), DashboardQueryService (execute, get) and DashboardChartService (get, list, batchGet). - `dashboard_reports.py` (11): DashboardScheduledReportService (list, get, create, update, delete, fetchHistory, duplicate, trigger) and FeaturedContentNativeDashboardService (list, get, install). - `legacy_dashboard_migration.py` (9): legacy Looker DashboardService (create, get, list, delete, copy) and the Looker-to-native migration workflow (fetchMigratable, batchMigrate, fetchMigrationMetrics, fetchMigrationJobs). - `legacy_soar_dashboard.py` (17): every LegacySoarDashboardService verb (dashboards, widgets, widget values/case IDs, playbook monitoring, case trends, time-to-respond, import, save as report template). Behaviour learned from live verification against a Chronicle tenant and encoded in the tools: - `create_dashboard` / `duplicate_dashboard` must send `type: CUSTOM` and an `access` value; both default to `DASHBOARD_PRIVATE`. - `add_dashboard_chart` must send `startX`/`startY` explicitly (proto3 presence) and `chartDatasource.dataSources` (defaults to `["UDM"]`). - `edit_dashboard_chart` enforces optimistic concurrency, so the tool fetches the chart (and saved query) first and sends their `etag`s and the query `name`; `editMask` paths are camelCase. - `import_dashboards` requires the export payload unmodified (`name` and `etag` present) and returns the new resource name in `results[]`. - `ManageDashboardLease` is not visible to the public API surface and is intentionally not exposed. Also adds `parse_json_arg` so structured arguments are accepted either as JSON values or JSON-encoded strings, unit tests for every tool (142 passing in `server/secops/tests`), and README / docs sections with a usage example.
Live verification on a tenant with scheduled reports enabled showed that
DashboardScheduledReportService stores and resolves `dashboard.name` as
the bare native dashboard ID. Sending the full
`projects/.../nativeDashboards/{id}` resource name fails with
`INTERNAL: failed to fetch native dashboard details`.
`create_dashboard_scheduled_report` and `update_dashboard_scheduled_report`
now reduce full names to the bare ID. Verified live: create (bare ID and
full name inputs), get, update (dashboard + cron), fetchHistory,
duplicate, trigger, and delete all return 200.
…tools Removes five tools that could not be verified against any available tenant and notes them as future work in the README and docs: - fetch_migratable_dashboards, batch_migrate_dashboards, fetch_dashboard_migration_metrics, fetch_dashboard_migration_jobs: gated by the under-development `enable_looker_migration_wizard` feature (`403 Looker migration wizard is not enabled for the customer`). - create_legacy_dashboard: `POST /dashboards` fails server-side (`something went wrong, please try again later`) with or without LookML. The remaining legacy Looker tools (get, list, delete, copy) were verified live, so the module is renamed from legacy_dashboard_migration.py to legacy_dashboards.py. Tool count drops from 123 to 118 (49 new dashboard tools); 134 unit tests pass.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds 49 MCP tools to
google-secops-mcpfor Google SecOps (Chronicle SIEM) dashboards: native dashboards, charts and dashboard queries, scheduled reports, Content Hub featured dashboards, legacy (Looker) dashboards, and legacy SOAR dashboards. All HTTP goes through a new sharedchronicle_api_requesthelper insecops_mcp/utils.py. Every tool in this PR was exercised against a live tenant (see Verification); endpoints that could not be are deferred and documented as future work.tools/dashboard_management.pyNativeDashboardService(list, get, create, update, duplicate, delete, add/edit/remove/duplicate chart, export, import),DashboardQueryService(execute, get),DashboardChartService(get, list, batchGet)tools/dashboard_reports.pyDashboardScheduledReportService(list, get, create, update, delete, fetchHistory, duplicate, trigger),FeaturedContentNativeDashboardService(list, get, install)tools/legacy_dashboards.pyDashboardService(get, list, delete, copy)tools/legacy_soar_dashboard.pyLegacySoarDashboardServiceverb (dashboards, widgets, widget values and case IDs, playbook monitoring, case trends, time-to-respond, import, save as report template)Tool count for the server goes from 68 to 118 (plus the 1 shared helper module). The
secops>=0.35.1dependency floor is unchanged.Not included
ListDashboardQueriesis internal-only andManageDashboardLeaseis not publicly visible (Method not visible to labels: {PUBLIC}).dashboards:fetchMigratable,:batchMigrate,:fetchMigrationMetrics,:fetchMigrationJobs) are gated by the under-developmentenable_looker_migration_wizardfeature (403 Looker migration wizard is not enabled for the customeron both tenants tried), and legacy dashboard creation (POST /dashboards) fails server-side (something went wrong, please try again later) with or without LookML. Implementations and unit tests for these five tools exist at commit9686f9con this branch and can be restored once the APIs are generally available.Design notes
chronicle_api_request(chronicle, method, path, params=, json_body=)buildshttps://<region>-chronicle.googleapis.com/<version>/<instance>/...from the SDK client and works whetherchronicle.base_urlis the newer callableBaseUrlor the older plain string. Non-2xx responses raise with the status and body, which the tools surface as{"error": ...}.filters,visualization,chart, widget definitions, export payloads) accept either JSON values or JSON-encoded strings viaparse_json_arg, since MCP clients differ here.Optional[T] = None; logging uses lazy%sformatting; every tool returns{"error": ...}on failure, matching the existing modules.NativeDashboardService, the bare ID forDashboardScheduledReport.dashboard.name).API behaviour learned from live verification (encoded in the tools)
create_dashboard/duplicate_dashboardmust sendtype: CUSTOMand anaccessvalue (cannot create non custom dashboard,dashboard access is unspecified);access_typedefaults toDASHBOARD_PRIVATE.add_dashboard_chartmust sendstartX/startYexplicitly (proto3 presence; omitting them yieldschartLayout in request: invalid argument) andchartDatasource.dataSources(defaults to["UDM"]). Charts reference their saved query underchartDatasource.dashboardQuery.edit_dashboard_chartenforces optimistic concurrency on both the chart and its saved query, so the tool fetches them first and sends theiretags plus the queryname;editMaskpaths are camelCase (dashboardChart.displayName,dashboardQuery.input).import_dashboardsneeds the export payload unmodified (dashboard.nameandetagpresent); the API assigns a new ID and returns it inresults[].dashboard.DashboardScheduledReport.dashboard.namemust be the bare native dashboard ID; a fullprojects/.../nativeDashboards/{id}name fails withINTERNAL: failed to fetch native dashboard details.install_featured_content_dashboardcreates atype: MARKETPLACEdashboard whose ID equals the featured content ID; installing it again returns409.execute_dashboard_queryreturns200with an empty body (not an error) when the caller lacks UDM data access.legacySoarDashboard:*verbs require a SOAR-mapped user identity; a service account gets401 You are not recognized(domainSOAR), the same behaviour as the other SOAR-proxied endpoints.Verification
cd server/secops && uv run --python 3.11 --with pytest --with pytest-asyncio --with pytest-mock pytest tests/-> 134 passed (one or more per tool, JSON-string argument parsing, error paths, and the shared helper).ruff check --select I,F,E9andgit diff --checkclean on the new files.us, service-account identity with UDM data access): all 17dashboard_managementtools, including a create -> update -> add chart -> edit chart (title, then query window) -> duplicate chart -> remove chart -> duplicate dashboard -> export -> delete -> import-restore -> delete round-trip, plusexecute_dashboard_query(inline and saved query),list_dashboard_chartsandbatch_get_dashboard_charts. Alsolist_dashboard_scheduled_reports, the three Content Hub tools (install verified then removed), and the four legacy Looker tools (copy_legacy_dashboardpredefined -> user copy, thendelete_legacy_dashboard).gcloud auth login --update-adc): all 17 legacy SOAR tools, including a create -> add widget -> query widget -> rename widget -> rename dashboard -> delete widget -> delete dashboard round-trip, an import -> delete round-trip, andlegacy_soar_save_dashboard_as_report_template(creates a report template; the service has no delete verb, so one test template remains).us, user identity, scheduled reports enabled with 8 pre-existing reports): the full scheduled-report lifecycle on a scratch dashboard (createwith bare-ID and full-name inputs,get,updateof dashboard + cron + recipients,fetchHistory,duplicate,trigger,delete), plus the native reads,execute_dashboard_query, Content Hub and legacy SOAR reads. Pre-existing reports were untouched.list_dashboard_chartsreturns403 chart library is not enabled for the customeron Tenant B (works on Tenant A).Docs
server/secops/README.md: four new tool sections, feature list entry 18, a use-case bullet, and the future-work note.docs/servers/secops_mcp.md: parameter reference for all 49 tools, the future-work note, and Example 9 (build, query, schedule, export/import a dashboard).