Skip to main content

mattermind

CI PyPI Python License: Apache 2.0 codecov Docs

Ask natural-language questions about your Mattermost workspace using LLM tool-calling.

Documentation

Features

  • Full-text search across your Mattermost team via the REST API v4
  • Agentic loop with tool calling (search, get thread, resolve permalink, look up users)
  • Follows permalink chains up to a configurable depth
  • Cites every claim with clickable permalink links
  • Rich terminal UI with progress, answer rendering, and token usage summary
  • Interactive TUI chat interface (mattermind chat)
  • JSON output mode for scripting (--json)
  • Token budget protection with interactive continue prompt
  • SSO-compatible: authenticate via session token (MMAUTHTOKEN) or login/password
  • Self-signed certificate support (verify_ssl: false)
  • Interactive setup wizard (mattermind init)

Installation

uv tool install mattermind
# or from source:
uv sync --extra dev

Quick Start

# Interactive setup
mattermind init

# Or: save your Mattermost session token
mattermind login

# List available teams and save your choice
mattermind teams

# Ask a question
mattermind ask "What was decided about the auth service migration?"

# Interactive TUI chat
mattermind chat

# JSON output
mattermind ask "latest incidents?" --json | jq .answer

Authentication

Mattermind supports two authentication methods:

Token (recommended for SSO environments):

mattermind login
# Follow the instructions to copy MMAUTHTOKEN from browser DevTools

Or set in config:

mattermost:
  token: ${MM_TOKEN}

Login / Password:

mattermost:
  login: user@company.com
  password: ${MM_PASSWORD}

Configuration

Priority (lowest to highest): defaults → ~/.config/mattermind/config.yaml → env vars → CLI flags.

# ~/.config/mattermind/config.yaml
mattermost:
  url: https://mm.company.com
  token: ${MM_TOKEN}          # env interpolation supported
  team: engineering
  verify_ssl: true             # set false for self-signed certs

llm:
  base_url: https://api.openai.com/v1
  api_key: ${OPENAI_API_KEY}
  model: gpt-4o-mini
  verify_ssl: true

agent:
  max_iterations: 15
  total_token_budget: 200000
  max_threads_per_query: 20

output:
  format: markdown             # markdown | plain | json
  show_thread_tree: true
  show_token_usage: true
  show_timings: true

logging:
  level: INFO                  # DEBUG | INFO | WARNING | ERROR | CRITICAL

Unknown keys are rejected rather than ignored, so a typo fails validation with the key named in the error.

Environment Variables

Variable Description
MATTERMIND_MM_URL Mattermost server URL
MATTERMIND_MM_TOKEN Personal Access Token / MMAUTHTOKEN
MATTERMIND_MM_LOGIN Login (email or username)
MATTERMIND_MM_PASSWORD Password
MATTERMIND_TEAM Team slug
MATTERMIND_MM_VERIFY_SSL Verify Mattermost TLS (true/false)
MATTERMIND_LLM_BASE_URL LLM API base URL (OpenAI-compatible)
MATTERMIND_LLM_API_KEY LLM API key
MATTERMIND_MODEL Model name
MATTERMIND_LLM_VERIFY_SSL Verify LLM gateway TLS (true/false)

Commands

mattermind ask <question>   Ask a question about your Mattermost workspace
mattermind chat             Launch interactive TUI chat interface
mattermind teams            List available teams and save your selection
mattermind login            Save a session token (MMAUTHTOKEN) to config
mattermind init             Interactive config setup wizard
mattermind config show      Print resolved config (secrets masked)
mattermind config validate  Validate config and check both endpoints are reachable
mattermind version          Print version

Global flags

Accepted before or after the subcommand:

-c / --config PATH    Path to config YAML file
-v / --verbose        Enable verbose output (shows tool calls)
-q / --quiet          Print the answer as plain text, without the UI chrome
--json                Output result as JSON (machine-readable)
--no-color            Disable colour output

Development

make install    # install deps
make fmt        # format + fix lint
make check      # lint + type-check
make test       # run unit tests with coverage
make test-all   # unit + integration tests (needs a real MM and LLM)

Architecture

src/mattermind/
├── cli/        — Typer CLI app, commands, app context
├── config/     — Pydantic models, YAML loader, env interpolation, wizard
├── mattermost/ — Async httpx client, Mattermost REST API v4, domain models
├── agent/      — Agentic loop, tool definitions, system prompt, state
└── ui/         — Rich rendering, Textual TUI, error panels

Metadata

Release files for mattermind 0.2.1

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

Source distribution (sdist)

Source distribution for mattermind 0.2.1
File Size Uploaded
mattermind-0.2.1.tar.gz 38.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mattermind 0.2.1
File Interpreter ABI Platform
mattermind-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 88.0 kB

Release files / mattermind-0.2.1.tar.gz

Download URL mattermind-0.2.1.tar.gz
Size 38.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e62eb562eb998c9e325825fde58afb5bf37e9574d1023eb9ae477cbf6b4593b1
BLAKE2b-256 checksum
How to use checksums
c999808ea5e636fcaa5f797894b18372bc2f0b59bab6c104564213d89058acc6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / mattermind-0.2.1-py3-none-any.whl

Download URL mattermind-0.2.1-py3-none-any.whl
Size 49.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a0594cf7032cffceeb0fa450d28b5b4a3101c0ff1b2be2a982158b8acb56d500
BLAKE2b-256 checksum
How to use checksums
464bf07f7fb14e48f9be2b74026e3829e6a8590ce04f56dbd513e56fb9d36242
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

0.2.2

2 release files

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

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