项目介绍
MCP 服务 · 2026-11-09 更新 · 本站尚未实测
CryptoGuard 是一个面向 AI 编码代理(README 举例为 Claude Code、Codex、Cursor 等)的“交易前钩子”,在加密交易真正执行前,对智能合约做风险分析,识别蜜罐、黑名单功能、撤池跑路和诈骗代币等问题。
它把多个安全数据源的结论汇总成一个 0 至 100 的风险分,再按阈值决定放行还是阻断。README 的定位是安全辅助层,不是资产托管工具,也不接触私钥或替代钱包签名。
除代理钩子外,它同时提供命令行检查和 Python API,因此也能脱离 AI 代理单独使用。
核心能力
点击能力名称查看输入、输出和原文依据。
- 交易前拦截:安装 Claude Code 钩子后,README 称会拦截
cast send、swap、approve等交易类命令并先做分析;此项为作者自述,实际覆盖范围待核验。 - 多源交叉验证:README 列出 GoPlus、Honeypot.is、TokenSniffer、De.Fi、QuickIntel 等安全数据源,以及自带的 EVM 字节码扫描模块。
- 风险类型覆盖:包括蜜罐、黑名单、余额篡改、自毁、极高卖出税、隐藏所有者、未锁流动性、未验证源码、巨鲸集中、可增发、可暂停转账、代理合约等,并按严重程度分级。
- 风险打分与动作:0 至 14 为 SAFE、15 至 29 为 LOW、30 至 49 为 MEDIUM、50 至 69 为 HIGH、70 至 100 为 CRITICAL,默认阈值为 HIGH。
- 多链接入:README 列出的链包括 Ethereum、BSC、Polygon、Arbitrum、Base、Optimism、Avalanche、Fantom、zkSync Era、Linea、Scroll、Mantle、Blast。
- 多种使用形态:CLI 检查、Claude Code 钩子、Python API
analyze()、stdio 传输的 MCP 服务。
实际应用场景
适用场景
- 让 AI 编码代理在真正发起链上交易前先做一次风险确认。
- 研究人员或开发者在命令行中快速核对某个代币合约的风险等级。
- 在自动化脚本里用退出码(0 表示未触发该工具的风险阈值,并非安全保证、1 表示中等、2 表示高或严重)作为放行条件。
- 通过 MCP 客户端把代币检查作为工具能力接入。
需注意:README 明确说明任何工具都无法保证 100% 检出骗局,新型手法可能绕过检测,作者建议自行研究。
安装与接入
README 的快速安装段出现 cryptoguard-ai-ai,而 PyPI 链接和另一安装段使用 cryptoguard-ai,两处不一致。为避免安装同名错误包,本页不提供有歧义的包安装命令。仓库另有源码开发路径:从 https://github.com/momenbasel/CryptoGuard.git 获取源码,按其 Development 章节在隔离环境安装依赖;版本、包来源及 Hook 适配应先人工核对。
安装 Claude Code 钩子:
cryptoguard install-hook
也可通过 --threshold 指定阻断阈值,选项包括 CRITICAL、MEDIUM。
手动检查代币:
cryptoguard check 0xdAC17F958D2ee523a2206206994597C13D831ec7 --chain ethereum
MCP 接入方面,README 给出的客户端配置为以 python -m cryptoguard.mcp_server 启动,属于本地 stdio 方式,未提供远程 HTTPS 端点。另有 cryptoguard serve 启动服务。
源码开发方式为克隆仓库后执行 pip install -e ".[dev]",再运行 pytest。
安装命令
git clone https://github.com/momenbasel/CryptoGuard.git
使用条件与限制
- 是否需要部署
- 需自行准备运行环境,具体要求见正文
- 是否需要注册
- 账号和认证要求见正文;未明确说明的项目仍待核验
- 是否需要 API Key
- 待核验
- 费用与额度
- 费用边界见正文,项目许可不代表模型或托管服务免费
- 所需权限
- 待核验
- 许可证与服务条款
- 待核验
权限费用与限制
- 权限:工具分析的是合约本身,README 称不涉及钱包签名方式;安装钩子会修改
~/.claude/settings.json,请在执行前确认该文件的改动。 - 凭据:README 称所有安全数据源均有免费公开额度,无需 API Key。但第三方接口的可用额度、限流和稳定性由其各自政策决定,是否长期免费待核验。
- 费用:仓库以 MIT 发布,但仓库开源不等于所用第三方数据服务永久免费,具体费用与配额待向各服务方核验。
- 时效:分析依赖并行 API 调用,README 称耗时约 2 至 5 秒。
- 局限:不保证全部骗局可被识别;风控判断本质上是提示性参考。
- 平台:文档仅说明为 Python 包,未声明 Windows、macOS、Linux 的具体支持情况,待核验。
国内使用情况
网友核验 用户经验分享
与站长实测独立,不代表官方认证或本站已实测。
最近核验:暂无有效核验。参与人数按当前项目有效身份去重;不同核验项分别统计,不合并成用户总结果。仅统计审核通过且未过期的记录。
分项统计、有效期与样本量
| 核验项目 | 有效人数 | 成功 / 部分 / 失败 / 无法判断 | 成功率 | 最近核验 / 有效期 |
|---|---|---|---|---|
| 官方网站访问 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 7 天 |
| GitHub 仓库访问 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 7 天 |
| 安装与运行 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 官方服务国内连接 / MCP 连接 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 国内网络情况 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 7 天 |
| 国内模型兼容性 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 自定义 API | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 海外服务依赖 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 海外账号要求 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 中文界面 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 客户端兼容性 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 账号及费用信息 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
成功率 = 成功 ÷(成功 + 部分成功 + 失败);无法判断不计入分母。至少 5 份可判断结果才显示成功率。账号、费用、海外依赖与语言等事实项,成功表示核查结论与资料吻合,具体观察另行统计;不表示免费或没有海外依赖。不同网络、客户端和版本的结果不能直接等同。
最近有效核验
暂无审核通过且未过期的网友核验。欢迎提交真实使用记录。
查看全部有效核验 →国内实测状态:国内可用性待核验。协议兼容和官方资料说明不等于国内网络可用。
- 官方网站访问
- 尚未实测 待核验
- GitHub 仓库访问
- 尚未实测 待核验
- 官方服务国内连接
- 尚未实测 待核验
- 国内网络情况
- 尚未实测 待核验
- 国内模型兼容性
- 尚未实测 待核验
- 自定义 API
- 尚未实测 待核验
- 海外服务依赖
- 尚未实测 待核验
- 海外账号要求
- 尚未实测 待核验
- 中文界面
- 尚未实测 待核验
- 国内最后核验时间
- 尚未实测
许可与国内使用
仓库代码采用 MIT 许可,可自由使用、修改和分发,并附带免责声明。
需要注意区分:MIT 只覆盖本仓库代码,不覆盖 GoPlus、Honeypot.is、TokenSniffer、De.Fi、QuickIntel 等第三方数据服务,这些服务各自的条款、配额与可用性需单独核验。
数据源均为境外服务,中国大陆网络环境下能否稳定访问、是否需要代理,资料未说明,待核验。项目文档未提及任何国内模型或国内链上数据源适配。
项目资料与来源
字段依据与待核验事项
access:来源确认 · git clone https://github.com/momenbasel/CryptoGuard.git
project_type:来源确认 · CryptoGuard is a pre-transaction hook for AI coding agents (Claude Code, Codex, Cursor, etc.) that automatically analyzes smart contracts before any crypto transaction is executed.
原始 README(折叠技术参考)
<p align="center">
<img src="assets/banner.svg" alt="CryptoGuard Banner" width="100%"/>
</p>
<p align="center">
<a href="https://pypi.org/project/cryptoguard-ai/"><img src="https://img.shields.io/pypi/v/cryptoguard-ai?color=00d4ff&style=flat-square" alt="PyPI"/></a>
<a href="https://github.com/momenbasel/CryptoGuard/blob/main/LICENSE"><img src="https://img.shields.io/github/license/momenbasel/CryptoGuard?color=00d4ff&style=flat-square" alt="License"/></a>
<a href="https://github.com/momenbasel/CryptoGuard/stargazers"><img src="https://img.shields.io/github/stars/momenbasel/CryptoGuard?color=00d4ff&style=flat-square" alt="Stars"/></a>
<a href="https://pypi.org/project/cryptoguard-ai/"><img src="https://img.shields.io/pypi/pyversions/cryptoguard-ai?color=00d4ff&style=flat-square" alt="Python"/></a>
</p>
# CryptoGuard
**AI agent safety layer that prevents crypto scams before they happen.**
CryptoGuard is a pre-transaction hook for AI coding agents (Claude Code, Codex, Cursor, etc.) that automatically analyzes smart contracts before any crypto transaction is executed. It detects honeypots, blacklist functions, rug pulls, and scam tokens by cross-referencing multiple independent security oracles.
## The Problem
AI agents are increasingly used to execute crypto transactions - swapping tokens, interacting with DeFi protocols, and managing wallets. But they have no built-in safety layer to detect:
- **Honeypot tokens** - You can buy but never sell
- **Blacklist contracts** - The owner can freeze your funds after you buy
- **Rug pulls** - Liquidity can be removed instantly
- **Tax manipulation** - Fees can be changed to 100% after purchase
- **Airdrop scams** - Malicious tokens sent to bait interaction
**CryptoGuard stops these before a single wei leaves your wallet.**
## How It Works
```
You/AI Agent: "swap 1 ETH for TOKEN_X on Uniswap"
|
[CryptoGuard Hook]
|
+-----------+-----------+
| | |
GoPlus API Bytecode Reputation
Security Scanner Aggregator
| | |
| +-----------+ |
| | honeypot.is| |
| | TokenSniffer| |
| | De.Fi | |
| | QuickIntel | |
| +-----------+ |
+-----------+-----------+
|
Risk Score: 0-100
|
SAFE -> Allow transaction
HIGH -> BLOCK transaction
```
### Data Sources
CryptoGuard queries **5+ independent security oracles** in parallel:
| Source | What it checks |
|--------|---------------|
| **GoPlus Security** | Honeypot, blacklist, tax, ownership, holders, liquidity |
| **Honeypot.is** | Buy/sell simulation on forked chain state |
| **TokenSniffer** | Automated audit score, similar known scams |
| **De.Fi Scanner** | DeFi protocol security issues |
| **QuickIntel** | Multi-chain token intelligence |
| **Bytecode Scanner** | Dangerous opcodes, blacklist selectors, proxy patterns |
### What It Detects
| Risk | Description | Severity |
|------|-------------|----------|
| Honeypot | Cannot sell tokens after buying | CRITICAL |
| Blacklist | Owner can freeze any address | CRITICAL |
| Balance manipulation | Owner can change anyone's balance | CRITICAL |
| Airdrop scam | Malicious token sent to bait interaction | CRITICAL |
| Self-destruct | Contract can destroy itself and drain funds | CRITICAL |
| Per-address tax | Owner can set 100% tax on YOUR address | CRITICAL |
| Cannot sell all | Trapped partial balance | CRITICAL |
| Extreme sell tax | >50% sell tax | CRITICAL |
| Hidden owner | Concealed admin control | HIGH |
| Unlocked liquidity | LP can be pulled (rug pull) | HIGH |
| Unverified source | Code not published for audit | HIGH |
| Whale concentration | Single wallet holds >20% supply | HIGH |
| Creator honeypot history | Deployer made honeypots before | HIGH |
| Modifiable tax/slippage | Fees can be changed post-buy | HIGH |
| Pausable transfers | Owner can halt all trading | HIGH |
| Proxy contract | Logic can be silently upgraded | MEDIUM |
| Mintable supply | New tokens can dilute holdings | MEDIUM |
| Low liquidity | High slippage or unable to sell | MEDIUM |
| Similar scam tokens | Code matches known scams | HIGH |
## Quick Start
### Install
```bash
pip install cryptoguard-ai-ai
```
### Install the AI Agent Hook (recommended)
```bash
# Automatically installs the Claude Code pre-transaction hook
cryptoguard install-hook
# Or with custom risk threshold
cryptoguard install-hook --threshold CRITICAL # Only block critical risks
cryptoguard install-hook --threshold MEDIUM # Block medium and above
```
### One-Line Install
```bash
pip install cryptoguard-ai && cryptoguard install-hook
```
### Manual Check
```bash
# Check a token on Ethereum
cryptoguard check 0xdAC17F958D2ee523a2206206994597C13D831ec7 --chain ethereum
# Check on BSC
cryptoguard check 0x... --chain bsc
# JSON output (for scripts)
cryptoguard check 0x... --chain polygon --output json
# Quick check (just risk level, for scripting)
cryptoguard check 0x... -q
echo $? # 0=safe, 1=medium, 2=high/critical
```
## Integration
### Claude Code (Automatic)
After `cryptoguard install-hook`, every `cast send`, `swap`, `approve`, and other transaction commands are automatically intercepted and analyzed.
The hook adds this to your `~/.claude/settings.json`:
```json
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hook": "python -m cryptoguard.hook"
}
]
}
}
```
### OpenAI Codex / Other Agents
Use CryptoGuard as a pre-exec wrapper:
```bash
# Wrap any command
cryptoguard check 0xTOKEN_ADDRESS --chain ethereum -q && cast send 0xTOKEN_ADDRESS ...
```
Or use the MCP server for tool-based integration:
```bash
# Start MCP server (stdio transport)
cryptoguard serve
```
### Python API
```python
from cryptoguard import analyze
result = analyze("0xdAC17F958D2ee523a2206206994597C13D831ec7", chain="ethereum")
print(f"Risk: {result.risk_level.value} ({result.risk_score}/100)")
print(f"Safe: {result.is_safe}")
print(f"Should block: {result.should_block}")
for finding in result.findings:
print(f" [{finding.severity.value}] {finding.title}")
```
### MCP Server
Add to your Claude Code MCP config or any MCP-compatible client:
```json
{
"mcpServers": {
"cryptoguard": {
"command": "python",
"args": ["-m", "cryptoguard.mcp_server"]
}
}
}
```
## Configuration
### Environment Variables
| Variable | Description | Default |
|----------|-------------|---------|
| `CRYPTOGUARD_DISABLE` | Set to `1` to bypass the hook | `0` |
| `CRYPTOGUARD_CHAIN` | Default chain if not detected | `ethereum` |
| `CRYPTOGUARD_THRESHOLD` | Min risk level to block (`CRITICAL`, `HIGH`, `MEDIUM`) | `HIGH` |
### Supported Chains
Ethereum, BSC, Polygon, Arbitrum, Base, Optimism, Avalanche, Fantom, zkSync Era, Linea, Scroll, Mantle, Blast
## Architecture
```
cryptoguard/
__init__.py # Public API
cli.py # Click CLI (check, install-hook, serve)
hook.py # AI agent pre-transaction hook
analyzer.py # Core analysis engine + risk scoring
scanner.py # EVM bytecode pattern analysis
goplus.py # GoPlus Security API client
reputation.py # Multi-source reputation aggregator
report.py # Terminal report formatter (Rich)
mcp_server.py # MCP server for tool-based integration
constants.py # Chains, selectors, weights
```
### Risk Scoring
Risk score is 0-100, computed from weighted findings with diminishing returns within categories:
| Score | Level | Action |
|-------|-------|--------|
| 70-100 | CRITICAL | Block transaction, show full report |
| 50-69 | HIGH | Block transaction, show findings |
| 30-49 | MEDIUM | Warn, allow with caution |
| 15-29 | LOW | Info only |
| 0-14 | SAFE | Allow silently |
Multiple sources confirming the same risk increase confidence. Trust-listed tokens get a score reduction.
## Development
```bash
git clone https://github.com/momenbasel/CryptoGuard.git
cd CryptoGuard
pip install -e ".[dev]"
# Run tests
pytest
# Lint
ruff check .
```
## FAQ
**Does this slow down my transactions?**
Analysis takes 2-5 seconds (parallel API calls). This runs only when a crypto transaction is detected, not on every command.
**Does it need API keys?**
No. All security oracles used have free public tiers. No API keys required.
**Can it detect all scams?**
No tool can guarantee 100% detection. CryptoGuard significantly reduces risk by cross-referencing multiple independent sources, but novel scam techniques may bypass detection. Always DYOR.
**Does it work with hardware wallets?**
CryptoGuard analyzes the contract, not the wallet. It works regardless of how you sign transactions.
**Can I use it without an AI agent?**
Yes. The CLI works standalone: `cryptoguard check 0x... --chain ethereum`
## License
MIT
## Credits
Built by [@momenbasel](https://github.com/momenbasel). Security data powered by GoPlus, Honeypot.is, TokenSniffer, De.Fi, and QuickIntel.
---
**If this tool saves you from a scam, star the repo and share it. Every star helps protect more people.**
历史前置条件说明(补充参考)
Python环境与MCP兼容客户端(可选);Claude Code Hook会写入用户设置。README的pip包名存在不一致,本页采用官方仓库源码开发路径介绍,安装前需人工核对包来源和版本。文档称无需API Key,但第三方数据源的配额、费用、网络及钩子兼容性仍待验证。
项目来源与清单版权许可
https://github.com/momenbasel/CryptoGuard
整理来源:https://github.com/slavakurilyak/awesome-ai-agents
清单版权与许可:
MIT License
Copyright (c) 2024 Slava Kurilyak
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.