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.3.tar.gz (57.7 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.3-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: twat_mcp-1.0.3.tar.gz
  • Upload date:
  • Size: 57.7 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.3.tar.gz
Algorithm Hash digest
SHA256 db302cc1c9f7a1dc197a053650f7c2bc01e7fc4928cfaa3a61fcd520e9be9818
MD5 4d8f408e21521c44e2b40a92a990afda
BLAKE2b-256 ec84974befa3bc95643d20aa2575daf88b3cfeb1031e93639e2400cfac6a1af2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: twat_mcp-1.0.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d521edf4826c01562deea7c4aa2fa17d85424d0212bf8d6767de429c889229f4
MD5 4d49ef85915689be167093ee6a93e2d5
BLAKE2b-256 5c2aed2ebf114bdf9a36e9dec21ade0131f0e79f29245dd25ac5ea912c2e7594

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