Files
wehub-resource-sync 4b6817381b
CI (OpenClaw E2E) / openclaw test (push) Has been cancelled
CI / coverage-report (push) Has been cancelled
CI / test-kubernetes (push) Has been cancelled
CI / should-run-thorough (push) Has been cancelled
CI / test-thorough (cloudwatch-demo) (push) Has been cancelled
CI / test-thorough (flink-ecs) (push) Has been cancelled
CI / test-thorough (upstream-lambda) (push) Has been cancelled
CI / test-thorough (prefect-ecs-fargate) (push) Has been cancelled
Release / build-binaries (zip, opensre.exe, onefile, windows-latest, windows-x64) (push) Has been cancelled
Benchmark image — build + push to ECR (any adapter) / build + push (push) Has been cancelled
CI / quality (ubuntu-latest) (push) Has been cancelled
CI / test (tools-runtime) (push) Has been cancelled
CI / test (e2e-general) (push) Has been cancelled
CI / test (cli-runtime) (push) Has been cancelled
CI / test (e2e-provider-and-openclaw) (push) Has been cancelled
CI / test (integrations-and-misc) (push) Has been cancelled
Release / verify (push) Has been cancelled
Release / build-python-dist (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, macos-15-intel, darwin-x64) (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, macos-latest, darwin-arm64) (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04, linux-x64) (push) Has been cancelled
Release / publish-release (push) Has been cancelled
Release / publish-main-release (push) Has been cancelled
Interactive Shell Live (PR + post-merge) / turn-checks (no-LLM) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Interactive Shell Live (PR + post-merge) / turn-live shard ${{ matrix.shard_index }} (push) Has been cancelled
Release / prepare (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04-arm, linux-arm64) (push) Has been cancelled
Synthetic Deterministic Tests / Synthetic offline (deterministic) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:10:45 +08:00

146 lines
4.4 KiB
Python

"""MCP-backed onboarding integration validators."""
from __future__ import annotations
from integrations.github.mcp import (
build_github_mcp_config,
format_github_mcp_validation_cli_report,
validate_github_mcp_config,
)
from integrations.openclaw import build_openclaw_config, validate_openclaw_config
from integrations.posthog_mcp import (
build_posthog_mcp_config,
validate_posthog_mcp_config,
)
from integrations.sentry_mcp import (
build_sentry_mcp_config,
validate_sentry_mcp_config,
)
from .shared import IntegrationHealthResult
def validate_github_mcp_integration(
*,
url: str = "",
mode: str,
auth_token: str = "",
command: str = "",
args: list[str] | None = None,
toolsets: list[str] | None = None,
repo_view: str = "auto",
repo_visibility: str = "any",
) -> IntegrationHealthResult:
"""Validate GitHub MCP connectivity and required repository tools."""
config = build_github_mcp_config(
{
"url": url,
"mode": mode,
"auth_token": auth_token,
"command": command,
"args": args or [],
"toolsets": toolsets or [],
}
)
result = validate_github_mcp_config(
config,
repo_view=repo_view, # type: ignore[arg-type]
repo_visibility=repo_visibility, # type: ignore[arg-type]
)
return IntegrationHealthResult(
ok=result.ok,
detail=format_github_mcp_validation_cli_report(result),
github_mcp=result,
)
def validate_openclaw_integration(
*,
url: str = "",
mode: str,
auth_token: str = "",
command: str = "",
args: list[str] | None = None,
) -> IntegrationHealthResult:
"""Validate OpenClaw MCP connectivity by listing available tools."""
try:
config = build_openclaw_config(
{
"url": url,
"mode": mode,
"auth_token": auth_token,
"command": command,
"args": args or [],
}
)
result = validate_openclaw_config(config)
return IntegrationHealthResult(ok=result.ok, detail=result.detail)
except Exception as err:
return IntegrationHealthResult(ok=False, detail=f"OpenClaw validation failed: {err}")
def validate_posthog_mcp_integration(
*,
url: str = "",
mode: str,
auth_token: str = "",
command: str = "",
args: list[str] | None = None,
organization_id: str = "",
project_id: str = "",
features: list[str] | None = None,
read_only: bool = True,
) -> IntegrationHealthResult:
"""Validate PostHog MCP connectivity by listing available tools."""
try:
config = build_posthog_mcp_config(
{
"url": url,
"mode": mode,
"auth_token": auth_token,
"command": command,
"args": args or [],
"organization_id": organization_id,
"project_id": project_id,
"features": features or [],
"read_only": read_only,
}
)
result = validate_posthog_mcp_config(config)
return IntegrationHealthResult(ok=result.ok, detail=result.detail)
except Exception as err:
return IntegrationHealthResult(ok=False, detail=f"PostHog MCP validation failed: {err}")
def validate_sentry_mcp_integration(
*,
url: str = "",
mode: str,
auth_token: str = "",
command: str = "",
args: list[str] | None = None,
host: str = "",
organization_slug: str = "",
project_slug: str = "",
skills: list[str] | None = None,
) -> IntegrationHealthResult:
"""Validate Sentry MCP connectivity by listing available tools."""
try:
config = build_sentry_mcp_config(
{
"url": url,
"mode": mode,
"auth_token": auth_token,
"command": command,
"args": args or [],
"host": host,
"organization_slug": organization_slug,
"project_slug": project_slug,
"skills": skills or [],
}
)
result = validate_sentry_mcp_config(config)
return IntegrationHealthResult(ok=result.ok, detail=result.detail)
except Exception as err:
return IntegrationHealthResult(ok=False, detail=f"Sentry MCP validation failed: {err}")