Ci Guard Mcp

io.github.carelessdept由 GitHub 帳號 carelessdept 發布v0.1.0更新於 Oct 24, 2026

Local-first static repository security and configuration drift auditor (CLI, GitHub Action & MCP).

已驗證STDIO僅桌面開發者工具安全與監控

概覽

AI 產生的概覽

本機唯讀靜態稽核器,讓助理掃描儲存庫中高風險的 GitHub 工作流程、環境變數漂移、憑證外洩與鎖定檔衝突。

可以做什麼
一次呼叫即可執行涵蓋全部四個稽核器的完整儲存庫稽核,也可單獨針對某一領域:工作流程安全、環境與部署漂移、憑證外洩(可選僅暫存區與包含被忽略檔案模式)。結果以文字 JSON 加結構化內容回傳,路徑被限制在啟動根目錄內。報告具確定性且已去識別化,同一引擎另提供 CLI、GitHub Action 與 SDK。
適用情境
適合在合併前審查儲存庫、檢查 CI 工作流程安全、找出未記錄的環境變數或可能已提交的憑證、排查衝突的鎖定檔,尤其當原始碼必須留在本機時。
執行需求
透過 npx(npm 套件 ci-guard-mcp)或已建置的原始碼檢出作為本機 stdio 程序執行。需要 Node.js 20 或更新版本;索引掃描與追蹤檔案選擇需要 Git。無需網路傳輸、憑證或 API 金鑰。
安裝前請注意
發現結果屬啟發式判斷,不能證明安全性或憑證有效性;合成權杖可能被誤報,編碼或低熵金鑰可能被漏報。在 Git 根目錄下,除非啟用 include-ignored,否則憑證稽核會略過未追蹤檔案。儲存庫設定與忽略規則屬於受信任的本機策略,應在拉取請求中審查設定變更。啟動根目錄不是作業系統層級的沙箱。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Ci Guard Mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

ci-guard-mcp

[CI] [npm version] [ci-guard-mcp MCP server] [License: MIT]

One local audit engine. A CLI, a GitHub Action, and four MCP tools.

Catch risky GitHub workflows, undocumented environment variables, possible credentials, and conflicting dependency configuration before merging. Audits are deterministic, read-only, and run without sending source code to a service. Two runtime dependencies: yaml and ignore.

Run locally

Requires Node.js 20 or later. Git is required for index scans and tracked-file selection.

sh
# Run directly with npx:npx ci-guard-mcp scan . --fail-on warnnpx ci-guard-mcp scan . --sandboxnpx ci-guard-mcp scan . --no-gitnpx ci-guard-mcp scan . --format jsonnpx ci-guard-mcp scan . --format sarif > findings.sarifnpx ci-guard-mcp scan . --auditor workflows --auditor lockfilenpx ci-guard-mcp scan . --auditor secrets --stagednpx ci-guard-mcp scan . --auditor secrets --include-ignored
# Or from a local source checkout:npm ci --ignore-scriptsnpm run buildnode dist/cli.js scan .

Exit codes: 0 below threshold, 1 findings at or above threshold, 2 invalid arguments, configuration or I/O failure. --fail-on error is the default; warn also fails on warnings. Informational findings never fail a scan. Output formats are text, json, sarif, and github. --root PATH is equivalent to the positional scan directory. --include-ignored audits tracked files even when they match .gitignore rules (for example, a .env committed before .gitignore was added). --help lists every flag.

Staged mode is intentionally limited to secrets: it reads entire changed index blobs, including renamed/added files, so unstaged edits cannot conceal a staged credential. It applies ignore rules from the index and skips deletions, symlinks and submodules. Other audits need the repository-wide context and cannot be combined with --staged.

GitHub Action

After this repository is published, use a reviewed full commit SHA in place of FULL_COMMIT_SHA:

yaml
name: Repository auditon: [push, pull_request]permissions:  contents: readjobs:  audit:    runs-on: ubuntu-latest    steps:      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2      - uses: carelessdept/ci-guard-mcp@FULL_COMMIT_SHA        id: guard        with:          path: .          fail-on: warn

