CookieGuard

io.github.aiscihub由 GitHub 账号 aiscihub 发布v0.2.0更新于 Nov 7, 2026

Audit HTTP cookie security against your local policy. Returns findings without cookie values.

已验证STDIO仅桌面开发者工具安全与监控

概览

AI 生成的概览

本地 stdio MCP 服务器,按你自定的策略审计 HTTP Cookie 安全配置,返回不含 Cookie 值的 PASS/FAIL/INCOMPLETE 结果。

可以做什么
  • 读取已加载的策略、允许的来源、超时与范围
  • 扫描某个 URL 的 Set-Cookie 响应头,返回状态、退出码、计数与发现项
  • 审计某个 URL 或证据目录中的脱敏证据文件,并附带来源信息
  • 解释规则、问题、错误或状态 ID,包括已确认与待复核条件及修复建议
  • 报告服务器支持的检查项、配置、结果语义、隐私与限制
适用场景
当你希望助手检查自有 Web 端点的 HttpOnly、SameSite、有效期、仅主机范围等 Cookie 属性,或在开发与 CI 评审中解释和分诊 Cookie 策略失败时使用。
运行要求
需要 Node.js 24 或更高版本以及本地 stdio MCP 客户端;通过 npx 以固定版本启动,并用绝对路径指向 JSON 配置文件。配置须列出允许的来源(最多 20 个,回环地址也需列出)和策略,可选 timeoutMs 与 evidenceDir。无需 API 密钥、云托管或浏览器。
安装前请注意
GET 请求可能触发应用副作用,只扫描你有权测试的端点。配置的来源、策略、证据目录路径、计数与发现项对客户端可见,并可能发送给其模型提供商,因此不要在配置或工具参数中放入机密。策略在启动时加载,修改后需重启;有 shell 权限的代理仍可修改配置并重启进程。服务器无法强制代理调用它或执行其结果。

安装

在 SourceWeft 中

  1. 打开 控制台中的 CookieGuard,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

CookieGuard MCP

Let an MCP client check HTTP cookie configuration against your local policy. CookieGuard returns PASS / FAIL / INCOMPLETE, rule IDs, explanations, and fixes. Cookie values never appear in tool results.

Version 0.2.0 on npm, listed in the official MCP Registry as io.github.aiscihub/cookieguard. Requires Node.js 24+. Version 0.2.0 adds cookieguard_capabilities, cookieguard_audit (including sanitized evidence files), and cookieguard_explain. See Tools and results.

[CookieGuard MCP server] [CookieGuard AI MCP server – quality and maintenance score on Glama]

mermaid
flowchart LR    Client[AI client] --> MCP[Local MCP adapter]    Config[Your origins and policy] --> MCP    MCP --> HTTP[Bounded HTTP header scan]    HTTP --> Engine[CookieGuard policy engine]    Engine --> Result[PASS / FAIL / INCOMPLETE]    Result --> Client

The client launches a local program and communicates over stdio. No cloud hosting, API key, Python, or browser installation is needed. The adapter uses the existing cookieguard-ci scanner and @aiscihub/cookieguard-core policy engine.

Try the working demo

From a clone of this repository:

bash
npm cinpm run demo:mcp

The demo starts a local fixture and connects a real MCP SDK client to the server. It reads the capabilities, audits three endpoints, explains the failure, audits a report written by a separate CLI run, checks every outcome, and exits:

text
MCP tools: cookieguard_audit, cookieguard_capabilities, cookieguard_explain, cookieguard_policy, cookieguard_scanCapabilities: 9 checks; allowed origins: 1; evidence files: enabledsecure: PASSED (exitCode 0)missing-httponly: FAILED (exitCode 1) — CG001 Missing HttpOnlypreference: INCOMPLETE (exitCode 2) — expected-auth-cookie-not-observedExplain CG001: Set HttpOnly on the authentication cookie at the server.Evidence login-report.json: FAILED (exitCode 1); observed by server: noMCP demo passed; cookie-value canary absent from results and diagnostics.

The preference endpoint is incomplete because the configured session_id was not observed. The demo itself exits 0 when every expected outcome is verified.

Connect your MCP client

  1. Install Node.js 24 or later.
  2. Save a configuration file outside any directory your agent can modify.
  3. Add the server command to your client's local stdio MCP configuration.

Example /absolute/path/cookieguard.json:

json
{  "allowedOrigins": ["http://127.0.0.1:3000"],  "policy": {    "authCookies": ["session_id"],    "failOn": "high",    "allowedSameSite": ["lax", "strict"],    "requireExplicitSameSite": true,    "requireHostOnly": true,    "maxLifetimeDays": 30  },  "timeoutMs": 10000,  "evidenceDir": "/absolute/path/cookieguard-evidence"}

evidenceDir is optional and only used by cookieguard_audit (0.2.0+). Use your actual application origin and authentication-cookie names. An origin contains scheme, host, and optional port, with no URL path, credentials, query, or fragment. localhost and 127.0.0.1 are distinct origins. The allowlist is required even for loopback; there is no default authorization for other local services. At most 20 origins are accepted. Public remote origins must also be explicitly configured; the scanner blocks private non-loopback addresses and remote IPv6.

For clients that use an mcpServers JSON object:

json
{  "mcpServers": {    "cookieguard": {      "command": "npx",      "args": [        "--yes",        "@aiscihub/[email protected]",        "--config",        "/absolute/path/cookieguard.json"      ]    }  }}

Replace the configuration path. The pinned version keeps the server from changing until you update it. Use an absolute path to npx if your client cannot find it on PATH. To run from a checkout instead, run npm ci in the repository root, set command to node, and make /absolute/path/cookieguard-ai/packages/mcp/bin/cookieguard-mcp.js the first argument before --config. Client-specific configuration locations and wrapper keys vary; the command and argument array above are the stdio launch settings. This release was tested with the official MCP SDK client on Linux (Node.js 24) and macOS (Node.js 26); desktop MCP clients have not been tested yet.

