Token导航 LogoToken导航TokenDH.com
Snyk MCP Workshop logo
AI代理stdio官方级别未说明来源级核验

Snyk MCP Workshop

MCP Server

Arcade MCP是一个安全优先的MCP服务器框架,通过运行时注入消除敏感数据在协议中的传递,适用于构建生产级的AI工具链。

工具数

5

提示词数

0

GitHub Stars

0

资源数

0
安全PythonAI代理

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

ArcadeAI

提供方

ArcadeAI

最后核验

2026/5/17 20:20

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

python3 server.py http

详细介绍

Building Secure MCP Servers

Snyk AI Security Summit Workshop

Breaking the Toxic Flow Triangle with Arcade MCP

______________________________________________________________________

🎯 你将在30分钟内建造什么

第1部分:安全MCP服务器框架

  • 5个生产质量工具
  • GitHub OAuth集成
  • 具有OAuth连续性的工具链
  • 安全第一架构

第2部分:街机网关

  • 立即访问1000多个生产工具包
  • 谷歌日历、Slack、Gmail、GitHub
  • 零代码,托管OAuth

结果:生产就绪的MCP服务器,消除了有毒流量三角的第二个因素

______________________________________________________________________

⚠️ 有毒物质流三角

         1️⃣ Untrusted Instructions
          (Prompt injection, jailbreaks)
                    │
          ┌─────────┴─────────┐
          │                   │
    2️⃣ Sensitive Data   3️⃣ Exfil Path
     (API keys, OAuth)    (Logs, Caches,
                           LLM Memory)

     When all three combine → TOXIC FLOW ☠️

传统MCP工具:所有3个因素都存在❌

# ❌ BAD: Traditional approach
def my_tool(api_key: str, repo: str) -> dict:
    # API key passed as parameter
    headers = {"Authorization": f"Bearer {api_key}"}
    # Token visible in protocol, logged, cached

客户电话:

{
  "tool": "my_tool",
  "args": {
    "api_key": "ghp_xxxxxxxxxxxx",  ← EXPOSED!
    "repo": "my-org/my-repo"
  }
}

问题:

  • ✘ 因素#2:协议中的API密钥
  • ✘ 因素#3:获取日志记录、缓存、LLM可见
  • ✘ 快速注入可以提取凭据
  • ✘ 非多租户(所有用户使用同一密钥)

街机MCP:消除因素#2✅

# ✅ GOOD: Arcade MCP approach
@app.tool(requires_auth=GitHub(scopes=["repo"]))
async def my_tool(context: Context, repo: str) -> dict:
    # OAuth token injected at runtime
    token = context.get_auth_token_or_empty()
    headers = {"Authorization": f"Bearer {token}"}
    # Token NEVER in protocol!

客户电话:

{
  "tool": "my_tool",
  "args": {
    "repo": "my-org/my-repo"  ← No API key!
  }
}

好处:

  • ✓ 因素2:令牌保持服务器端
  • ✓ 因素#3: 破碎的 -协议中没有敏感数据
  • ✓ 无法渗出不存在的东西
  • ✓ 多租户:每个用户都有自己的令牌

______________________________________________________________________

🏗️ 架构:Arcade MCP如何消除有毒物质流动

┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃                    MCP Client (Gemini CLI)                       ┃
┃                  "Fetch code from my-repo"                       ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
│
MCP Protocol (HTTP/stdio)
JSON-RPC messages
✅ NO CREDENTIALS HERE! ✅
│
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃         Arcade MCP Server (Your Tools)                        ┃
┃                                                               ┃
┃  ┌──────────────────────────────────────────────────────────┐ ┃
┃  │           MCP Protocol Handler                           │ ┃
┃  │  • Receives tool call request                            │ ┃
┃  │  • NO credentials in request!                            │ ┃
┃  └────────────────────────┬─────────────────────────────────┘ ┃
┃                           │                                   ┃
┃  ┏━━━━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓  ┃
┃  ┃  Context Injection Layer (THE MAGIC!)                   ┃  ┃
┃  ┃                                                         ┃  ┃
┃  ┃   ┌──────────────┐          ┌──────────────┐            ┃  ┃
┃  ┃   │   Secrets    │          │ OAuth Tokens │            ┃  ┃
┃  ┃   │   (.env)     │          │   (Arcade    │            ┃  ┃
┃  ┃   │              │          │   Platform)  │            ┃  ┃
┃  ┃   └──────┬───────┘          └──────┬───────┘            ┃  ┃
┃  ┃          │                         │                    ┃  ┃
┃  ┃          └──────────┬──────────────┘                    ┃  ┃
┃  ┃                     │                                   ┃  ┃
┃  ┃             ┌───────▼────────┐                          ┃  ┃
┃  ┃             │ Context Object │                          ┃  ┃
┃  ┃             │  • user_id     │                          ┃  ┃
┃  ┃             │  • session_id  │                          ┃  ┃
┃  ┃             │  • secrets     │ ◀─ Injected at runtime   ┃  ┃
┃  ┃             │  • auth tokens │ ◀─ Injected at runtime   ┃  ┃
┃  ┃             └───────┬────────┘                          ┃  ┃
┃  ┗━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛  ┃
┃                          │                                    ┃
┃  ┌───────────────────────▼──────────────────────────────────┐ ┃
┃  │  Tool Execution (with injected context)                  │ ┃
┃  │  tool.execute(context) ◀─ Has secrets & OAuth!           │ ┃
┃  └──────────────────────────────────────────────────────────┘ ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

╔═══════════════════════════════════════════════════════════════╗
║  💡 Credentials injected AFTER the protocol layer             ║
║      → LLM never sees them, can't leak them!                  ║
╚═══════════════════════════════════════════════════════════════╝

╔═══════════════════════════════════════════════════════════════════════╗
║  🔑 THE KEY POINT: The only way to solve this is with an              ║
║                    Agnostic Third Party Layer                         ║
║                                                                       ║
║  Credentials MUST be injected between the protocol and execution,     ║
║  never passed through the MCP protocol itself.                        ║
╚═══════════════════════════════════════════════════════════════════════╝

______________________________________________________________________

🛠️ 基于行动的工具!

为什么这些工具不同

传统API包装:1:1匹配REST端点,要求LLM理解HTTP语义

Arcade MCP工具:特定意图,法学硕士友好,设计安全

“LLMs关心 意图 (“设置我的日历”),而不是API参数(GET /calendar/v3/events?timeMin=...).Arcade工具是为LLM的思维方式而构建的。"

传统包装的问题

# Traditional: Mirrors REST API
def github_get_file(owner, repo, path, ref, access_token):
    """
    GET /repos/{owner}/{repo}/contents/{path}
    Query params: ref (optional)
    Headers: Authorization: Bearer {access_token}
    """
    # LLM must:
    # - Know HTTP semantics
    # - Manage OAuth tokens
    # - Handle error codes
    # - Parse JSON responses

LLM使用:

> Get the README from octocat/Hello-World

LLM thinks: "I need owner='octocat', repo='Hello-World', path='README.md', and... wait, where's my access_token? User, can you provide your GitHub token?"

