A powerful, extensible MUD (Multi-User Dungeon) proxy built with Python 3.12+ and asyncio. BastProxy sits between your MUD client and MUD server, providing features like triggers, aliases, logging, and a rich plugin system.
- Asynchronous Architecture: Built on Python's asyncio for efficient handling of multiple connections
- Plugin System: Highly modular with hot-reload capabilities
- Telnet Protocol Support: GMCP, MSDP, MSSP, MCCP, MXP, and more
- Event-Driven: Comprehensive event system for plugin interaction
- API Framework: Centralized API registry for plugin communication
- Command System: Flexible command parsing and execution
- Trigger System: Pattern matching on MUD output
- Multiple Clients: Support for multiple simultaneous client connections
- Data Tracking: Comprehensive tracking of data flows and modifications
- Python 3.12 or newer
- uv (for dependency management) or pip
-
Clone the repository:
git clone https://github.com/endavis/bastproxy-py3.git cd bastproxy-py3 -
Install dependencies:
uv sync --all-extras
Or for development:
pip install -e ".[dev]"
Basic usage:
uv run bastproxyWith options:
uv run bastproxy --port 9999 --IPv4-address localhostCommand-line options:
--portor-p: Port to listen on (default: 9999)--IPv4-address: IP address to bind to (default: localhost)--profileor-pf: Enable code profiling
- Start BastProxy with
python mudproxy.py - Connect your MUD client to
localhost:9999 - BastProxy will prompt you to configure your MUD connection
- Once configured, BastProxy connects to your MUD server
Configuration files are stored in data/plugins/. Each plugin maintains its own configuration.
- commands: Command parsing and execution
- events: Event registration and notification
- triggers: Pattern matching and text substitution
- clients: Client connection management
- proxy: Core proxy settings
- log: Logging infrastructure
- settings: Plugin settings management
- colors: ANSI/Xterm color handling
BastProxy uses a powerful plugin system. Here's a minimal plugin example:
# plugins/your_plugin/__init__.py
PLUGIN_NAME = 'Your Plugin'
PLUGIN_PURPOSE = 'Does something useful'
PLUGIN_AUTHOR = 'Your Name'
PLUGIN_VERSION = 1
# plugins/your_plugin/plugin/_yourplugin.py
from plugins._baseplugin import BasePlugin
from libs.api import AddAPI
class YourPlugin(BasePlugin):
"""Your plugin implementation."""
@AddAPI('your.api.function', description='Your API function')
def _api_your_function(self, data: str) -> str:
"""Process data."""
return f"Processed: {data}"See CONTRIBUTING.md for detailed plugin development guidelines.
# Install with development dependencies
pip install -e ".[dev]"
# Install pre-commit hooks
pre-commit install# Run all tests
pytest
# Run with coverage
pytest --cov=libs --cov=plugins --cov-report=html
# Run specific test
pytest tests/libs/test_persistentdict.py# Lint code
ruff check .
# Format code
black .
# Type checking
mypy mudproxy.py libs/ plugins/bastproxy-py3/
├── mudproxy.py # Main entry point
├── libs/ # Core libraries
│ ├── api/ # API framework
│ ├── net/ # Network handling
│ ├── plugins/ # Plugin loading system
│ ├── records/ # Data tracking
│ └── tracking/ # Attribute monitoring
├── plugins/ # Plugin directory
│ ├── core/ # Core plugins
│ ├── debug/ # Debug plugins
│ └── _baseplugin/ # Base plugin class
├── tests/ # Test suite
└── data/ # Runtime data
├── logs/ # Log files
└── plugins/ # Plugin data
Contributions are welcome! Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes following our coding standards
- Write tests for your changes
- Ensure all tests pass (
pytest) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
The networking code is based on:
- telnetlib3 - Telnet protocol implementation
- akrios_frontend - MUD client frontend
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: GitHub Issues
- Documentation: Wiki
- Original BastProxy concept and design by Bast
- Community contributors and testers
- The MUD community for continued support