Safe Pkgs (Math280h)

MCP安全风控

提供方 未标注

安全风控 stdio · 本地进程 未标注 社区 / 第三方
查看接入方式

全面解析Safe PkgsMCP Server的核心功能、安装配置和实用案例。作为顶级Model Context Protocol服务器,Safe Pkgs能让AI助手访问实时数据、执行操作,为您提供更智能的工作体验和自动化解决方案。

一句话选型结论

按资料字段整理

Safe Pkgs (Math280h) 属于安全风控类 MCP 服务器,stdio · 本地进程,鉴权方式未标注,有可直接执行的安装命令。接入前先确认权限范围;涉及写入、删除或付款的操作,建议先在测试环境验证。

分类安全风控 传输方式stdio · 本地进程 鉴权未标注 部署方式本地部署
GitHub 星标 未标注 仓库热度,无公开仓库时显示未标注
工具数 未标注 暴露给模型的工具数量
资源 / 提示词 0 / 0 资源与提示词模板数量
维护方 社区 / 第三方 核验等级 仅资料核对

工具与能力

安全风控
数量来自来源目录的标注,具体工具清单以官方文档为准
工具数量未标注暴露给模型可调用的工具个数
资源数量0可读取的资源条目
提示词数量0内置提示词模板数量

能力标签

安装与配置

stdio · 本地进程 未标注
客户端在本机拉起子进程,数据不出本机
pip install zensical

这条命令只是入口,具体启动参数请按官方文档补齐,不要直接照搬到别的服务器。

  1. 1
    准备运行环境

    stdio 服务在本地起进程,需要先装好 Python,再按安装命令拉取依赖。

  2. 2
    安装服务

    复制上面的安装命令执行;命令里带占位符的位置,换成自己的密钥或路径。

  3. 3
    写入客户端配置

    在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4
    验证是否可用

    连接成功后随便调一个只读工具,确认能返回结果,再接入正式流程。

典型使用场景

3 类
按分类与标签整理的常见用法,具体以官方文档为准
资产与漏洞排查

盘点资产、扫漏洞、看暴露面。

日志与审计

汇总日志、查异常行为。

合规检查

按规则检查配置与权限是否合规。

选择建议

选之前先看这几条
按条目字段给出的判断,不替你决定用不用

值得选的地方

  • 有现成的安装命令,不用自己找入口,照着跑就能起服务。

先想清楚的地方

  • stdio 方式要求本地装好运行时(如 Node.js),换机器要重新装一遍。
  • 资料没标注工具数量,实际能力要装好后确认。
  • 版本更新与行为细节以官方仓库为准。

更适合

  • 需要在安全风控场景里让模型直接调用外部能力的人。
  • 想先快速试一下、能接受在本地或自有环境跑服务的人。

不太适合

  • 完全不想在本地装环境的人。
  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

6 个同类
同分类里挑最接近的几条,字段以各自详情页为准
MCP 服务器工具数传输方式部署方式安装命令最后核验
Safe Pkgs (Math280h)当前 未标注 stdio · 本地进程 本地部署 有 2026-05-17
Cyber Strike AI 75 未标注 未标注 无 2026-05-17
mcp-for-beginners 未标注 stdio · 本地进程 本地部署 有 2026-04-13
casdoor 未标注 stdio · 本地进程 本地部署 有 2026-04-12
kubeshark 未标注 stdio · 本地进程 本地部署 有 2026-04-11
Modelcontextprotocol C22988b0 未标注 stdio · 本地进程 本地部署 有 2026-05-17

服务器档案

安全风控
字段来自项目仓库与公开索引,中文说明由本站标注
提供方未标注上游标注的维护方 未标注
分类安全风控本站按上游分类展示
连接方式stdio · 本地进程客户端在本机拉起子进程,数据不出本机
鉴权方式未标注远程服务建议用最小权限凭据
维护方社区 / 第三方核验等级 仅资料核对
包名 / 运行时未标注 · Python本地安装时用到的包标识与运行时
部署类型本地部署上游给出的部署形态
最近核验2026-05-17上游最后核验时间