Ask your client: “Read CookieGuard's policy, then scan http://127.0.0.1:3000/secure and explain any confirmed failures.” In a clone of this repository, run npm run demo in another terminal to provide that fixture endpoint.

Restart the MCP server after changing configuration. The server loads a snapshot at startup; neither a tool call nor an edit to the file changes a running policy. An agent with shell access could still edit the configuration and restart the process, so filesystem permissions and client permissions remain your boundary.

Tools and results

ToolArgumentsResultAvailable in
cookieguard_policy{}Allowed origins, resolved policy defaults, timeout, and scope0.1.0
cookieguard_scan{"url":"http://127.0.0.1:3000/secure"}Status, exit code, counts, findings, limitations, and any scan error0.1.0
cookieguard_capabilities{}Checks, this server's configuration, result semantics, integrations, privacy, and limits0.2.0
cookieguard_audit{"url":"…"} or {"evidenceFile":"login.json"}Same result as cookieguard_scan, plus provenance0.2.0
cookieguard_explain{"id":"CG001"}Meaning, confirmed versus review conditions, and fix for a rule, issue, error, or status0.2.0

Since 0.2.0, every finding also carries evidenceSource (header for a server Set-Cookie declaration, browser for cookie-store metadata) and identityBasis (developer configuration versus uncalibrated heuristics). Output schemas are published in schemas/.

Evidence handoff for authenticated browser workflows

The server never attaches to a browser or reads another process's cookies. To audit a login that only a browser can perform, run it in your own test code with the Browser Use integration (result.write_json(path)), the Playwright adapter (write formatJson(await audit.evaluate())), or the CLI (--output). Write the sanitized report into the configured evidenceDir, then call cookieguard_audit {"evidenceFile": "login.json"}. The server reads only plain .json names inside that directory (no paths or symlinks, at most 1 MiB), rebuilds the value-free observations field by field, and evaluates them under its own startup policy. Evidence for origins outside allowedOrigins is rejected, provisional or incomplete collections stay incomplete, and results carry provenance.observedByServer: false, because the server cannot verify who wrote the file. integrations/python/scripts/agent_discovery_e2e.py runs this path end to end with a real Browser Use agent and the Python MCP SDK.

Only url is accepted by the scan tool. Policy, headers, credentials, and origin overrides are rejected. timeoutMs is a startup setting from 100 to 10000 milliseconds, defaulting to 10000. Only one scan runs at a time; an overlapping call returns BUSY rather than queuing more network work.

The scan response includes identical JSON in structuredContent and its text content block. Its exitCode is a result field, not the MCP server process's exit status:

statusexitCodeMeaning
passed0Completed; no confirmed violations at or above failOn
failed1Confirmed cookie-policy violations at or above failOn
incomplete2Missing evidence or a scan that could not complete

A policy failure is a successful tool execution (isError: false). A blocked target, timeout, HTTP error, or busy server returns isError: true, incomplete, and a fixed error code/message. SDK argument-validation failures return isError: true and may have only text content. Always check both isError and the structured status. Invalid startup configuration exits the process with 2 and writes a fixed diagnostic to stderr; normal stdout contains only MCP traffic.

Configure authCookies to identify your real authentication cookies. Without that evidence, classifier guesses stay in review and do not become confirmed authentication-cookie failures. Defaults and rules are described in the CI policy guide.

Scope and privacy

  • This is an HTTP GET header audit. It does not log in, execute JavaScript, read your browser's cookie store, or attach to another MCP server's browser session. Use the Browser Use integration or Playwright adapter for authenticated browser evidence.
  • GET requests can trigger application side effects. The tool is deliberately not advertised as read-only. Use endpoints you are authorized to test.
  • Requests send no authentication headers or cookies, and response cookies are not replayed. Bodies are discarded. Redirects stay on the original origin, even when another origin is configured. The scanner allows at most five redirects, 32 KiB of response headers per request, and 1000 observations.
  • Raw cookie values and raw HTTP data are not returned. Arbitrary observed cookie names, domains, and paths are also withheld to avoid reflecting remote secrets or instructions. Findings use per-scan cookieId identifiers and show cookieName only when it matches a configured authCookies name. Multiple scoped cookies with the same name have distinct IDs within a response.
  • Responses include at most 100 findings. omittedFindings records truncation; summary counts and status cover every finding. Use the CLI's local report when you need full cookie metadata. IDs are not stable across scans.
  • Configured origins, policy, the evidence directory path (when set), summary counts, and findings are visible to the client and may be sent to its model provider. Do not put secrets in config or tool arguments. The server creates no audit log or report file.
  • A pass covers only these configured checks. MCP exposes a tool; it cannot force an agent to call it or enforce its result. Enforce results in your test runner or CI when you need a release gate. Baseline regression comparison is not exposed in this first adapter.

Development and release

bash
npm run test:mcpnpm run lintnpm run typechecknpm run verify:mcp

verify:mcp installs packed artifacts into an isolated directory and runs the same MCP demo against the installed binary. It packs the installed, locked runtime dependencies and installs offline with an empty npm cache; it does not publish. CI includes the MCP tests in npm test and the packaged-consumer check in npm run release:check.

The official SDK serves both legacy initialization and the 2026-07-28 protocol over stdio. Tests exercise both. Registry metadata is prepared in server.json; see the release checklist for the separate npm and registry approval steps.

来源:packages/mcp/README.md,提交 884a97d

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

2
  1. v0.2.0最新Nov 7, 2026
  2. v0.1.0Nov 6, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分