Skip to main content

madcat-os (binary: madcat)

MADCAT MCP server and command line in Python. The installed binary is madcat; one package, three faces:

  • madcat mcp serve — MCP over stdio (default) or Streamable HTTP at /mcp
  • madcat mcp list / mcp call <tool> '<json>' — drive the tool registry from the shell
  • madcat status — effective config and tool count
  • madcat claude hooks pre-tool inject_session_id / session-start welcome — Claude Code hooks

Functionality is being moved here from the Rust madcat binary; command shapes match it.

Quick start

uv sync
uv run madcat status
uv run madcat mcp list
uv run madcat mcp call server_info
uv run madcat mcp serve --transport http --token t --bind 127.0.0.1:4197

Then POST an initialize to http://127.0.0.1:4197/mcp with Authorization: Bearer t and Accept: application/json, text/event-stream; reuse the returned mcp-session-id.

Claude Code

stdio:

{ "mcpServers": { "madcat": { "command": "uv", "args": ["run", "--directory", "/path/to/madcat-os", "madcat", "mcp", "serve"] } } }

http:

{ "mcpServers": { "madcat": { "type": "http", "url": "http://127.0.0.1:4097/mcp",
  "headers": { "Authorization": "Bearer ${MADCAT_MCP_TOKEN}" } } } }

Hooks, in ~/.claude/settings.json (event JSON on stdin, hook output on stdout, always exit 0):

"hooks": {
  "PreToolUse": [ { "matcher": "", "hooks": [
    { "type": "command", "command": "madcat claude hooks pre-tool inject_session_id", "timeout": 5 } ] } ],
  "SessionStart": [ { "hooks": [
    { "type": "command", "command": "madcat claude hooks session-start welcome", "timeout": 5 } ] } ] }

inject_session_id records the session in ~/.claude/current-session-id and current-session.json (MADCAT_CLAUDE_STATE_DIR, [claude].state_dir) and adds session_id to madcat tool calls (--server / MADCAT_CLAUDE_MCP_SERVER when the tool name does not identify madcat). welcome prints the boot prompt for the active persona cart (~/.local/share/madcat/tts-state.toml → ~/.config/madcat/carts/<tag>.toml); MADCAT_CLAUDE_WELCOME, [claude].welcome or $CLAUDE_PLUGIN_DATA/welcome.md replaces it.

Configuration

Environment, prefix MADCAT_MCP_ (or a .env file): HOST (127.0.0.1), PORT (4097), TOKEN, LOG_LEVEL.

The memory_* tools use the same Postgres + pgvector database and ~/.config/madcat/config.toml as the Rust madcat: EEMS_PG_DSN or [database].dsn, and [embedding] with provider (ollama or openai), url (required), model and api_key (falls back to OPENAI_API_KEY). The schema is created on first use if missing; pgvector must already be installed or creatable by the role. --bind and --token on mcp serve override.

Adding a tool

Create src/madcat_os/tools/<module>.py with register(mcp: MCPServer) and @mcp.tool() handlers (docstring per tool, type hints per argument), then add <module>.register to MODULES in src/madcat_os/tools/__init__.py. Human output goes to stderr; stdout is the stdio wire.

Layout

src/madcat_os/
  cli.py        Typer app: status, mcp list|call|serve
  server.py     build_server(), HTTP app with bearer auth + /health, stdio/http runners
  config.py     Settings (pydantic-settings); hook/cart getters over ~/.config/madcat/config.toml
  claude_hooks.py  Claude Code PreToolUse / SessionStart handlers
  cart.py       persona carts: tts-state.toml and carts/*.toml
  memory/       EEMS store (Postgres + pgvector, hybrid recall), embedders, schema
  tools/        registry; one module per tool family
tests/
justfile

Metadata

Release files for madcat-os 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for madcat-os 0.1.7
File Size Uploaded Provenance Actions
madcat_os-0.1.7.tar.gz 79.5 kB With provenance Details for madcat_os-0.1.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for madcat-os 0.1.7
File Interpreter ABI Platform Actions
madcat_os-0.1.7-py3-none-any.whl Python 3 none any Details for madcat_os-0.1.7-py3-none-any.whl

Total release size: 107.5 kB

Release files / madcat_os-0.1.7.tar.gz

Download URL madcat_os-0.1.7.tar.gz
Size 79.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ce728cccf07efaf609fdb801d7c55c0f5bae0a66624208de2bb825a8cd423cbb
BLAKE2b-256 checksum
How to use checksums
388d55bf0ae38d1be3dbbfccd24a1851f7e746f5b53a6e5a86cf2b7deb53617b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Release files / madcat_os-0.1.7-py3-none-any.whl

Download URL madcat_os-0.1.7-py3-none-any.whl
Size 28.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ff6698579515094726e4c6a43c9efb96bc3393e5677e8fad36e94cf394d2a123
BLAKE2b-256 checksum
How to use checksums
080351f5a7c73b7311011c12c82f8c04cbbb1c25004d0f4af7cd48a4aa52d4d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Security for madcat-os 0.1.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for madcat_os-0.1.7.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page