Skip to main content

A Multi-User Dungeon, Multi-User Shared Hallucination, or Multi-User Shared Environment (MUD/MUSH/MUSE) plugin for twat.

Project description

twat-mcp: Model Context Protocol plugin for twat

PyPI version Python versions License Build status

Part of the twat collection of tools.

twat-mcp adds Model Context Protocol (MCP) support to the twat ecosystem, letting AI assistants (Claude Code, Cursor, etc.) discover and call tools exposed through MCP servers.

What is MCP?

The Model Context Protocol is Anthropic's open standard for connecting AI models to external tools and data sources. It defines a client–server architecture:

  • MCP server: exposes a set of callable tools (functions, resources, prompts)
  • MCP client / host: an AI assistant or IDE that discovers those tools and invokes them on the model's behalf

twat-mcp turns twat into an MCP host. It loads tool servers, handles session negotiation, and routes tool calls between AI clients and the underlying implementations.

Installation

Requires Python 3.10+. Install with uv (recommended) or pip:

uv pip install twat-mcp
# or
pip install twat-mcp

The twat package must also be installed.

How it works

twat-mcp registers itself as a twat plugin via a Python entry point:

[project.entry-points."twat.plugins"]
mcp = "twat_mcp:TwatMcpPlugin"

When twat starts, it calls importlib.metadata.entry_points(group="twat.plugins"), loads TwatMcpPlugin, and delegates MCP lifecycle management to this plugin. The plugin:

  1. Reads MCP server configuration (stdio commands, SSE endpoints, or in-process SDK servers)
  2. Negotiates capabilities with each server using the MCP handshake
  3. Exposes discovered tools to connected AI clients
  4. Routes tool call requests and returns results

Architecture

AI client (Claude Code, Cursor, …)
        │  MCP protocol (JSON-RPC over stdio/SSE/HTTP)
        ▼
  TwatMcpPlugin  ←─ loaded by twat via entry_points
        │
        ├── mcp_search.py  (tool discovery and query)
        └── MCP server connections (stdio / SSE / SDK)

Key components

File Purpose
src/twat_mcp/__init__.py TwatMcpPlugin class; plugin entry point
src/twat_mcp/mcp_search.py Discovers and queries MCP tool servers
src/twat_mcp/__version__.py Version string (managed by hatch-vcs)

Development

git clone https://github.com/twardoch/twat-mcp.git
cd twat-mcp
uv pip install hatch
hatch shell
pre-commit install

# Lint / format / type-check
hatch run lint-all

# Tests
hatch run test:test-cov

Versioning uses git tags via hatch-vcs. Create an annotated tag and push to trigger a GitHub Actions release.

License

MIT. Contributions welcome under the same license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

twat_mcp-1.0.2.tar.gz (57.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

twat_mcp-1.0.2-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file twat_mcp-1.0.2.tar.gz.

File metadata

  • Download URL: twat_mcp-1.0.2.tar.gz
  • Upload date:
  • Size: 57.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for twat_mcp-1.0.2.tar.gz
Algorithm Hash digest
SHA256 68ab987fd65fd6a79c6e985eb6e58034a458016561b733e7eda70c76cdc669e7
MD5 8060eaff036249371786310268c5e337
BLAKE2b-256 36cb4d6e4557b1582793a1ed832c19bcc75183a116739ace3e974b7b154610f6

See more details on using hashes here.

File details

Details for the file twat_mcp-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: twat_mcp-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for twat_mcp-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ae3276a47cacd2c557b04f007ff65d20a86efff12cdc5922d6b55d319d0c6664
MD5 a76c04cc4d98f33e6da4b065759e4fb4
BLAKE2b-256 888157b38918908cbb41660c1163043cc24ad285735894e9b64622f89320c584

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page