详细介绍

9.6 KB
来自项目仓库与上游目录的原文,未做删改

safe-pkgs

Package safety checks for AI agents before install.

Rust MCP server + CLI with allow/deny decisions, risk scoring, and audit logs.

Documentation ·
GitHub Action

Without safe-pkgs
With safe-pkgs

What It Is

safe-pkgs checks package risk before dependency actions and returns one machine-enforceable decision.

Decision payload includes:
- allow: true or false
- risk: low · medium · high · critical
- reasons: human-readable findings
- evidence: structured findings (kind, stable id, severity, message, facts)
- metadata: package context (latest, publish date, downloads)
- fingerprints: deterministic hashes (config, policy)

Install + Run in 60 Seconds

Install once:```bash
cargo install --path . --locked


Run MCP server:```bash
safe-pkgs serve

Run a one-off audit:```bash
safe-pkgs audit /path/to/project-or-lockfile
safe-pkgs audit /path/to/requirements.txt --registry pypi


Preview the decision without enforcing it (what-if):```bash
safe-pkgs simulate /path/to/project-or-lockfile

Windows MCP hosts (Claude Desktop, etc.) should use:```powershell
safe-pkgs-mcp.exe


## No Subscription Required

`safe-pkgs` does not require a paid plan, hosted account, or API key for built-in checks.

- Runs locally as a Rust binary (MCP server or CLI).
- Uses public package/advisory endpoints by default:
  - npm registry + npm downloads API + npms popularity index
  - crates.io API
  - PyPI JSON API + pypistats + top-pypi index
  - OSV advisory API
- Stores cache and audit logs locally on your machine.

## Registry and Check Support

Supported registries:
- `npm` (default)
- `cargo` (crates.io)
- `pypi` (Python packages)

View support map:
- Command: `safe-pkgs support-map`

### Private / Authenticated Registries

Point a registry client at a private mirror and authenticate with a bearer token via environment variables.

Base URL overrides (each defaults to the public endpoint when unset):

- npm:
  - `SAFE_PKGS_NPM_REGISTRY_API_BASE_URL` (package metadata; default `https://registry.npmjs.org`)
  - `SAFE_PKGS_NPM_DOWNLOADS_API_BASE_URL` (downloads; default `https://api.npmjs.org`)
  - `SAFE_PKGS_NPM_POPULAR_INDEX_API_BASE_URL` (popularity index; default `https://api.npms.io`)
- pypi:
  - `SAFE_PKGS_PYPI_PACKAGE_API_BASE_URL` (package metadata; default `https://pypi.org/pypi`)
  - `SAFE_PKGS_PYPI_DOWNLOADS_API_BASE_URL` (downloads; default `https://pypistats.org/api/packages`)
  - `SAFE_PKGS_PYPI_POPULAR_INDEX_URL` (popularity index; default top-pypi-packages JSON)
- cargo: no base-URL override env var yet; all calls use the crates.io API base (`https://crates.io/api/v1`).

Bearer-token auth — when set, requests send `Authorization: Bearer `:

- `SAFE_PKGS_NPM_REGISTRY_TOKEN`
- `SAFE_PKGS_PYPI_REGISTRY_TOKEN`
- `SAFE_PKGS_CARGO_REGISTRY_TOKEN`

The token is sent ONLY to the registry metadata/API host, to avoid leaking it to non-registry hosts:

- npm and pypi: the token is sent only to the package-metadata host. The downloads and popularity hosts (e.g. `api.npmjs.org`, `api.npms.io`, `pypistats.org`) receive no token, since they are separate third-party services.
- cargo: every request targets the same crates.io API base, so all of them (metadata, downloads, popular-crate listing) carry the token.

Empty or whitespace-only token values are treated as unset (no auth header is sent).

## Configuration

Global file:
- `~/.config/safe-pkgs/config.toml`

