Metadata-Version: 2.4
Name: dmint-mcp
Version: 1.1.0
Summary: MCP proxy server and tool enforcement gateway for Dmint
License-Expression: Apache-2.0
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Security
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: dmint<2.0.0,>=1.0.0
Requires-Dist: mcp>=2.2.0
Requires-Dist: anyio>=4.9
Requires-Dist: starlette>=0.27
Requires-Dist: uvicorn>=0.31
Requires-Dist: httpx2>=2.5
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
Requires-Dist: ruff>=0.4.0; extra == "dev"
Requires-Dist: mypy>=1.10.0; extra == "dev"
Requires-Dist: dmint-cli<2.0.0,>=1.0.0; extra == "dev"
Requires-Dist: dmint-dashboard<2.0.0,>=1.0.0; extra == "dev"
Provides-Extra: test
Requires-Dist: pytest>=8.0.0; extra == "test"
Requires-Dist: pytest-cov>=5.0.0; extra == "test"
Requires-Dist: dmint-cli<2.0.0,>=1.0.0; extra == "test"
Requires-Dist: dmint-dashboard<2.0.0,>=1.0.0; extra == "test"
Dynamic: license-file

# dmint-mcp

[![CI](https://github.com/dmint-app/dmint-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/dmint-app/dmint-mcp/actions/workflows/ci.yml)
[![PyPI](https://img.shields.io/pypi/v/dmint-mcp.svg)](https://pypi.org/project/dmint-mcp/)
[![Python 3.10+](https://img.shields.io/pypi/pyversions/dmint-mcp.svg)](https://pypi.org/project/dmint-mcp/)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)

Security enforcement gateway for Model Context Protocol (MCP) servers.

`dmint-mcp` connects AI agents (Cursor, Claude Code, Antigravity) to downstream MCP servers under deterministic policy control. It intercepts `tools/call` invocations, blocks unapproved actions before execution, and protects remote endpoints against SSRF and metadata exfiltration.

---

## Installation

```bash
pip install dmint-mcp
```

---

## Quickstart

### 1. Configure Protection (`mcp_protection.json`)

```json
{
  "policy_file": "policy.json",
  "approval_db": "./approvals.sqlite3",
  "approval_ttl": 300,
  "integrations": [
    {
      "integration_id": "postgres",
      "transport": "stdio",
      "connection": {
        "command": "npx",
        "args": ["-y", "@modelcontextprotocol/server-postgres", "postgresql://localhost/mydb"]
      },
      "tool_bindings": {
        "query": {
          "tool_name": "query",
          "capability": "postgres.query",
          "discovery": "exposed"
        }
      }
    }
  ]
}
```

### 2. Run the Gateway

```bash
dmint-mcp run --config mcp_protection.json
```

Or configure your AI client (e.g. `.cursor/mcp.json`):

```json
{
  "mcpServers": {
    "protected-db": {
      "command": "python",
      "args": ["-m", "dmint_mcp", "run", "--config", "/path/to/mcp_protection.json"]
    }
  }
}
```

---

## Key Capabilities

- **Pre-Execution Gate**: Unapproved (`APPROVAL_REQUIRED`) and forbidden (`DENY`) tool calls are halted before reaching downstream server processes.
- **SSRF Defenses**: Validates remote HTTP endpoints against RFC 1918 private IPs, loopback addresses, and cloud metadata services (`169.254.169.254`).
- **Multi-Server Aggregation**: Routes and namespaces tools across multiple downstream servers with collision avoidance.
- **Atomic Approval Consumption**: Verifies Ed25519-signed human approval assertions and consumes them atomically in SQLite before executing approved retries.

---

## Documentation

Full configuration guides and schema specifications are available at [docs.dmint.app/guides/protecting-mcp](https://docs.dmint.app/guides/protecting-mcp).

---

## Dmint Ecosystem

- [`dmint`](https://github.com/dmint-app/dmint): Core deterministic authorization engine & SQLite store.
- [`dmint-cli`](https://github.com/dmint-app/dmint-cli): Developer CLI for authoring, verifying, and running dashboards.
- [`dmint-mcp`](https://github.com/dmint-app/dmint-mcp): Out-of-process gateway for Model Context Protocol servers.
- [`dmint-dashboard`](https://github.com/dmint-app/dmint-dashboard): Local human approval web UI.
- [`dmint-skills`](https://github.com/dmint-app/dmint-skills): Agent skills for policy authoring assistants.
- [`dmint-examples`](https://github.com/dmint-app/dmint-examples): Reference integrations and attack mitigation testbeds.

---

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and pull request guidelines.

---

## License

Licensed under the [Apache License, Version 2.0](LICENSE).
