trocco-mcp-tools
OfficialThe server provides tools to audit TROCCO workflows and BigQuery datamarts, and perform controlled write operations on datamart definitions and jobs:
get_workflow— Fetch a TROCCO workflow definition bypipeline_definition_id(read-only).get_datamart— Fetch a BigQuery datamart definition, including SQL and metadata, bydatamart_definition_id(read-only).build_workflow_audit_payload— Combine a workflow and all its datamarts into a comprehensive audit payload, including SQL analysis, resolved destinations, write dispositions, risk flags (e.g., missing API destination, write disposition mismatch), and downstream references.create_datamart_definition— Create a new BigQuery datamart definition (requires explicit confirmation and a creation reason; safe mode enabled).update_datamart_definition— Update an existing datamart configuration (requires confirmation, a change reason, and supports optionalexpected_currentvalues for guarded updates; safe mode enabled).run_datamart_job— Execute an existing datamart definition (requires explicit confirmation and a run reason; safe mode enabled).
The server supports both stdio (local) and streamable HTTP transport (e.g., Cloud Run, ChatGPT integration).
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@trocco-mcp-toolsShow workflow 3847"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
trocco-mcp-tools
TROCCO API を Model Context Protocol (MCP) から扱うためのツール群です。TROCCO workflow と BigQuery datamart の差分監査に必要な情報を取得し、ChatGPT から監査エージェントが SQL、出力先、更新方式、依存関係、リスク候補を整理できる状態を目指します。現在は読み取り系を中心にしつつ、datamart definition / datamart job については明示的な安全条件付きの操作系ツールも提供します。
現在の優先方針
現在の最優先は、実監査そのものではなく、この TROCCO MCP server を ChatGPT から追加・接続できる状態にすることです。
進め方:
Cloud Run などに HTTP MCP endpoint を deploy する
TROCCO_API_KEYを安全に server 側へ注入するChatGPT から MCP server を追加する
ChatGPT から
build_workflow_audit_payloadを呼べることを確認する以後の監査は ChatGPT から MCP tool を利用して実行する
Related MCP server: @us-all/dbt-mcp
目的
このリポジトリでは、TROCCO と BigQuery を使った差分監査を支援するため、次の情報を MCP ツール経由で取得します。
workflow の基本情報
workflow task 一覧
task dependency 一覧
TROCCO BigQuery datamart task の definition id
datamart SQL
datamart の出力先 dataset / table
write_disposition、incremental_column、merge_keys、lookback_period などの更新設定
SQL から推定した source table / destination / write disposition
resolved destination / resolved write disposition
risk flags
downstream references
初期段階では監査に必要な読み取り系を主軸にし、操作系は BigQuery datamart definition と datamart job に限定します。workflow definition create/update と transfer definition create/update は、task/dependency 破壊リスクや connector 種別差が大きいため第2弾以降の対象です。
実装構成
Runtime: Node.js 20+
Language: TypeScript
MCP framework:
@modelcontextprotocol/sdkValidation:
zodStdio entry point:
src/index.tsHTTP entry point:
src/http.tsShared MCP server factory:
src/server.tsTROCCO API client:
src/troccoClient.tsSQL analysis:
src/sqlAnalysis.tsAudit model:
src/auditModel.tsHTTP smoke test:
scripts/smoke-http.mjsDatamart action smoke test:
scripts/smoke-datamart-actions.mjs
Transport
この repository では 2 種類の起動方式を持ちます。
stdio: Cloud Shell やローカルでの検証用
Streamable HTTP: ChatGPT / Cloud Run 接続用
HTTP endpoint:
GET /status: status checkPOST /mcp: MCP Streamable HTTP endpoint
MCP_AUTH_TOKEN を設定した場合、POST /mcp は Authorization: Bearer <token> または x-mcp-auth-token: <token> を要求します。
既定の監査対象
明示指定がない場合、監査エージェントは次の workflow を既定対象として扱います。
pipeline_definition_id=3847SH_PLUS_BQ_RAISE_data_daily_new
環境変数
TROCCO API 接続に必要な認証情報は環境変数から読み込みます。
TROCCO_API_KEY: TROCCO API keyTROCCO_BASE_URL: TROCCO API base URL。未指定時はhttps://trocco.ioを使いますPORT: HTTP server port。Cloud Run では自動設定されますMCP_AUTH_TOKEN: HTTP MCP endpoint 用の bearer tokenMCP_ENDPOINT: smoke test 用 MCP endpoint URLPIPELINE_DEFINITION_ID: smoke test 用 workflow id。未指定時は3847DATAMART_JOB_ID: datamart action smoke test 用 job id。未指定時は1
TROCCO API は Authorization: Token {{API KEY}} 形式の header で認証します。
セットアップ
npm install
npm run buildstdio server を起動します。
TROCCO_API_KEY=... npm run start:stdioHTTP server を起動します。
TROCCO_API_KEY=... MCP_AUTH_TOKEN=... npm run start:httpstatus check:
curl http://localhost:8080/statusCloud Run deployment
Secret Manager に TROCCO API key を保存します。
printf '%s' '<TROCCO_API_KEY>' | gcloud secrets create trocco-api-key --data-file=-MCP endpoint 用 token は trocco-mcp-auth-token として保存済みの前提です。未作成の場合だけ次を実行します。
openssl rand -hex 32 | gcloud secrets create trocco-mcp-auth-token --data-file=-Cloud Run に deploy します。
gcloud run deploy trocco-mcp-tools \
--source . \
--region asia-northeast1 \
--allow-unauthenticated \
--set-secrets TROCCO_API_KEY=trocco-api-key:latest,MCP_AUTH_TOKEN=trocco-mcp-auth-token:latestDeploy 後に確認します。
curl https://<cloud-run-url>/statusChatGPT に追加するときの MCP endpoint は次です。
https://<cloud-run-url>/mcpChatGPT 側の connector 設定では、trocco-mcp-auth-token と同じ値を bearer token として設定してください。
HTTP smoke test
Cloud Run deploy 後、ChatGPT に追加する前に MCP client で疎通確認します。
export MCP_ENDPOINT="https://<cloud-run-url>/mcp"
export MCP_AUTH_TOKEN="$(gcloud secrets versions access latest --secret=trocco-mcp-auth-token)"
npm run smoke:http期待する summary:
{
"ok": true,
"check": "build_workflow_audit_payload",
"pipeline_definition_id": 3847,
"payload_ok": true,
"workflow_name": "SH_PLUS_BQ_RAISE_data_daily_new",
"datamart_count": 31,
"datamart_error_count": 0
}Datamart action tools の一覧確認をします。
export MCP_ENDPOINT="https://<cloud-run-url>/mcp"
export MCP_AUTH_TOKEN="$(gcloud secrets versions access latest --secret=trocco-mcp-auth-token)"
npm run smoke:actionsこの smoke test は get_datamart_job_status の guarded response も確認します。create_datamart_definition や update_datamart_definition の実 write は実行しません。
Inspector / local verification
Inspector で stdio server を確認します。
TROCCO_API_KEY=... npm run build
TROCCO_API_KEY=... npm run inspectorCloud Shell などで Inspector proxy が扱いづらい場合は、MCP SDK client から stdio server を直接呼び出して確認します。
MCP tools
get_workflow
指定した workflow の構造を取得します。
TROCCO endpoint:
GET /api/pipeline_definitions/{pipeline_definition_id}
Input:
{
"pipeline_definition_id": 3847
}get_datamart
指定した datamart definition の SQL と BigQuery option metadata を取得します。
TROCCO endpoint:
GET /api/datamart_definitions/{datamart_definition_id}
Input:
{
"datamart_definition_id": 12345
}build_workflow_audit_payload
指定した workflow と、その配下の BigQuery datamart definition をまとめて取得します。監査コメント生成の入力 payload として使う統合 tool です。
Input:
{
"pipeline_definition_id": 3847
}Output の主な項目:
{
"ok": true,
"pipeline_definition_id": 3847,
"workflow_name": "SH_PLUS_BQ_RAISE_data_daily_new",
"workflow": {},
"datamarts": [
{
"definition_id": 12345,
"name": "example_datamart",
"destination_dataset": "dataset",
"destination_table": "table",
"write_disposition": "append",
"sql_analysis": {},
"resolved_destination": {},
"resolved_write_disposition": {},
"risk_flags": [],
"downstream_references": []
}
],
"datamart_errors": []
}create_datamart_definition
BigQuery datamart definition を作成します。操作系 tool のため、confirm: true と create_reason が必須です。
TROCCO endpoint:
POST /api/datamart_definitions
Input example:
{
"name": "SH_PLUS_AGGREGATION_example",
"description": "example aggregation datamart",
"datamart_bigquery_option": {
"bigquery_connection_id": 345,
"query": "select 1 as id",
"destination_dataset": "dataset_aggregation_tables",
"destination_table": "example_table",
"write_disposition": "truncate",
"partitioning": "time_unit_column",
"partitioning_time": "DAY",
"partitioning_field": "date_jst"
},
"confirm": true,
"create_reason": "Create a new AGGREGATION datamart for the audited SOURCE->AGGREGATION flow."
}run_datamart_job
既存の datamart definition を実行します。操作系 tool のため、confirm: true と run_reason が必須です。
TROCCO endpoint:
POST /api/datamart_jobs
Input example:
{
"datamart_definition_id": 12345,
"confirm": true,
"run_reason": "Validate the new datamart definition after review."
}update_datamart_definition
既存の BigQuery datamart definition の一部設定を更新します。操作系 tool のため、confirm: true と change_reason が必須です。
TROCCO endpoint:
PATCH /api/datamart_definitions/{datamart_definition_id}
Input example:
{
"datamart_definition_id": 12345,
"patch": {
"write_disposition": "truncate",
"partitioning": "time_unit_column",
"partitioning_time": "DAY",
"partitioning_field": "date_jst"
},
"expected_current": {
"write_disposition": "append"
},
"confirm": true,
"change_reason": "Align write mode with the SOURCE->AGGREGATION audit policy."
}Action tool safety
操作系 tool は、監査支援のために限定的に提供します。
confirm: trueがない入力は schema validation で拒否されますcreate_reason/change_reason/run_reasonのいずれかを必須にしますcreate/update の BigQuery option は allowlist された項目のみ受け付けます
update_datamart_definitionはexpected_currentが指定され、現在値と一致しない場合は PATCH を送信しませんworkflow definition と transfer definition の create/update はこの phase では対象外です
追加の運用メモは docs/definition-actions.md を参照してください。
SQL analysis
sql_analysis は SQL コメントを除去したうえで、監査に必要な最低限の候補を抽出します。
from/joinから source table 候補を抽出create or replace table/insert into/insert <table>/delete from/mergeから destination 候補を抽出delete fromとinsertの組み合わせをdelete_insertとして推定mergeをmergeとして推定destination と source が同じ table の場合に
destination_also_used_as_sourceをtrueにする
高度な SQL lineage parser ではないため、確定値ではなく監査用の候補値として扱います。
Resolved audit fields
resolved_destination は、API metadata と SQL 推定を分けて扱います。
API の
destination_dataset/destination_tableがあればsource = apiAPI destination がなく SQL 内 destination があれば
source = sql_inferredどちらもなければ
source = unknown
resolved_write_disposition は、API の write_disposition を優先しつつ、SQL 推定値も保持します。
API の
write_dispositionがあればsource = apiAPI 値がなく SQL 推定値があれば
source = sql_inferredどちらもなければ
unknown
Risk flags
現在の実装では、次の risk_flags を返します。
missing_api_destination: API metadata に destination がないsql_destination_inferred: SQL から destination を推定したdestination_also_used_as_source: destination と source が同じ table の可能性があるapi_write_disposition_but_sql_destination_unknown: API write_disposition はあるが SQL から destination が取れないwrite_disposition_mismatch: API と SQL 推定の write_disposition が食い違う
Downstream references
downstream_references は、ある datamart の resolved destination が、別 datamart の sql_analysis.source_tables に含まれる場合に返します。workflow dependency と合わせて確認することで、後続参照や依存漏れの監査に使います。
Error payload
MCP tool は失敗時も JSON text として次の形を返します。
{
"ok": false,
"error": {
"code": "auth_error",
"message": "TROCCO API authentication failed. Check TROCCO_API_KEY.",
"status": 401,
"endpoint": "https://trocco.io/api/...",
"detail": {}
}
}Error code:
config_error:TROCCO_API_KEYが未設定auth_error: 401 / 403not_found: 404。workflow または datamart が存在しない、もしくは権限がないapi_error: その他の HTTP errornetwork_error: TROCCO API に接続できない
次の確認ステップ
Cloud Run に最新の branch を deploy する
/statusと/mcpの認証を確認するnpm run smoke:httpを実行するnpm run smoke:actionsを実行するChatGPT に
https://<cloud-run-url>/mcpを追加するChatGPT から
build_workflow_audit_payloadを実行し、監査に進む
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Tools
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Growth-Management/trocco-mcp-tools'
If you have feedback or need assistance with the MCP directory API, please join our Discord server