@sapper-ai/mcp
v0.3.3
Published
Model Context Protocol (MCP) security proxy for SapperAI
Maintainers
Readme
@sapper-ai/mcp
Model Context Protocol (MCP) security proxy for SapperAI. Wraps any MCP server with real-time threat detection.
Installation
pnpm add @sapper-ai/mcpQuick Start
CLI Usage
# Run security proxy in front of any MCP server
sapperai-proxy -- npx @modelcontextprotocol/server-example
# With custom policy
sapperai-proxy --policy ./policy.yaml -- npx mcp-server
# Watch local skill/plugin/config files and auto-quarantine blocked content
sapperai-proxy watch
# Override watched paths (repeatable)
sapperai-proxy watch --path ~/.claude/plugins --path ~/.config/claude-code
# List quarantined files
sapperai-proxy quarantine list
# Restore quarantined file
sapperai-proxy quarantine restore <id>Programmatic Usage
import { StdioSecurityProxy } from '@sapper-ai/mcp'
import { RulesDetector, DecisionEngine } from '@sapper-ai/core'
import type { Policy } from '@sapper-ai/types'
const policy: Policy = {
mode: 'enforce',
defaultAction: 'allow',
failOpen: true,
}
const detector = new RulesDetector()
const engine = new DecisionEngine([detector])
const proxy = new StdioSecurityProxy({
policy,
upstreamCommand: 'npx',
upstreamArgs: ['@modelcontextprotocol/server-example'],
})
await proxy.start()Watch + Quarantine Behavior
watchmonitors~/.claude/plugins,~/.config/claude-code, and current working directory by default.- On file add/change, SapperAI scans text/config surfaces via install-scan pipeline.
- If decision is
blockand policy mode isenforce, file is moved to~/.sapperai/quarantine. - Quarantine records are stored in
~/.sapperai/quarantine/index.json.
Policy Configuration
Create policy.yaml:
mode: enforce
defaultAction: allow
failOpen: true
toolOverrides:
executeCommand:
mode: enforce
detectors: [rules]
thresholds:
blockMinConfidence: 0.8API Summary
StdioSecurityProxy- Transparent MCP proxy with security scanningFileWatcher- Real-time file monitor for skill/plugin/config scanningrunCli()- CLI entrypoint for standalone proxyparseCliArgs(argv)- CLI argument parserresolvePolicy(path)- Load policy from YAML/JSON filerunWatchCommand()- Starts watch moderunQuarantineListCommand()- Prints quarantine recordsrunQuarantineRestoreCommand()- Restores one quarantine record by id
License
MIT
