Metadata-Version: 2.4
Name: mudderd
Version: 0.1.2
Summary: Agent harness for MUDs: telnet + GMCP session daemon, CLI and MCP tools
Keywords: mud,telnet,gmcp,llm,agent,mcp
Author: VDHome
License-Expression: EUPL-1.2
License-File: LICENSE
License-File: NOTICE
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Games/Entertainment :: Multi-User Dungeons (MUD)
Requires-Dist: mcp>=2.3
Requires-Dist: telnetlib3>=5.0.3
Requires-Python: >=3.12
Project-URL: Homepage, https://github.com/vdhome-be/mudderd
Project-URL: Repository, https://github.com/vdhome-be/mudderd
Project-URL: Issues, https://github.com/vdhome-be/mudderd/issues
Project-URL: Changelog, https://github.com/vdhome-be/mudderd/blob/main/CHANGELOG.md
Description-Content-Type: text/markdown

<div align="center">

<picture>
  <source media="(prefers-color-scheme: dark)" srcset="brand/mudder-lockup-dark.svg">
  <img alt="Mudder" src="brand/mudder-lockup.svg" width="420">
</picture>

**Let any LLM play a MUD, with you holding the reins.**

Mudder is a model-agnostic command-line bridge that lets an LLM agent play a text MUD while a human can watch, approve and monitor every action.