Inputs: path (default .), fail-on (error or warn, default error). Outputs: errors, warnings, findings as decimal counts. Outputs and the Markdown job summary are written before the finding threshold is evaluated. Findings become escaped workflow annotations; a failed audit exits the action with status 1. Operational failure exits 2 and does not claim complete counts.

This composite action installs its locked build dependencies with lifecycle scripts disabled into a runner-temp directory and runs the compiled CLI. It requires npm registry access, Bash, and a runner compatible with actions/setup-node@v4. The scanned repository's dependencies and scripts are never installed or executed. The self-audit workflow runs the local action and verifies its outputs. Run the CLI separately with --format sarif when uploading to a code-scanning service; the action itself does not upload reports or request write permissions.

MCP server

The stdio server uses newline-delimited JSON-RPC 2.0, negotiates MCP versions 2025-11-25, 2025-06-18, 2025-03-26 and 2024-11-05, and implements initialization, ping, tool discovery, tool calls and silent notifications. A client must send notifications/initialized after initialization. No network transport or credentials are needed.

Example MCP client configuration after npm publication:

json
{  "mcpServers": {    "ci-guard": {      "command": "npx",      "args": ["--yes", "ci-guard-mcp", "--mcp", "--root", "/absolute/path/to/repository"]    }  }}

For a source checkout, use "command": "node" and "args": ["/absolute/path/to/ci-guard-mcp/dist/cli.js", "--mcp", "--root", "/absolute/path/to/repository"].

ToolBehaviorArguments
scan_repoAll four auditorspath?: string, includeIgnored?: boolean
check_env_driftEnvironment and deployment driftpath?: string
audit_github_workflowsWorkflow securitypath?: string
check_secret_leaksRedacted credential findingspath?: string, staged?: boolean, includeIgnored?: boolean

Paths resolve inside the launch root; parent traversal and symlinks escaping it are rejected. Responses contain text JSON plus structuredContent with the same report. Invalid tool arguments are JSON-RPC errors; execution failures use isError: true. Stdout contains only protocol messages. Frames over 1 MiB are rejected, and the server recovers at the next newline. Requests are serialized to keep memory use and ordering predictable; scans complete before the next queued request, so cancellation notifications do not interrupt an active audit.

Audit rules

RuleSeverityDetects
workflow/pwn-requesterrorpull_request_target / GitLab MR checkout with event-derived PR head ref/repository
workflow/script-injectionerrorGitHub event/head-ref or GitLab MR/commit expressions directly interpolated in run / script
workflow/secret-exfiltrationerrorDirect ${{ secrets.* }} or ${{ toJSON(secrets) }} interpolation in run scripts
workflow/unpinned-actionwarnRemote actions, reusable workflows, or GitLab include / component / image without immutable SHA/sha256 digests
workflow/missing-permissionswarnMissing top-level permissions
workflow/invalid-yamlerrorMalformed workflow YAML, duplicate keys or non-mapping document
env/undocumentedwarnLiteral source references absent from .env.example / .env.template
env/dead-templateinfoTemplate declarations without detected source or deployment use
env/invalid-composeerrorMalformed Compose YAML
secret/aws, secret/github, secret/stripe, secret/openai, secret/anthropic, secret/slack, secret/private-keyerrorRecognizable credential shapes/private-key headers
secret/high-entropyerrorHigh-entropy quoted assignments to credential-like names
lockfile/conflicterrorMultiple recognized package-manager lockfiles in the same directory
lockfile/insecure-httperrorHTTP URLs in text lockfiles
lockfile/unbounded-versionwarn*, latest, and npm aliases to them in dependency sections
lockfile/invalid-packageerrorInvalid JSON package manifests
scan/skipped-filewarnFiles exceeding the configured size limit

