问题所在
金融AI代理需要网页搜索来验证股票数据、查SEC文件和监控新闻。但给金融代理直接互联网访问会产生合规和安全顾虑。
Scavio 解决方案
使用Scavio的MCP服务器作为沙箱化搜索层。代理连接mcp.scavio.dev/mcp,只能调用预定义的搜索工具。无直接互联网访问,所有查询被审计记录。
之前
金融代理没有搜索能力因为合规团队阻止了直接互联网访问。代理无法验证实时股价或查找SEC文件。
之后
金融代理连接Scavio MCP。可以通过沙箱化API搜索股票数据和SEC文件。所有查询被记录用于合规审计。
适用人群
构建需要网页搜索但必须满足合规要求的AI代理的金融服务团队。
核心优势
- 沙箱化搜索:代理无直接互联网访问
- 所有查询记录用于合规审计
- MCP协议限制代理只能执行搜索操作
- 无通过URL参数的数据泄露
- 合规友好的单一可审计端点
Python 示例
Python
import requests, os, json, logging
from datetime import datetime
API_KEY = os.environ["SCAVIO_API_KEY"]
MCP_URL = "https://mcp.scavio.dev/mcp"
HEADERS = {"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}
# Audit logger for compliance
logging.basicConfig(filename="financial_search_audit.log", level=logging.INFO)
def audited_search(query: str, agent_id: str) -> dict:
"""Sandboxed search with audit logging for financial agents."""
# Log the query for compliance
logging.info(json.dumps({
"timestamp": datetime.now().isoformat(),
"agent_id": agent_id,
"query": query,
"action": "search",
}))
payload = {
"jsonrpc": "2.0", "id": 1,
"method": "tools/call",
"params": {"name": "search", "arguments": {"query": query, "country_code": "us"}}
}
resp = requests.post(MCP_URL, headers=HEADERS, json=payload, timeout=15)
result = resp.json().get("result", {})
# Log the response metadata (not full content for compliance)
logging.info(json.dumps({
"timestamp": datetime.now().isoformat(),
"agent_id": agent_id,
"result_count": len(str(result)),
"action": "search_complete",
}))
return result
# Financial agent searches through sandboxed MCP
result = audited_search("NVDA Q1 2026 earnings SEC filing", "fin-agent-001")
print(f"Search result: {json.dumps(result)[:200]}")JavaScript 示例
JavaScript
const MCP_URL = 'https://mcp.scavio.dev/mcp';
const H = {'Authorization': 'Bearer '+process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json'};
function auditLog(entry) { console.log('[AUDIT]', JSON.stringify({...entry, timestamp:new Date().toISOString()})); }
async function auditedSearch(query, agentId) {
auditLog({agentId, query, action:'search'});
const payload = {jsonrpc:'2.0', id:1, method:'tools/call', params:{name:'search', arguments:{query, country_code:'us'}}};
const r = await fetch(MCP_URL, {method:'POST', headers:H, body:JSON.stringify(payload)});
const result = (await r.json()).result || {};
auditLog({agentId, resultSize:JSON.stringify(result).length, action:'search_complete'});
return result;
}
const result = await auditedSearch('NVDA Q1 2026 earnings SEC filing', 'fin-agent-001');
console.log('Search result:', JSON.stringify(result).slice(0,200));使用的平台
包含知识图谱、PAA和AI概览的网页搜索