[![CI](https://github.com/vdhome-be/mudderd/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/vdhome-be/mudderd/actions/workflows/ci.yml)
[![CodeQL](https://github.com/vdhome-be/mudderd/actions/workflows/codeql.yml/badge.svg?branch=main)](https://github.com/vdhome-be/mudderd/actions/workflows/codeql.yml)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/vdhome-be/mudderd/badge)](https://scorecard.dev/viewer/?uri=github.com/vdhome-be/mudderd)
[![PyPI](https://img.shields.io/pypi/v/mudderd)](https://pypi.org/project/mudderd/)
[![Python 3.12+](https://img.shields.io/badge/python-3.12%2B-blue)](pyproject.toml)
[![License: EUPL-1.2](https://img.shields.io/badge/license-EUPL--1.2-blue)](LICENSE)

[Quick start](#quick-start) . [How it works](#how-it-works) . [Adapters](#adapters) . [Safety](#safety) . [Docs](#docs)

</div>

**Start here:** `uv sync` then `uv run mud help` (and `uv run mud help next`). Agents: see [AGENTS.md](AGENTS.md).

## Why Mudder

| | | |
|---|---|---|
| **Eyes** | GMCP state and a map | Room, vitals and exits are merged into compact state; every room seen is stored in SQLite, and routing is BFS in code, not in the model. |
| **Hands** | Small, safe tools | The agent gets seven MCP tools: no shell, no files, no web. |
| **Reins** | Approvals, guard, policy | In `advise` mode each action is a proposal a human approves; rate limits and host policy always apply. |
| **Dashcam** | Monitoring | `mud monitor` shows what the agent does, live or replayed from the event log. |

## Quick start

Install (once released: `uv tool install mudderd`), or from a clone: `uv sync`. The `mud` commands run anywhere; the helper scripts (`play.ps1`, `deploy/*.ps1`) need PowerShell 7 (`pwsh`), which also runs on Linux and macOS.

Play the bundled local Evennia world (Testland, real GMCP, bound to 127.0.0.1:4100):

```powershell
cd servers/evennia; uv run python up.py      # credentials, migrate, start, build world, player account
cd ../..; uv run mud start 127.0.0.1 4100     # connect (human)
uv run mud wait "connect <username>"
uv run mud send --secret-file servers/evennia/.login   # logs in as 'tester', masked
uv run mud watch                              # optional: live view + approvals
./harness/adapters/claude-code/play.ps1 "kill the boar in the forest, then rest to full"
```

Stop the world with `cd servers/evennia; uv run python up.py stop`. No Evennia? A tiny stand-in works too: `uv run python -m mudderd.fakemud 4000`, then `uv run mud start 127.0.0.1 4000`.

Lost? `uv run mud help` lists topics; `uv run mud help next` looks at what is running and says what to do next.

## How it works

```mermaid
flowchart LR
    MUD["MUD server<br/>(telnet + GMCP)"] <--> D["mudderd daemon<br/>one per session"]
    D <--> CLI["mud CLI"]
    D <--> A["Adapters<br/>MCP, Claude Code,<br/>OpenAI-compatible, shell"]
    A <--> LLM["Any LLM"]
    H(["Human"]) -->|"start, watch, approve"| CLI
```

The daemon holds the telnetlib3 connection (ANSI stripped, prompts detected), merges GMCP (`Room.Info`, `Char.Vitals`, ...) and exposes a local control port on 127.0.0.1 with random tokens. The human uses the `mud` CLI; the agent only gets the seven tools `mud_help, mud_state, mud_read, mud_act, mud_map, mud_go, mud_pending` through `mudderd-mcp`. Details: [docs/architecture.md](docs/architecture.md).

## What it looks like

A real session against the built-in test world, as `mud monitor --level actions` shows it (live, or replayed
from `~/.mudder/<name>.events.jsonl`). The login is masked, and the guard refuses a human-only command:

```text
14:08:18 HUMAN send *** -> sent
14:08:19       enter Village Square [#1]
14:08:19       hp 100/100
14:08:19 AGENT act look -> sent  (orient)
14:08:20       enter Forest Edge [#2]
14:08:20 AGENT go unexplored -> walked n
14:08:20 AGENT act kill rat -> sent  (it bit me)
14:08:20       hp 93/100
14:08:21       enter Old Well [#3]
14:08:21 AGENT go unexplored -> walked e
14:08:21 AGENT act give all to mallory -> error: refused: human-only command (quitting, giving away everything, deleting, passwords). Tell the operator instead.
14:08:22 AGENT go Village Square -> walked w s
```

## Adapters

The core has no model or vendor in it; each adapter is a thin layer over the same seven agent tools. Full table and boundaries: [harness/README.md](harness/README.md).

| For | Adapter |
|---|---|
| Any MCP client (Claude Code, Claude Desktop, Cursor, ...) | [harness/adapters/mcp/](harness/adapters/mcp/) |
| Claude Code, headless or as a subagent | [harness/adapters/claude-code/](harness/adapters/claude-code/) |
| OpenAI-compatible endpoints (Ollama, vLLM, LM Studio, OpenAI) | [harness/adapters/openai-compatible/](harness/adapters/openai-compatible/) |
| Shell-only agents (weaker boundary, local test worlds only) | [harness/adapters/shell-agent/](harness/adapters/shell-agent/) |

## Safety

The agent runs with only the seven MCP tools (`--tools ""`, `--strict-mcp-config`): no shell, no files, no web. That is what stops it from sending as a human, approving its own proposals or opening connections. Human commands also need a real terminal. Limits and threat model: [docs/security.md](docs/security.md).

| mode | agent's `mud_act` | default for |
|---|---|---|
| `auto` | sent to the MUD (rate-limited: 30/min, 0.5 s apart) | localhost |
| `advise` | queued as a proposal; a human approves with `y` in `mud watch` | any remote host |

Iron Realms games (Achaea, Aetolia, Imperian, Lusternia, Starmourn, ironrealms.com) are pinned to `advise`; `--mode auto` is refused.
These games do not allow automated play without the player, so Mudder keeps every action there yours.
Even advise mode is not explicitly allowed by their rules: ask Achaea staff before using it on a real character.

## Docs

- [docs/architecture.md](docs/architecture.md): components, control protocol, files
- [docs/operations.md](docs/operations.md): monitoring, health, troubleshooting
- [docs/security.md](docs/security.md): trust boundaries and limits
- [docs/model.md](docs/model.md): state model
- [harness/README.md](harness/README.md): adapters
- Map and travel: `mud_map()` shows the current room, exits (visited or not) and nearest unexplored rooms; `mud_go(target)` walks to a room number, name fragment or `unexplored`, stopping on the first unexpected room. In advise mode a route is one proposal.
- Linux pod: `./deploy/pod.ps1` builds the image and runs Evennia plus a runner in a Podman pod (canary, full tests, end-to-end check).

<details>
<summary>All commands</summary>

CLI: `mud help|version|start|stop|status|read|wait|state|act|map|go|pending|monitor|stats|doctor|canary|capabilities|send|approve|reject|watch`; `--json` for machine output, `--name` for parallel sessions.

`mud send --secret` prompts without echo and masks the line in logs, so passwords never reach the agent.
Logs: `~/.mudder/<name>.log` (text and GMCP, timestamped). `mud monitor --level summary|actions|full|debug` shows agent activity; `mud stats` gives counters.

</details>

## Status

0.1.0, early: for local test worlds and supervised play, not yet for production use. Supported line: 0.1.x.
Tested with Claude Haiku (MCP and a subagent) and qwen3.5:4b on local Ollama, against the bundled Evennia
test world. Next: a terminal co-pilot client and a playtest bench.

## How it is tested

`uv run pytest -q && uv run mud help --audit && uv run mud canary` on every change: unit and integration tests,
property-based fuzzing ([FUZZING.md](FUZZING.md)), a state-model walker ([docs/model.md](docs/model.md)), the
Evennia GMCP round trip, the help gate and the end-to-end canary. Security model: [docs/security.md](docs/security.md).

## Verifying a release

Each GitHub release attaches the wheel and sdist, a `SHA256SUMS` file, an SBOM, a Sigstore bundle and SLSA
provenance. Check a download with `sha256sum -c SHA256SUMS` and
`gh attestation verify <file> --repo vdhome-be/mudderd`. PyPI releases are published from the same workflow with
trusted publishing. The package gives the `mud` and `mudderd-mcp` commands; the harness files, test world and
docs are in a clone of the repository, so repository-only checks (`mud help --audit`, `mud doctor`) skip with a note
when run from the package.

## Contributing and AI use

See [CONTRIBUTING.md](CONTRIBUTING.md). Outside contributions are accepted under the contributor licence
agreement in [CLA.md](CLA.md) once it is in force. AI use: human-designed, AI-coded: the maintainer designs,
decides and reviews; an assistant writes much of the code. Commits made with an assistant say so.

## Related work

Mudder builds on [telnetlib3](https://github.com/jquast/telnetlib3) (telnet and GMCP),
[Evennia](https://github.com/evennia/evennia) (the bundled test world) and the
[Model Context Protocol](https://modelcontextprotocol.io) SDK, and learned from
[telix](https://github.com/jquast/telix), [Mudlet](https://github.com/Mudlet/Mudlet),
[Blightmud](https://github.com/Blightmud/Blightmud), TextWorld, Jericho and BALROG, and from write-ups of
coding agents playing text adventures.

## Licence

European Union Public Licence, version 1.2 or later (EUPL-1.2, [LICENSE](LICENSE)). The brand files in `brand/` are not EUPL: see [TRADEMARK.md](TRADEMARK.md).
Copyright 2026 VDHome and the Mudder contributors.
