toolhive icon indicating copy to clipboard operation
toolhive copied to clipboard

Pre-install security scanning integration: AgentShield + ToolHive

Open elliotllliu opened this issue 8 months ago • 2 comments

Hi ToolHive team! 👋

I maintain AgentShield, an open-source security scanner for AI agent skills, MCP servers, and plugins. I think there's a natural integration opportunity here.

The fit

ToolHive = secure MCP server deployment (container isolation, registry, governance) AgentShield = MCP server pre-install scanning (static analysis, vulnerability detection)

Together: scan before deploy, deploy with confidence.

What AgentShield does

  • npx @elliotllliu/agent-shield scan ./server/ — 30 rules, <1 second, 100% offline
  • Detects: data exfiltration, backdoors, prompt injection, tool poisoning, supply chain attacks
  • Cross-file data flow analysis + kill chain detection
  • Scoring system: 0-100 with risk levels
  • JSON output + --fail-under for CI/CD

Integration ideas

  1. Registry pre-scan — Automatically scan servers before they're added to the ToolHive registry
  2. Trust score — Use AgentShield's 0-100 score as an input to ToolHive's trust/provenance system
  3. One-click audit — Users browsing the Portal can see scan results before deploying

Happy to discuss and contribute. The goal is the same: make MCP safe for everyone.

🔗 https://github.com/elliotllliu/agent-shield

elliotllliu avatar Mar 13 '26 08:03 elliotllliu

We are currently already using another scanner for the registry. If you do have a proof of concept of the integration and want to reach out with that, you're welcome!

I'm going to close this, but feel free to re-open if such PoC is ready.

JAORMX avatar Mar 13 '26 09:03 JAORMX

Hey! Following up with the PoC you mentioned.

We built a thv-safe wrapper that hooks into the thv run workflow:

Repo: https://github.com/elliotllliu/agent-shield/tree/main/integrations/toolhive

How it works:

  1. thv-safe run <server> resolves the source repo from ToolHive registry
  2. Shallow-clones the source and runs AgentShield scan (30+ detection rules)
  3. Shows a security report with letter grade (A–F) across 5 dimensions
  4. If grade meets threshold → proceeds with thv run; if not → warns/blocks
thv-safe run fetch          # scan → report → confirm → run
thv-safe run fetch --yes    # auto-proceed if grade ≥ C
thv-safe scan fetch         # scan only

It's a standalone bash script — no changes to ToolHive internals needed. Could also be adapted as a registry-server webhook or a pre-deploy check in the operator.

Happy to iterate on this if you'd like a tighter integration. The scanner is also available as an npm package (@elliotllliu/agent-shield) for programmatic use.

elliotllliu avatar Mar 13 '26 16:03 elliotllliu