Environment patterns support process.env.X, bracket syntax, import.meta.env.X, Python os.environ[...] / .get(...) / os.getenv(...), Go os.Getenv(...), and Rust std::env::var(...) / env::var(...). Templates and declarations are aggregated across the scan root. Docker ENV and Compose environment entries count as consumers; deployment-only variables still require documentation when source references them. Tests/fixtures are excluded from source reference extraction.

Secrets use known prefixes and contextual entropy (at least 24 characters, Shannon entropy ≥4.3 bits/character). Values and source snippets are never included in findings, SARIF or MCP results. In a Git root, normal secret audits read tracked working-tree files; untracked files are skipped. Without Git, all eligible files are scanned. Other auditors include untracked files. .gitignore and nested ignore rules are respected by default (pass --include-ignored or includeIgnored: true to force-scan tracked files matching .gitignore), alongside built-in dependency/build-directory exclusions. Symlinks and NUL-containing binary files are skipped.

Configuration

Use .ciguardrc.json or package.json's ciguard object. The rc file takes precedence. Unknown keys and invalid types fail explicitly. Arrays replace defaults rather than merging. Patterns in ignore and secretIgnore use gitignore syntax relative to the scan root.

json
{  "ignore": ["generated/"],  "allowActions": ["actions/*"],  "ignoreEnv": ["NODE_ENV", "CI", "PATH", "HOME"],  "secretIgnore": ["test/", "tests/", "__tests__/", "fixtures/", "__fixtures__/", "*.test.*", "*.spec.*", ".env.example", ".env.template"],  "disabledRules": [],  "maxFileBytes": 1048576}

By default allowActions is empty: official actions also require immutable pins. Set actions/* explicitly to permit mutable official references, or list exact identities such as actions/checkout. maxFileBytes accepts 1 KiB–16 MiB; oversized text files produce warnings, which cannot be suppressed through disabledRules. The repository's own config excludes docs/ because the landing page contains instructional examples and adds GitHub's two runtime output variables to ignoreEnv.

SDK

ts
import { scan, formatSarif } from 'ci-guard-mcp';const report = await scan({ root: '/path/to/repo', auditors: ['workflows', 'secrets'] });console.log(report.summary);const sarif = formatSarif(report);

Named auditor functions accept { files: [{ path, content }], config } for in-memory integrations. SDK config overrides file configuration. Reports contain version, findings, counts and files scanned; no timestamp or absolute root is included, allowing stable snapshots. filesScanned counts eligible text files collected, including files not relevant to a selected auditor.

Boundaries and limitations

This is a static heuristic auditor, not a proof of security or a credential validity checker. It does not execute code, resolve computed environment names, follow calls across files, inspect Git history, decrypt files, audit remote reusable workflow bodies, or analyze dependency vulnerabilities. YAML workflow checks inspect local structured steps and job-level reusable workflow references. Event-derived values passed through intermediate expressions or files can evade direct interpolation checks. Literal environment patterns can match commented examples or strings. Dead-template notices are advisory because external consumers and dynamic reads are invisible.

Default secret exclusions deliberately reduce noise in tests/templates; replace secretIgnore with [] for broader coverage. Synthetic tokens that look real can still be reported, and unknown/low-entropy/encoded credentials can be missed. Tracked files ignored by .gitignore are excluded in a normal scan unless --include-ignored (includeIgnored: true) is passed. Binary lockfiles are skipped as binary content. Package-specific environment scopes are not inferred; scan a package directory separately for isolated drift checks. Repository configuration is trusted local policy, so review config and ignore changes in pull requests. Do not use the MCP launch root as an OS-level sandbox against a concurrently malicious local process.

Development and release

sh
npm ci --ignore-scriptsnpm run checknode dist/cli.js scan --fail-on warnnpm pack --dry-run

CI runs tests/typechecks/build/package checks on Node 20 and 22 across Linux, macOS and Windows. See CONTRIBUTING.md for regression tests and SECURITY.md for disclosure.

MIT licensed. Maintained openly through reproducible reports, focused changes and documented limitations.

Protocol references: MCP stdio, SARIF 2.1.0.

來源:README.md,提交 11f7635

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.1.0最新Oct 17, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分