Project override:
- `.safe-pkgs.toml` (merged on top of global)

Minimal example:```toml
min_version_age_days = 7
min_weekly_downloads = 50
max_risk = "medium"

[cache]
ttl_minutes = 30

[allowlist]
packages = ["my-internal-pkg"]

[denylist]
packages = ["event-stream@3.3.6"]

Full configuration schema:
- docs/configuration-spec.md

MCP Config Example

macOS/Linux:```json
{
"servers": {
"safe-pkgs": {
"type": "stdio",
"command": "/path/to/safe-pkgs",
"args": ["serve"]
}
},
"inputs": []
}


Windows (no console window):```json
{
  "servers": {
    "safe-pkgs": {
      "type": "stdio",
      "command": "safe-pkgs-mcp.exe"
    }
  },
  "inputs": []
}

Decision Output Example```json

{
"allow": true,
"risk": "low",
"reasons": [
"lodash@3.10.1 is 1 major version behind latest (4.17.21)"
],
"evidence": [
{
"kind": "check",
"id": "staleness.behind_latest",
"severity": "low",
"message": "lodash@3.10.1 is 1 major version behind latest (4.17.21)",
"facts": {
"package_name": "lodash",
"resolved_version": "3.10.1",
"latest_version": "4.17.21",
"major_gap": 1
}
}
],
"fingerprints": {
"config": "c7d9f5b8b9a8f2a9f6b1f42f0e8e8c8a63f2b2ef8fdde1f3cd9ea4f5a2c08a0b",
"policy": "fca103ee4fd5b86595a6a6e933f8a5f87db0ce087f80744dc1ea9cdbf58f7a6f"
},
"metadata": {
"latest": "4.17.21",
"requested": "3.10.1",
"published": "2015-08-31T00:00:00Z",
"weekly_downloads": 45000000
}
}


## Lockfile Audit Output Example (`dependency_ancestry`)

Input lockfile (`package-lock.json`) used for this example:```json
{
  "name": "demo",
  "lockfileVersion": 2,
  "dependencies": {
    "react": {
      "version": "18.2.0",
      "dependencies": {
        "loose-envify": {
          "version": "1.4.0"
        }
      }
    }
  }
}

Audit output:```json
{
"allow": true,
"risk": "low",
"total": 2,
"denied": 0,
"packages": [
{
"name": "react",
"requested": "18.2.0",
"allow": true,
"risk": "low",
"reasons": [],
"evidence": []
},
{
"name": "loose-envify",
"requested": "1.4.0",
"allow": true,
"risk": "low",
"reasons": [],
"evidence": [],
"dependency_ancestry": {
"paths": [
{ "ancestors": ["react"] }
]
}
}
],
"fingerprints": {
"config": "<sha256>",
"policy": "<sha256>"
}
}


`paths[].ancestors` lists only ancestors (root to immediate parent), excluding the package itself.
For direct dependencies, `dependency_ancestry` is omitted.

`evidence.id` is stable and machine-oriented:
- Built-in checks: `.` (example: `staleness.behind_latest`)
- Custom rules: `custom_rule.` (example: `custom_rule.low-downloads`)
- Policy/runtime items: explicit IDs (example: `denylist.package`, `risk.medium_pair_escalation`)

## Trust and Security Posture

- Fail-closed behavior: check/runtime failures are surfaced and do not silently allow installs.
- Local audit trail: append-only audit log for decision review, with an optional remote HTTP backend (see `[audit]` in the configuration spec).
- Deterministic policy context: responses include `policy_snapshot_version`, config and policy fingerprints, and enabled check set.
- Local cache: SQLite cache keyed by policy fingerprint + package tuple with TTL expiry.

## Disclaimer

`safe-pkgs` works as an MCP tool that AI agents can call before installing packages. However, **we cannot guarantee that an AI agent will always choose to call this tool** — agentic models that autonomously select tools may proceed with package installation without invoking `check_package` or `check_lockfile` first, depending on the model, prompt context, and system prompt configuration.

