Authoring Policies with dmint-cli
Manually authoring JSON security policies for dozens of tools can be error-prone. dmint-cli provides interactive wizards that use an LLM during development time to draft policies from natural language requirements (access.md).
Development-Time Only: The LLM is used only as a developer drafting assistant to write JSON. At runtime, the LLM is completely removed from the loop; Dmint evaluates the compiled policy.json deterministically.
The Policy Authoring Workflow
1. General Policy Authoring (create-policy)
For custom Python functions or local tool suites, use dmint create-policy:
The wizard prompts you for:
- Requirements file: Path to your
access.md (or defaults to typing requirements).
- Local capability discovery: Statically parses local Python files using Python’s
ast.parse() to discover @dmint.protected functions with zero code execution.
- LLM Provider: Choose OpenAI, Gemini, Groq, OpenRouter, or a local Ollama instance.
- Interactive refinement: Review the generated rules in terminal, request adjustments, and confirm.
Non-Interactive Batch Mode
For CI/CD pipelines or scripted setups:
2. Specialized MCP Policy Authoring (create-mcp-policy)
When working with external MCP servers, use dmint create-mcp-policy. This command:
- Spawns or connects to the live downstream MCP server.
- Dispatches
tools/list to retrieve exact tool names, schemas, and descriptions.
- Automatically namespaces the capabilities under the chosen
--integration-id.
- Generates both
policy.json and the corresponding mcp_protection.json.
3. Offline Verification (verify-policy)
Once generated, verify your policy file offline without calling any LLM:
Output:
Supported LLM Providers
dmint-cli supports any OpenAI-compatible or Gemini API endpoint:
Invariants Enforced During Authoring
To prevent insecure policy generation:
- Least Privilege Default: Unmentioned capabilities default to
DENY.
- No Wildcard Expansion: The compiler rejects attempts to replace specific resource scopes with unvetted wildcards (
*).
- Capability Pinning: The authoring wizard validates all generated rules against the real discovered tools; hallucinated tool names are rejected and retried automatically.