Kiridharan

skiridharan.me@gmail.com

Get in touch

toolaudit: a passive audit of what your AI agent can touch

How we built toolaudit, an open-source CLI that audits MCP servers and tool definitions without calling a single tool, and why authorization is required.

Published
Reading time
5 min
Project
toolaudit
Topics
  • Python 3.12
  • Pydantic
  • MCP
  • Typer
An AI agent linked to the tools it can call, each marked as safe to read or able to change things. agent tool surface read_file run_shell http_get write_db

An AI agent is only as safe as the tools you hand it. Give it a tool that runs shell commands with a free-form string, or fetches any URL it’s told to, and the model’s judgment becomes your security boundary. Auditing that surface by hand is slow and inconsistent: you read every tool description, every argument schema, every server setting, and you try to remember what you checked last time. We built toolaudit to make that audit faster and repeatable. It is a local command-line tool that enumerates the tools exposed to an agent — live MCP servers or static tool and function definitions — and produces a security report: one Markdown file for people, one JSON file for machines.

The code is open source at github.com/kiridharan/toolaudit, under Apache 2.0.

Passive by construction, not by promise

A security tool that might change the thing it’s inspecting is hard to point at a client’s system. So toolaudit only enumerates. It lists tools, resources and prompts, reads server information, and inspects schemas. It never calls a tool, sends a payload or mutates a target.

We didn’t want that to rest on good intentions, so it is enforced in the structure. The MCP client wrapper exposes only the listing and server-info calls; call_tool isn’t imported into the ingestion code at all, and a unit test asserts the symbol never appears there. Checks receive immutable data and return findings — they have no client handle, no socket and no file writer. Known-vulnerability matching reads a snapshot bundled with the tool, and a test runs the whole check phase with sockets patched to raise. If anything reaches for the network, the test fails.

The authorization block is the first check

Every scan config must carry an authorization block naming who authorized the audit and where the signed scope lives. Without it, toolaudit refuses to run, exits with code 2 and ingests nothing.

authorization:
  authorized_by: "Your Name"
  scope_doc: "link or reference to the signed audit scope"
  active_probing_allowed: false # record-only; this tool never probes actively

source: mcp
mcp:
  transport: stdio
  command: "node"
  args: ["path/to/server.js"]

This is a product decision more than a technical one. toolaudit is an audit tool, not a scanner you point at things you have no permission to assess. Requiring the scope up front also makes the report better: the authorization block is copied verbatim into it, so the document a client receives states on its face what was in scope and who approved it. The active_probing_allowed flag is recorded for the paperwork; in this build it gates nothing, because nothing probes.

One normalized model in the middle

Agent tools arrive in different shapes — an MCP server over stdio, SSE or HTTP, or a JSON file of Anthropic- or OpenAI-style tool definitions. The pipeline converts all of them into one model, AgentTool, right after ingestion. Everything downstream — capability mapping, checks, vulnerability matching, the report — is written against that model and never branches on where a tool came from, except through a declared applies_to field on each check.

The payoff is extensibility. Adding a new source is one new ingester class and a registry entry, with no edits to the rest of the pipeline. A dedicated test proves the shared checks fire identically regardless of source.

Between ingestion and checks sits a capability mapper. It tags each tool with what it can touch — command execution, filesystem read or write, outbound network, credentials, database, sending messages — using rules kept in a YAML file so analysts can tune them without touching code. Every tag records why it was applied and the exact text that matched.

What it checks

The checks are grouped into families, each reasoning about schemas and metadata rather than running anything:

FamilyWhat it looks for
Input validationFree-form arguments into execution tools, unconstrained paths, unconstrained URLs
Credential handlingTokens passed through to egress or send tools, over-broad scope
IntegritySteering or injection language in tool descriptions, missing version or provenance
Auth and transport (MCP)No auth on remote endpoints, no TLS, binding to all interfaces, DNS-rebinding signs
Known vulnerabilities (MCP)Offline match of server and SDK versions against a local snapshot

One rule we’re glad we wrote: if a server’s name matches a known-vulnerable entry but its version can’t be determined, toolaudit emits an informational finding asking for manual review. It never misses silently.

Reports are deterministic. The same input produces a byte-identical report apart from a single timestamp, because tools, findings and tags are sorted and the JSON is emitted with stable keys. That makes reports diffable between audits and testable against golden files.

What we’d tell a team building something similar

Enforce your safety properties in the structure of the code, then write a test that tries to break them; a reviewer can miss a stray call, but a missing import can’t be used. Put the human prerequisite — permission, scope, sign-off — in front of the first line of work, not in a disclaimer at the end. Normalize early, so every new input format costs one adapter rather than a rewrite. And be clear about limits: toolaudit is static analysis. It doesn’t fuzz, call tools, or study how an agent chains them at runtime, and it doesn’t replace an auditor’s judgment. It makes the manual audit faster and more consistent, which is the job we built it for.

If you’re putting agents in front of real systems and want the tool surface reviewed, get in touch.

Tell me what you are building.

For consulting, a build, or a question about a write-up.

  1. Full-stack developmentScalable frontend and backend systems with modern technologies.
  2. System architectureDistributed systems and microservices architectures.
  3. GenAI integrationAI-powered features and automation workflows.
  4. Technical consultingStrategic problem-solving and measurable client impact.

ChennaiIndia

Write to me

Or write directly

skiridharan.me@gmail.com