If your AI agent skipped `safe-pkgs` when it should have called it, please open an issue with the prompt and response so we can improve tool descriptions and usage guidance.

## Roadmap

Prioritized planned work:

### Now

- [x] Dependency confusion defenses for internal/private package names
- [x] Policy simulation mode (`what-if`) without enforcement
- [x] Metrics/log schema for latency, cache hit ratio, and registry error rates
- [x] Support remote audit storage backends
- [x] Support remote config sources (GitHub repo, HTTP endpoint, etc.)
- [x] Support for private registries

### Next

- [ ] Policy waivers with expiry
- [ ] Package provenance checks (where ecosystem metadata supports it)
- [ ] Publisher trust signals (account age, maintainer churn, ownership changes)
- [x] Performance/scale improvements for large lockfiles:
  - [x] Configurable bounded concurrency (default: 5 parallel evaluations)
  - [x] Inter-batch delay to prevent API rate limiting (default: 100ms)
  - [x] Cache hit tracing for visibility
- [ ] Additional performance improvements (request coalescing for duplicate packages)

### Later

- [ ] NVD advisory enrichment
- [ ] Optional Snyk advisory provider
- [ ] Socket.dev integration
- [ ] GitHub Actions integration for CI auditing
- [ ] Registry-driven MCP schema and docs generation (single source of truth)
- [ ] HTTP Streamable MCP server option
- [ ] More validated editor config examples
- [ ] Git hook integration for pre-commit checks

## Development```bash
cargo fmt --all -- --check
cargo clippy --all-targets -- -D warnings
cargo test

Coverage

Install:```bash
rustup component add llvm-tools-preview
cargo install cargo-llvm-cov


Summary:```bash
cargo llvm-cov --workspace --all-features --summary-only

HTML report:```bash
cargo llvm-cov --workspace --all-features --html


Report path:
- `target/llvm-cov/html/index.html`

## Local Docs```bash
pip install zensical
zensical serve

> Note: This project now uses Zensical instead of MkDocs.
> MkDocs 2.0 drops the plugin system and breaks backward compatibility with no migration path (announcement).

Deterministic Evaluation Clock (Optional)

Set SAFE_PKGS_EVALUATION_TIME to an RFC3339 timestamp to force a fixed policy evaluation time (useful for replay/debug runs):bash SAFE_PKGS_EVALUATION_TIME=2026-01-01T00:00:00Z safe-pkgs audit /path/to/project ``````powershell $env:SAFE_PKGS_EVALUATION_TIME = &quot;2026-01-01T00:00:00Z&quot; safe-pkgs audit C:\path\to\project

常见问题

7 问
答案由本站依据条目字段整理,不引用上游原文
Safe Pkgs (Math280h) 怎么安装?

在客户端按下面的安装命令接入:pip install zensical。装完在客户端配置里引用同一个包或端点。

Safe Pkgs (Math280h) 怎么在客户端里配置?

它的传输方式未标注,在客户端 MCP 配置里按官方文档填写启动命令和参数,保存后重启客户端生效。

Safe Pkgs (Math280h) 收费吗?

本站不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

Safe Pkgs (Math280h) 需要 API Key 吗?

资料没有标注鉴权方式,是否需要密钥取决于服务本身,接入前按官方文档确认。

Safe Pkgs (Math280h) 能提供哪些能力?

资料显示能力标签包括 Python、审计日志、STDIO。具体工具清单以官方文档为准。

Safe Pkgs (Math280h) 需要什么运行环境?

运行时为 Python;属于本地进程,需要在本机装好运行环境。

Safe Pkgs (Math280h) 是本地还是远程?

它是本地进程(stdio),由客户端在本机拉起。传输方式为stdio · 本地进程。

热门专题

按标签挑服务器
全部专题 →

服务器信息以作者仓库与官方文档为准;分类、传输方式与鉴权方式的中文说明为中文整理,最近核验 2026-05-17。