Metadata-Version: 2.4
Name: technitium-dns-mcp
Version: 2.2.0
Summary: Technitium DNS Server MCP Server and Agent for Agentic AI!
Author-email: Project Maintainers <maintainers@users.noreply.github.com>
License: MIT
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: MIT License
Classifier: Environment :: Console
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Requires-Python: <3.15,>=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: agent-connector-sdk[mcp]<1.0.0,>=0.2.1
Requires-Dist: requests>=2.34.2
Provides-Extra: mcp
Requires-Dist: agent-connector-sdk[mcp]<1.0.0,>=0.2.1; extra == "mcp"
Provides-Extra: all
Requires-Dist: agent-connector-sdk[mcp]<1.0.0,>=0.2.1; extra == "all"
Provides-Extra: test
Requires-Dist: pytest-xdist>=3.8.0; extra == "test"
Requires-Dist: pytest>=9.1.1; extra == "test"
Requires-Dist: pytest-asyncio>=1.4.0; extra == "test"
Requires-Dist: pytest-cov>=7.1.0; extra == "test"
Dynamic: license-file

# Technitium DNS MCP Server & Agent

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
[![Python Version](https://img.shields.io/badge/python-3.11%20%7C%203.12-blue)](pyproject.toml)

> **Documentation** — Installation, deployment, usage across the API, CLI, and MCP
> interfaces, and guidance for provisioning the Technitium DNS Server are maintained
> in the [official documentation](https://knuckles-team.github.io/technitium-dns-mcp/).

---

## 🚀 Key Features

- **100% API Coverage**: Complete mapping of Technitium User/SSO, Dashboard Analytics, Zone Management, DNSSEC, and Record Actions.
- **FastMCP Protocol Integration**: Dynamically registers stdio and streamable-http endpoints for large-scale AI tool discovery.
- **Strict Compliance**: Designed in accordance with standard codebase-wide architectural patterns (`agent-packages`).

---

## 🛠️ Installation & Setup

> **Install the connector-focused `[mcp]` extra.** Examples use `technitium-dns-mcp[mcp]` to add
> FastMCP / FastAPI through `agent-connector-sdk`; the required Agent Connector SDK core
> enables model orchestration.

Pick the extra that matches what the operator want to run:

| Extra | Installs | Use when |
|-------|----------|----------|
| `technitium-dns-mcp[mcp]` | Connector-focused MCP server (`agent-connector-sdk` — FastMCP/FastAPI + `epistemic-graph[full]`) | The operator only run the **MCP server** (smallest install / image) |
| `technitium-dns-mcp[all]` | Everything (`mcp` + `agent` + `logfire`) | Development / both surfaces |

```bash
# Connector-focused MCP server (includes the shared graph engine)
uv pip install "technitium-dns-mcp[mcp]"

# Agent runtime (adds model orchestration to the shared graph engine)

# Everything (development)
uv pip install "technitium-dns-mcp[all]"      # or: python -m pip install "technitium-dns-mcp[all]"
```

### Container images (`:mcp`)

One multi-stage `docker/Dockerfile` builds the MCP-only image (`--target mcp`):

| Image tag | Build target | Contents | Entrypoint |
|-----------|--------------|----------|------------|
| `example/technitium-dns-mcp:mcp` | `--target mcp` | `technitium-dns-mcp[mcp]` — **connector-focused**, includes `epistemic-graph[full]`; no model-orchestration stack | `technitium-dns-mcp` |

```bash
docker build --target mcp   -t example/technitium-dns-mcp:mcp    docker/   # connector-focused MCP server
```

### Knowledge-graph database (`epistemic-graph`)

Agent Connector SDK core dependency (`epistemic-graph[full]`). The `[mcp]` extra keeps
deployments can use the bundled engine. For production or shared state, run
**epistemic-graph as a dedicated database service** and configure the runtime to use it.
Deployment recipes (single-node + Raft HA), connection configuration, and architecture
diagrams are documented in the
[epistemic-graph deployment guide](https://knuckles-team.github.io/epistemic-graph/deployment/).

### Credential-bearing user operations

Login, token creation, session information, and 2FA initialization return sanitized
results in every MCP tool mode. Credential fields (including 2FA secrets and QR
images) are omitted, including inside nested response objects. Session identifiers
and other management metadata remain available. Use the Technitium DNS console
for workflows that need token values or authenticator enrollment. These operations do
not replace the connector's configured authentication token. Request failures expose
only their exception category and operation, without raw URLs, bodies, or chained
transport exceptions.

### Environment Variables

<!-- ENV-VARS-TABLE:START -->

#### Package environment variables

| Variable | Example | Description |
|----------|---------|-------------|
| `TECHNITIUM_DNS_URL` | — | Technitium DNS Server URL (required) |
| `TECHNITIUM_DNS_TOKEN` | secret-injected | Technitium DNS API Token / SSO Token |
| `TLS_PROFILE` | `private-pki` | TLS verification is mandatory. Select a named runtime profile from AgentConfig. |
| `TLS_PROFILES_REF` | `secret://runtime/tls-profiles` |  |
| `TECHNITIUM_DNS_TLS_PROFILE` | `private-pki` | Optional Technitium-specific named TLS profile override |
| `TECHNITIUM_DNS_TLS_PROFILE_REF` | `secret://runtime/technitium-dns-tls-profile` | Optional runtime reference to the Technitium-specific TLS profile |
| `TRANSPORT` | `stdio` | MCP transport configuration (streamable-http or stdio) |
| `HOST` | `0.0.0.0` |  |
| `PORT` | `8000` |  |
| `DASHBOARDTOOL` | `True` | These names match the authoritative "Toggle Env Var" column in the README MCP tools table (condensed action-routed surface). |
| `USERTOOL` | `True` |  |
| `ZONESTOOL` | `True` |  |
| `INGESTTOOL` | `True` | Enable the knowledge-graph ingestion tool registrar |

#### Inherited agent-connector-sdk variables (apply to every connector)

| Variable | Example | Description |
|----------|---------|-------------|
| `MCP_TOOL_MODE` | `intent` | Tool surface: `intent` \| `condensed` \| `verbose` \| `both` |
| `MCP_ENABLED_TOOLS` | — | Comma-separated tool allow-list |
| `MCP_DISABLED_TOOLS` | — | Comma-separated tool deny-list |
| `MCP_ENABLED_TAGS` | — | Comma-separated tag allow-list |
| `MCP_DISABLED_TAGS` | — | Comma-separated tag deny-list |
| `EUNOMIA_TYPE` | `none` | Authorization mode: `none` \| `embedded` \| `remote` |
| `EUNOMIA_POLICY_FILE` | `mcp_policies.json` | Embedded Eunomia policy file |
| `EUNOMIA_REMOTE_URL` | — | Remote Eunomia authorization server URL |
| `ENABLE_OTEL` | `False` | Enable OpenTelemetry export |
| `OTEL_EXPORTER_OTLP_ENDPOINT` | — | OTLP collector endpoint |
| `MCP_CLIENT_AUTH` | — | Outbound MCP child auth: `oidc-client-credentials` \| `basic` \| `none` |
| `OIDC_CLIENT_ID` | — | OIDC client id (service-account auth) |
| `OIDC_CLIENT_SECRET_REF` | `secret://identity/oidc-client-secret` | Runtime secret reference for the OIDC service account |
| `MCP_BASIC_AUTH_USERNAME` | — | HTTP Basic username (`MCP_CLIENT_AUTH=basic`) |
| `MCP_BASIC_AUTH_PASSWORD_REF` | `secret://identity/mcp-basic-password` | Runtime secret reference for HTTP Basic auth (`MCP_CLIENT_AUTH=basic`) |
| `DEBUG` | `False` | Verbose logging |
| `PYTHONUNBUFFERED` | `1` | Unbuffered stdout (recommended in containers) |
| `MCP_URL` | `http://localhost:8000/mcp` | URL of the MCP server the agent connects to |
| `PROVIDER` | — | Operator-configured LLM provider for the agent |
| `MODEL_ID` | — | Operator-configured model id for the agent |

_14 package + 21 inherited variable(s). Auto-generated from `.env.example` + the shared agent-connector-sdk set — do not edit._
<!-- ENV-VARS-TABLE:END -->

Every variable the server reads, grouped by purpose. See [`.env.example`](.env.example)
for a copy-paste starting point.

#### Connection & credentials
| Variable | Description | Default |
|----------|-------------|---------|
| `TECHNITIUM_DNS_URL` | Base URL of the Technitium DNS Server | Required |
| `TECHNITIUM_DNS_TOKEN` | API token / SSO token | — |
| `TLS_PROFILE` | Named `AgentConfig` transport-security profile; verification is mandatory | — |
| `TLS_PROFILES_REF` | Runtime secret reference for the TLS profile catalog | — |

#### MCP server / transport
| Variable | Description | Default |
|----------|-------------|---------|
| `TRANSPORT` | `stdio`, `streamable-http`, or `sse` | `stdio` |
| `HOST` | Bind host (HTTP transports) | `0.0.0.0` |
| `PORT` | Bind port (HTTP transports) | `8000` |
| `MCP_TOOL_MODE` | Tool surface: `condensed`, `verbose`, or `both` | `condensed` |
| `MCP_ENABLED_TOOLS` / `MCP_DISABLED_TOOLS` | Comma-separated tool allow/deny list | — |
| `MCP_ENABLED_TAGS` / `MCP_DISABLED_TAGS` | Comma-separated tag allow/deny list | — |

#### Tool toggles
Each action-routed tool can be disabled individually via its toggle env var (set to `false`):
`DASHBOARDTOOL`, `USERTOOL`, `ZONESTOOL` — see the
[Available MCP Tools](#available-mcp-tools) table below.

## ⚙️ Dynamic Tool Selection & Visibility

This MCP server supports dynamic toolset selection and visibility filtering at runtime. This allows the operator to restrict the set of exposed tools to prevent blowing up the LLM's context window.

The operator can configure tool filtering via multiple input channels:

- **CLI Arguments:** Pass `--tools` or `--toolsets` (or their disabled counterparts `--disabled-tools` and `--disabled-toolsets`) during startup.
- **Environment Variables:** Define standard environment variables:
  - `MCP_ENABLED_TOOLS` / `MCP_DISABLED_TOOLS`
  - `MCP_ENABLED_TAGS` / `MCP_DISABLED_TAGS`
- **HTTP SSE Request Headers:** Pass custom headers during transport initialization:
  - `x-mcp-enabled-tools` / `x-mcp-disabled-tools`
  - `x-mcp-enabled-tags` / `x-mcp-disabled-tags`
- **HTTP SSE Request Query Parameters:** Append query parameters directly to the operator's transport connection URL:
  - `?tools=tool1,tool2`
  - `?tags=tag1`

When query strings or parameters are provided, an LLM-free **Knowledge Graph resolution layer** (using `DynamicToolOrchestrator`) matches query intents against known tool tags, names, or descriptions, with safe fallback and automated 24-hour background cache refreshing.

---

## 🖥️ Running the Servers

### Run MCP Server (stdio by default)

```bash
technitium-dns-mcp
```

Or start a streamable HTTP server:

```bash
TRANSPORT=streamable-http HOST=0.0.0.0 PORT=8000 technitium-dns-mcp
```

## 🧪 Running Tests

Ensure high reliability across all components with standard test suites:

```bash
pytest -v tests/
```

---

## Documentation

The complete documentation is published as the
[official documentation site](https://knuckles-team.github.io/technitium-dns-mcp/) and
is the recommended reference for installation, deployment, and day-to-day operation.

| Page | Contents |
|---|---|
| [Installation](https://knuckles-team.github.io/technitium-dns-mcp/installation/) | pip, source, extras, prebuilt Docker image |
| [Usage](https://knuckles-team.github.io/technitium-dns-mcp/usage/) | the MCP tools, the `Api` client, the CLI |
| [Backing Platform](https://knuckles-team.github.io/technitium-dns-mcp/platform/) | deploy Technitium DNS Server with Docker |
| [Overview](https://knuckles-team.github.io/technitium-dns-mcp/overview/) | the layered API / MCP / agent architecture |
| [Concepts](https://knuckles-team.github.io/technitium-dns-mcp/concepts/) | concept registry (`CONCEPT:TDNS-*`) |

---

Version: 2.2.0

<!-- BEGIN GENERATED: additional-deployment-options -->
### Additional Deployment Options

`technitium-dns-mcp` can run as a local stdio process or container, or behind a remote
network boundary. The
[Deployment guide](https://knuckles-team.github.io/technitium-dns-mcp/deployment/) carries
the detailed transport contract.

- **Local container** — launch a reviewed immutable image as a least-privilege
  stdio child with no listener or published port.
- **Remote URL** — connect through an operator-supplied authenticated HTTPS
  ingress. Keep its URL, outbound identity references, trust profile, and exact
  `MCP_ALLOWED_HOSTS` in `AgentConfig`.
<!-- END GENERATED: additional-deployment-options -->

<!-- BEGIN agent-connector-sdk-deployment (generated; do not edit between markers) -->

## Deploy with `agent-connector-sdk-deployment`

Provision this package with the consolidated **`agent-connector-sdk-deployment`**
workflow. It selects an installed-package, editable-source, or immutable-container
path; records only runtime secret and TLS-profile references in `AgentConfig`; and
runs doctor, registration, policy, observability, and rollback gates. Ask your agent
to **"deploy `technitium-dns-mcp` with agent-connector-sdk-deployment"**.

| Install mode | Command |
|------|---------|
| Installed package | `uv tool install "technitium-dns-mcp[mcp]"`, then run `technitium-dns-mcp` |
| Immutable container | deploy `registry.example.invalid/technitium-dns-mcp@sha256:<digest>` through the operator-selected orchestrator |

The repository embeds no deployment profile, credential value, certificate path, or
environment-specific endpoint. Supply those at runtime through `AgentConfig` and the
configured secret provider.

<!-- END agent-connector-sdk-deployment -->

## Available MCP Tools

<!-- MCP-TOOLS-TABLE:START -->

#### Condensed action-routed tools (`MCP_TOOL_MODE=condensed`)

| MCP Tool | Toggle Env Var | Description |
|----------|----------------|-------------|
| `technitium_dns_dashboard` | `DASHBOARDTOOL` | Query Technitium DNS metrics, prometheus stats, category details, or delete statistics. |
| `technitium_dns_user` | `USERTOOL` | Manage Technitium DNS user sessions, authentication, credentials, and profile settings. |
| `technitium_dns_zones` | `ZONESTOOL` | Manage Technitium DNS authoritative zones, DNSSEC properties/keys, and perform DNS record CRUD. |
| `technitium_ingest_zones` | `INGESTTOOL` | Natively ingest Technitium DNS zones (+ their records) into epistemic-graph. |

#### Verbose 1:1 API-mapped tools (`MCP_TOOL_MODE=verbose` or `both`)

<details>
<summary>52 per-operation tools — one per public API method (click to expand)</summary>

| MCP Tool | Toggle Env Var | Description |
|----------|----------------|-------------|
| `technitium_dns_add_private_key` | `ZONESTOOL` | Adds a private DNSSEC key to the zone. |
| `technitium_dns_add_record` | `ZONESTOOL` | Adds a new DNS record. |
| `technitium_dns_change_password` | `USERTOOL` | Changes password for the current user session. |
| `technitium_dns_check_for_update` | `USERTOOL` | Checks for software updates. |
| `technitium_dns_clone_zone` | `ZONESTOOL` | Clones a zone from an existing local zone. |
| `technitium_dns_convert_to_nsec` | `ZONESTOOL` | Converts proof of non-existence to NSEC. |
| `technitium_dns_convert_to_nsec3` | `ZONESTOOL` | Converts proof of non-existence to NSEC3. |
| `technitium_dns_convert_zone_type` | `ZONESTOOL` | Converts zone type. |
| `technitium_dns_create_single_use_token` | `USERTOOL` | Creates a single-use token; its value is omitted from the result. |
| `technitium_dns_create_token` | `USERTOOL` | Creates an API token; the token value is omitted from the result. |
| `technitium_dns_create_zone` | `ZONESTOOL` | Creates a new zone. |
| `technitium_dns_delete_all_stats` | `DASHBOARDTOOL` | Deletes all statistics from the server. |
| `technitium_dns_delete_private_key` | `ZONESTOOL` | Deletes a private DNSSEC key. |
| `technitium_dns_delete_record` | `ZONESTOOL` | Deletes matching DNS record(s). |
| `technitium_dns_delete_user_session` | `USERTOOL` | Deletes a specific user session token. |
| `technitium_dns_delete_zone` | `ZONESTOOL` | Deletes authoritative zone. |
| `technitium_dns_disable_2fa` | `USERTOOL` | Disables 2FA for the current user. |
| `technitium_dns_disable_zone` | `ZONESTOOL` | Disables authoritative zone. |
| `technitium_dns_enable_2fa` | `USERTOOL` | Enables 2FA with the provided TOTP code. |
| `technitium_dns_enable_zone` | `ZONESTOOL` | Enables authoritative zone. |
| `technitium_dns_export_zone` | `ZONESTOOL` | Exports authoritative zone file. |
| `technitium_dns_get_dnssec_properties` | `ZONESTOOL` | Retrieves DNSSEC properties/keys for a zone. |
| `technitium_dns_get_ds_info` | `ZONESTOOL` | Retrieves DNSSEC Delegation Signer (DS) records information. |
| `technitium_dns_get_metrics_json` | `DASHBOARDTOOL` | Gets metrics in JSON format for the dashboard. |
| `technitium_dns_get_metrics_text` | `DASHBOARDTOOL` | Gets metrics in Prometheus metrics format. |
| `technitium_dns_get_records` | `ZONESTOOL` | Retrieves DNS records matching the domain. |
| `technitium_dns_get_session_info` | `USERTOOL` | Gets info about the current session. |
| `technitium_dns_get_sso_status` | `USERTOOL` | Gets SSO status of the server. |
| `technitium_dns_get_stats` | `DASHBOARDTOOL` | Retrieves server statistical charts data. |
| `technitium_dns_get_top_stats` | `DASHBOARDTOOL` | Retrieves top stats data for queries, clients, domains, etc. |
| `technitium_dns_get_user_profile_details` | `USERTOOL` | Retrieves user profile details. |
| `technitium_dns_get_zone_options` | `ZONESTOOL` | Gets settings/options of a zone. |
| `technitium_dns_get_zone_permissions` | `ZONESTOOL` | Gets user/group permissions of a zone. |
| `technitium_dns_import_zone` | `ZONESTOOL` | Imports zone content from a zone file. |
| `technitium_dns_initialize_2fa` | `USERTOOL` | Initializes 2FA; enroll through the DNS console to retrieve the secret. |
| `technitium_dns_list_catalog_zones` | `ZONESTOOL` | Lists all catalog zones. |
| `technitium_dns_list_zones` | `ZONESTOOL` | Lists authoritative zones. |
| `technitium_dns_login` | `USERTOOL` | Log in to the DNS server; credential values are omitted from the result. |
| `technitium_dns_logout` | `USERTOOL` | Logs out the current session. |
| `technitium_dns_publish_all_private_keys` | `ZONESTOOL` | Publishes all private DNSSEC keys. |
| `technitium_dns_resync_zone` | `ZONESTOOL` | Forces authoritative secondary zone resynchronization. |
| `technitium_dns_retire_dnskey` | `ZONESTOOL` | Retires the DNSKEY. |
| `technitium_dns_rollover_dnskey` | `ZONESTOOL` | Rolls over the DNSKEY. |
| `technitium_dns_set_user_profile_details` | `USERTOOL` | Updates user profile settings. |
| `technitium_dns_set_zone_options` | `ZONESTOOL` | Sets settings/options for a zone. |
| `technitium_dns_set_zone_permissions` | `ZONESTOOL` | Sets permissions for a zone. |
| `technitium_dns_sign_zone` | `ZONESTOOL` | Signs the zone with DNSSEC. |
| `technitium_dns_unsign_zone` | `ZONESTOOL` | Unsigns/removes DNSSEC from a zone. |
| `technitium_dns_update_dnskey_ttl` | `ZONESTOOL` | Updates DNSKEY TTL. |
| `technitium_dns_update_nsec3_params` | `ZONESTOOL` | Updates NSEC3 parameters. |
| `technitium_dns_update_private_key` | `ZONESTOOL` | Updates private key parameters. |
| `technitium_dns_update_record` | `ZONESTOOL` | Updates an existing DNS record. |

</details>

_4 action-routed tool(s) · 52 verbose 1:1 tool(s). Each is enabled unless its `<DOMAIN>TOOL` toggle is set false; `MCP_TOOL_MODE` selects the surface (**`intent` default** — the six verb-tools, granular set loaded on demand · `condensed` action-routed · `verbose` 1:1 · `both`). Auto-generated — do not edit._
<!-- MCP-TOOLS-TABLE:END -->

<!-- GOVERNED-CAPABILITY:START -->
## Governed capability contract

This package ships a compact canonical skill surface with specialist procedures
kept as referenced workflows. The current MCP tools, skill metadata,
`connector_manifest.yml`, ontology, mappings, shapes, fixtures, migrations,
tool-schema fingerprints, and certification metadata form one versioned
capability contract. Validate them together; do not rely on stale tool names or
historical per-task skill wrappers.

Runtime endpoints, credentials, certificate trust, tenant identity, retention,
and observability policy are deployment inputs and are never packaged values.
See [Configuration, trust, and privacy](docs/configuration.md) before enabling a
network transport, connector ingestion, Arbora delegation, or trace export.
<!-- GOVERNED-CAPABILITY:END -->