问题:

  • LLM管理凭据(因素#2!)
  • LLM理解HTTP(认知开销)
  • 错误消息是HTTP代码
  • 非特定意图

Arcade MCP:特定意图工具

# Arcade MCP: Intent-based
@app.tool(requires_auth=GitHub(scopes=["repo"]))
async def fetch_github_code(
    context: Context,
    repo: Annotated[str, "Repository name (owner/repo)"],
    file_path: Annotated[str, "File to fetch"]
) -> str:
    """Fetch code from a GitHub repository.
    
    OAuth token is injected automatically.
    LLM never sees or manages credentials.
    """
    token = context.get_auth_token_or_empty()
    # Platform handles OAuth, tool uses it

LLM使用:

> Get the README from octocat/Hello-World

LLM thinks: "I have a tool `fetch_github_code`. Intent matches. Args: repo='octocat/Hello-World', file_path='README.md'. Call it."

好处:

  • ✓ LLM侧重于INTENT,而不是HTTP
  • ✓ 平台管理凭据(消除因素#2!)
  • ✓ 类型提示指南LLM(带注释的类型)
  • ✓ 结构化错误(JSON,而非HTTP代码)

这是范式的转变:为LLM构建的工具,而不是为调用REST API的人构建的工具。

______________________________________________________________________

🚀 车间设置(5分钟)

步骤1:克隆此存储库

git clone https://github.com/ArcadeAI/snyk-mcp-workshop
cd snyk-mcp-workshop
uv venv
source .venv/bin/activate

步骤2:安装Arcade安全MCP框架

# Install the Arcade Secure MCP Framework
uv tool install arcade-mcp

这为您提供了使用Arcade构建MCP服务器的一切:

  • arcade new 脚手架指挥
  • arcade login 用于OAuth管理

步骤3:安装依赖项

uv pip install httpx

步骤4:身份验证

# Create Arcade account (one-time)
arcade login

步骤5:创建新的安全MCP服务器

arcade new server-name 
## i.e. arcade new snyk_workshop

______________________________________________________________________

认识5个工具

特殊#1:运行服务器

# Set environment variable
export FILE_ACCESS_TOKEN="demo-file-access-token-2025"

# Start server with HTTP transport
python3 server.py http

您应该看到:

╔══════════════════════════════════════════════════════════════╗
║  Snyk Security Workshop - MCP Server                         ║
║  Transport: HTTP                                             ║
║  Tools: 5 (greet, read_file, analyze, fetch, audit)          ║
║  **Breaking the Toxic Flow Triangle!**                       ║
╚══════════════════════════════════════════════════════════════╝

特别#2:连接Gemini CLI

# Add Using The CLI
gemini mcp add snykhttp -t http http://127.0.0.1:8000/mcp

或编辑文件 ~/.gemini/settings.json

{
  "mcpServers": {
    "snykhttp": {
      "httpUrl": "http://127.0.0.1:8000/mcp"
    }
  }
}

然后在gemini cli中进行测试:

gemini
ctrl + t #lists tools 

工具1: greet -连接性测试

意图:测试基本MCP连接

代码:

@app.tool
def greet(name: Annotated[str, "Name to greet"]) -> str:
    return f"Hello, {name}! Welcome to Snyk AI Security Summit!"

测试:

> use snykhttp.greet to say hello to Workshop Attendees

为什么这很重要:简单,无需身份验证,证明MCP协议正常工作。

______________________________________________________________________

工具2: read_file -秘密注射模式

意图:读取具有访问控制的文件

代码:

@app.tool(requires_secrets=["FILE_ACCESS_TOKEN"])
def read_file(context: Context, path: str, max_bytes: int = 50000) -> dict:
    # Secret injected at runtime from .env
    token = context.get_secret("FILE_ACCESS_TOKEN")
    
    # Validate access (in production, check token against DB)
    # Read file with safety bounds
    
    return {
        "content": file_content,
        "note": f"Access validated with token (...{token[-4:]})"
    }

测试:

> use snykhttp.read_file to read examples/vulnerable_code.py

发生了什么 (以及为什么它具有良好的安全性):

Error: Tool 'snykhttp_ReadFile' cannot be executed over 
unauthenticated HTTP transport for security reasons. This tool requires 
end-user authorization or access to sensitive secrets.

See: https://docs.arcade.dev/en/home/compare-server-types

停止。这不是bug。这是极好的安全! 🎯

谈话轨迹 (研讨会期间):

“看看这个错误。Arcade拒绝在未经身份验证的HTTP上运行带有秘密的工具。这是设计上的安全性。 为什么?因为没有身份验证的HTTP是不受保护的。如果您的服务器在本地主机上运行,并且您网络上的其他人知道该端口,他们可以调用使用secrets的工具。Arcade可以防止这种情况。 这个错误证明Arcade非常重视安全性。它不会让你在不安全的传输中意外泄露秘密。 要在本地使用带有secrets或OAuth的工具,您有两个选择: 1. 使用 stdio传输 (过程隔离,安全) 1. 部署到 街机云 (经过身份验证的HTTPS) 让我给你看看stdio。.."

使用stdio进行演示:

# Stop HTTP server
# Start with stdio transport
python3 server.py stdio
# Configure Gemini CLI for stdio:
# Edit file ~/.gemini/settings.json
{
  "mcpServers": {
    "snykstdio": {
      "command": "/absolute/path/to/snyk-mcp-workshop/.venv/bin/python",
      "args": ["server.py", "stdio"],
      "cwd": "/absolute/path/to/snyk-mcp-workshop/",
      "env": {
        "FILE_ACCESS_TOKEN": "demo-token-2025"
      }
    }
  }
}
# Check Tools
gemini mcp list
#Restart after MCP check
gemini

# Now test again:
> use snykstdio.read_file to read examples/vulnerable_code.py

现在它奏效了! 返回文件内容 "note": "Access validated with token (...2025)"

防止有毒物质流动:

  • 因素#2:秘密在 .env,在运行时注入
  • LLM看到: "...2025" (仅限最后4个字符)
  • MCP协议中从未完全保密
  • 奖金:Arcade强制执行传输安全(不会在未受保护的HTTP上运行)

安全模型:

  1. 机密存储在 .env: FILE_ACCESS_TOKEN=demo-file-access-token-2025
  2. 工具装饰: @app.tool(requires_secrets=["FILE_ACCESS_TOKEN"])
  3. 拱廊检查运输:HTTP未授权? → 拒绝!stdio还是HTTPS? → 允许!
  4. 运行时: context.get_secret("FILE_ACCESS_TOKEN") 检索它
  5. MCP协议: {"tool": "read_file", "args": {"path": "..."}}没有秘密!

这是纵深防御:不仅是运行时注入,还有传输验证!

______________________________________________________________________

工具3: analyze_code_security -安全分析

意图:查找代码中的安全漏洞

代码:

@app.tool
async def analyze_code_security(context: Context, code: str) -> dict:
    await context.log.info("Analyzing code...")
    
    issues = []
    
    # Check for code injection
    if "eval(" in code:
        issues.append({
            "severity": "CRITICAL",
            "type": "Code Injection",
            "issue": "eval() usage detected"
        })
    
    # Check for unsafe deserialization
    if "pickle.loads(" in code:
        issues.append({
            "severity": "CRITICAL",
            "type": "Unsafe Deserialization",
            "issue": "pickle.loads() detected"
        })
    
    # + checks for os.system, SQL injection, hardcoded secrets, etc.
    
    return {
        "total_issues": len(issues),
        "severity_counts": {...},
        "issues": issues
    }

测试:

> use snykstdio.analyze_code_security to check:
import pickle
def process(data):
    obj = pickle.loads(data)
    eval(obj['cmd'])

结果:

{
  "total_issues": 2,
  "severity_counts": {"CRITICAL": 2},
  "issues": [
    {"severity": "CRITICAL", "type": "Unsafe Deserialization", "issue": "pickle.loads()"},
    {"severity": "CRITICAL", "type": "Code Injection", "issue": "eval()"}
  ],
  "recommendation": "❌ CRITICAL - Do not deploy"
}

为什么它对法学硕士很友好:

  • 基于意图:“分析此代码是否存在安全问题”
  • 不是:“POST/neneneba api/v1/security/scan with headers X-api-Key…”
  • 结构化输出LLM可以推理的JSON
  • 可操作:包括补救指导

______________________________________________________________________

工具4: fetch_github_code -OAuth注入

意图:从GitHub存储库获取代码

代码:

@app.tool(requires_auth=GitHub(scopes=["repo"]))
async def fetch_github_code(
    context: Context,
    owner: Annotated[str, "Repository owner"],
    repo: Annotated[str, "Repository name"],
    file_path: Annotated[str, "File path"]
) -> str:
    # OAuth token injected by Arcade platform
    token = context.get_auth_token_or_empty()
    
    # Proper GitHub API headers (following Arcade pattern)
    headers = {
        "Accept": "application/vnd.github.raw+json",
        "Authorization": f"Bearer {token}",
        "X-GitHub-Api-Version": "2022-11-28"
    }
    url = f"https://api.github.com/repos/{owner}/{repo}/contents/{file_path}"
    
    async with httpx.AsyncClient() as client:
        response = await client.get(url, headers=headers)
        response.raise_for_status()
        return response.text

测试:

> use snyk.fetch_github_code for the repo arcadeai/snyk-mcp-workshop/examples/hello_world.py

防止有毒物质流动:

  • 因素#2:Arcade管理的GitHub OAuth令牌
  • 用户 Authorize With OAuth URL → Arcade商店代币
  • 运行时:通过以下方式注入令牌 context.get_auth_token_or_empty()
  • MCP协议: {"tool": "fetch_github_code", "args": {"repo": "..."}没有令牌!

多住户:

  • Alice调用工具→ Gets GitHub代币
  • Bob调用工具→ Gets 他的 GitHub代币
  • 相同的服务器,隔离的凭据

工具5: security_audit_workflow - 🔥 哇的时刻

意图:完成安全审计(获取代码+分析)

代码:

@app.tool(requires_auth=GitHub(scopes=["repo"]))
async def security_audit_workflow(
    context: Context,
    repo: Annotated[str, "GitHub repository"],
    file_path: Annotated[str, "File to audit"]
) -> dict:
    await context.log.info(f"🔍 Starting audit for {repo}/{file_path}")
    
    # CHAIN 1: Fetch code from GitHub
    # Child tool INHERITS parent's GitHub OAuth!
    code_result = await context.tools.call_raw(
        "SnykSecurityServer.FetchGithubCode",
        {"repo": repo, "file_path": file_path}
    )
    
    # CHAIN 2: Analyze the fetched code
    analysis_result = await context.tools.call_raw(
        "SnykSecurityServer.AnalyzeCodeSecurity",
        {"code": code_result.value}
    )
    
    return {
        "repo": repo,
        "file": file_path,
        "security_analysis": analysis_result.value,
        "workflow": {
            "auth_flow": "GitHub OAuth shared across tool chain",
            "toxic_flow_prevention": "OAuth never in MCP protocol"
        }
    }

测试:

> use snyk.security_audit_workflow for the repo arcadeai/snyk-mcp-workshop/examples/hello_world.py

查看服务器日志:

INFO | 🔍 Starting security audit for octocat/Hello-World/README.md
INFO | Step 1: Fetching code from GitHub (using OAuth)...
INFO | Step 1 complete: Fetched 1234 characters
INFO | Step 2: Analyzing code for security vulnerabilities...
INFO | Step 2 complete: Found 0 potential issues
INFO | ✅ Security audit workflow complete!

OAuth连续性-魔法:

┌─────────────────────────────────────────────────────────┐
│  Parent Tool: security_audit_workflow                   │
│  Has GitHub OAuth from @app.tool(requires_auth=GitHub())│
└──────────────────────┬──────────────────────────────────┘
                       │
         context.tools.call_raw("FetchGithubCode", ...)
                       │
┌──────────────────────▼──────────────────────────────────┐
│  Child Tool: fetch_github_code                          │
│  INHERITS parent's GitHub OAuth token!                  │
│  Same token, no re-auth, secure propagation             │
└──────────────────────┬──────────────────────────────────┘
                       │ Returns code
┌──────────────────────▼──────────────────────────────────┐
│  Child Tool: analyze_code_security                      │
│  Analyzes the fetched code (no auth needed)             │
└──────────────────────┬──────────────────────────────────┘
                       │ Returns analysis
┌──────────────────────▼──────────────────────────────────┐
│  Parent Tool: Combines results                          │
│  Returns comprehensive audit report                     │
└─────────────────────────────────────────────────────────┘

SAME GitHub token through 3 tools!
LLM never saw it in ANY MCP call!

大规模防止有毒物质流动:

  • 一个OAuth令牌
  • 三个工具(家长+2个孩子)
  • 两个GitHub API调用
  • MCP协议中无出现

这是建筑安全。

为什么这是革命性的:

  • 可组合:使用简单工具构建复杂的工作流程
  • 安全:OAuth传播,从不公开
  • LLM友好:“从GitHub审核此文件”(一个意图,多步骤执行)
  • 不是传统API:LLM看不到OAuth流、HTTP谓词、标头管理

______________________________________________________________________

🔗 工具链:可组合安全

为什么工具链很重要

无链式:每个工具都是隔离的,LLM坐标

LLM: Call fetch_code → Get result → Call analyze → Get result → Combine
     ↑ LLM has to manage state and coordinate

带链锁:工具编排,LLM给出意图

LLM: Call security_audit_workflow
Tool: Fetches code → Analyzes → Returns combined report
      ↑ Tool manages workflow, LLM just states intent

好处:

  • LLM更简单:一个意图(“审核此文件”)与多步骤协调
  • 安全OAuth在链中流动,LLM永远看不到它
  • 可组合:从简单的构建块构建复杂的工作流程
  • 原子:工作流作为一个单元成功或失败

如何 context.tools.call_raw() 作品

# Parent tool
@app.tool(requires_auth=GitHub(scopes=["repo"]))
async def parent_tool(context: Context) -> dict:
    # Context has:
    # - context.user_id: "alice"
    # - context.session_id: "sess_123"
    # - context.authorization: {github_token}
    
    # Call child tool
    result = await context.tools.call_raw(
        "SnykSecurityServer.ChildTool",
        {"param": "value"}
    )
    
    # Child tool executed with SAME context:
    # - Same user_id: "alice"
    # - Same session_id: "sess_123"
    # - Same authorization: {github_token}
    
    return result.value

关键洞察: context 自动传播。孩子继承了父母的证书、会话和一切。

______________________________________________________________________

🌐 第2部分:Arcade网关-即时生产工具

Arcade Gateway是什么?

一个统一的安全MCP服务器,无需编写代码即可公开1000多个生产工具包。 网关是您进行安全和治理管理的集中区域。

┌───────────────────────────────────────────────────────────┐
│              Arcade Gateway Architecture                  │
│                                                           │
│  Gemini CLI ────► Arcade Gateway ────► Toolkits           │
│                   (One endpoint)        │                 │
│                                         ├─► Google        │
│                                         ├─► Slack         │
│                                         ├─► Gmail         │
│                                         ├─► GitHub        │
│                                         ├─► Notion        │
│                                         └─► 1k+ more      │
│                                                           │
│  Benefits:                                                │
│  ✓ No code to write                                       │
│  ✓ OAuth managed by Arcade                                │
│  ✓ One security boundary                                  │
│  ✓ Centralized governance                                 │
└───────────────────────────────────────────────────────────┘

设置步骤

1.创建网关(5分钟)

访问 仪表板.arcade.dev:

  1. 点击 “MCP网关”“创建网关”
  2. 姓名: Snyk Workshop Gateway
  3. 选择工具包:

- ✅ 谷歌(日历、Gmail、云端硬盘) - ✅ Slack(频道、消息) - ✅ 1000+更多可用

  1. 保存 并复制:

- 网关段塞(例如。, snyk-workshop-abc123)

  1. 创建API密钥

- 点击 获取API密钥 - 创建API密钥

2.配置Gemini CLI

使用Gemini CLI命令:

gemini mcp add arcade -t http https://api.arcade.dev/mcp/YOUR-SLUG -H "Authorization: Bearer arc_YOUR_PROJECT_API_KEY" -H "Arcade-User-ID: your@email.com"

或编辑 ~/.gemini/settings.json:

{
  "mcpServers": {
    "snykhttp": {
      "httpUrl": "http://127.0.0.1:8000/mcp"
    },
    "arcade": {
      "httpUrl": "https://api.arcade.dev/mcp/YOUR-SLUG",
      "headers": {
        "Authorization": "Bearer ",
        "Arcade-User-ID": ""
      }
    }
  }
}

替换:

  • YOUR-SLUG → 你的网关蛞蝓
  • YOUR_PROJECT_API_KEY → 您的项目API密钥
  • YOUR_EMAIL → 您的Arcade帐户电子邮件

3.测试两台服务器

gemini mcp list #You Should See 2 Servers

您将看到两台服务器:

MCP Servers:
1. snyk_security (5 tools)
   - greet
   - read_file
   - analyze_code_security
   - fetch_github_code
   - security_audit_workflow

2. arcade_gateway (Many+ tools)
   - Google.Calendar.ListEvents
   - Google.Calendar.CreateEvent
   - Slack.PostMessage
   - Gmail.SendEmail
   - GitHub.CreateIssue
   - ... and more

测试自定义服务器:

> use snykhttp.analyze_code_security to check: import pickle; pickle.loads(data)

测试网关:

> What emails did I get this morning? And what is on my calendar right now?

为什么两者都用?

自定义服务器(您构建的):

  • ✓ 自定义业务逻辑
  • ✓ 安全专用工具
  • ✓ 完全控制实施
  • ✓ 您的知识产权

街机网关:

  • ✓ 即时生产工具包
  • ✓ 无需维护代码
  • ✓ OAuth已处理
  • ✓ 由Arcade管理的更新

一起:定制+商品=完整解决方案

______________________________________________________________________

🔐 逃离有毒物质流三角:完整分析

因素1:不可信的指令

它是什么:快速注入、越狱、恶意用户输入

我们如何减轻:

  • 类型验证: Annotated[str, "description"] LLM指南
  • 输入边界: max_bytes 限制防止DoS
  • 结构化错误:返回JSON,而不是堆栈跟踪
  • 基于意图的设计:工具匹配LLM推理模式

我们能消除它吗? 不可以。用户必须与人工智能交互。但我们会验证。

______________________________________________________________________

因素#2:敏感数据

它是什么:API密钥、OAuth令牌、数据库凭据

我们如何消除它:

  • 秘密在 .env: FILE_ACCESS_TOKEN 存储外部代码
  • OAuth平台: @app.tool(requires_auth=GitHub) → Arcade管理代币
  • 运行时注入: context.get_secret(), context.get_auth_token_or_empty()
  • 从不在协议中:MCP消息不包含凭据

我们能消除它吗? 对! 凭据保持在服务器端。协议是干净的。

这是突破:消除因子#2=三角形断裂。

______________________________________________________________________

因素3:Exfil路径

它是什么:日志、缓存、LLM对话内存、调试输出

我们如何打破它:

  • 没有数据可供提取:如果排除因素2,则协议中没有任何敏感内容
  • 日志干净:服务器日志不会回显机密(我们仅显示最后4个字符)
  • LLM内存清理:对话历史记录没有凭据
  • 缓存安全:MCP客户端缓存无凭据的协议消息

我们能消除它吗? 我们不需要!如果没有因素2,就没有什么对渗出敏感的。

______________________________________________________________________

结果:建筑防止有毒物质流动

传统MCP:

1️⃣ Untrusted input + 2️⃣ Credentials in protocol + 3️⃣ Logs/caches = ☠️ TOXIC FLOW

街机MCP:

1️⃣ Untrusted input + ❌ (Factor #2 eliminated) + 3️⃣ Exfil path = ✅ SAFE
                        ↑
              No sensitive data in protocol
              = Nothing to exfiltrate

你不能泄露协议中没有的东西。

💡 关键要点

你学到了什么

  1. 有毒流体三角:3个因素共同造成了人工智能安全风险
  2. 建筑安全:设计旨在预防,而不仅仅是检测
  3. 运行时注入:秘密/Outhe在执行时注入,从不在协议中注入
  4. 工具链:具有安全上下文传播的可组合工作流
  5. 意图特定工具:为LLM构建,而不是传统的REST API
  6. 网关模式:定制工具+商品集成

为什么这很重要

街机MCP之前:

  • 硬编码或作为参数传递的凭据
  • LLM可见的OAuth令牌
  • 工具隔离,LLM坐标
  • 因素#2和#3存在→ 有毒物质流动风险

使用Arcade MCP:

  • 仅限服务器端凭据
  • 通过上下文进行运行时注入
  • 共享安全上下文的工具链
  • 因素#2已消除→ 三角形断裂

结果:你可以管理你能观察到的东西,你不能泄露不存在的东西。

______________________________________________________________________

简单。安全。生产准备就绪。

🚀 开始使用 | 📖 阅读文档 | 💬 加入Discord

______________________________________________________________________

Built with ❤️ @Arcade.dev for AI devs who care about security

目录标签

目录标签

安全PythonAI代理MCP协议本地部署OAuth集成安全架构工具链AI安全

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

oauth

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

5

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiooauth部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP