MCP Client

Pythinker

By elkaix

๐Ÿค– โ€” a tiny personal AI agent framework. Chat channels (Slack, Telegram, Discord, WhatsApp, โ€ฆ), memory, MCP, and an OpenAI-compatible API in one small Python core.

Views
2
Repository stars
3
Platforms
Windows, macOS, Linux
Workspace
Framework
Share resource
Capabilities & compatibility

Use cases

  • - Tiny agent โ€” a compact readable core. Stable long-running behavior without orchestration sprawl. - Channel-agnostic โ€” Slack, Telegram, Discord, WhatsApp, Signal, Matrix, MS Teams, email, WebSocket, plus an OpenAI-compatible HTTP API. - Full-screen TUI โ€” pythinker-ai tui (alias chat ) opens a prompt toolkit chat with live streaming, slash-command pickers ( /model , /provider , /sessions , /theme , /help , /status ), fuzzy search, themable chrome (default + monochrome), and Ctrl+C cancellation of in-flight turns. - Provider-rich โ€” 25+ LLM providers (Anthropic, OpenAI, Azure OpenAI, OpenAI Codex, GitHub Copilot, Qwen/DashScope, MiniMax, VolcEngine, Moonshot, DeepSeek, StepFun, and more) behind a single interface. - Provider hot-reload โ€” edits to model / provider / API key in ~/.pythinker-ai/config.json land at the next turn boundary. No restart of the SDK or gateway. Same-signature snapshots short-circuit; broken configs are logged and swallowed so an in-flight session can't crash on a typo. - Headless browser tool (opt-in) โ€” drives Playwright-managed Chromium for JavaScript-rendered pages, click/form flows, screenshots, and DOM snapshots. mode="auto" launches a packaged headless Chromium without Docker; mode="cdp" connects to an external service for hardened deployments. First-use Chromium binary installs lazily, with idle eviction, per-context page caps, SSRF route handling, and turn-boundary hot reload of browser config. - Governed-execution runtime (off by default) โ€” opt-in RuntimeConfig wires a PolicyService (allow-lists from agent manifests, per-turn budgets, recursion depth), a ToolEgressGateway chokepoint, an AgentRegistry directory loader, RequestContext + BudgetCounters plumbing, and a pluggable TelemetrySink (loguru / JSONL / composite). When the loader is None and policy is off, the runtime follows the default lightweight path. - Autonomous subagent tracking โ€” spawned subagents are first-class task records with durable output under .pythinker-ai/task-results/ . Pick a role at spawn time โ€” coder (full tools), explore (read-only navigation), or plan (planning-only, no write/edit/shell) โ€” and use /tasks , /task-output , and /task-stop to inspect or stop background work from chat. - Memory that learns โ€” a two-phase "Dream" process consolidates long-term memory into MEMORY.md / SOUL.md / USER.md , auto-versioned with pure-Python git. - Skills & MCP โ€” bundled skills (GitHub, cron, weather, tmux, summarize, skill-creator, โ€ฆ) plus first-class Model Context Protocol tool access with defensive HTTP probing and provider-safe tool names. - Research-grade PDF reports โ€” opt-in make pdf tool renders structured Markdown to a styled PDF via ReportLab ( pip install 'pythinker-ai[reports]' ). - Safer channel ingress โ€” chat/email adapters apply allowFrom before costly side effects like media downloads, attachment extraction, or voice transcription; Matrix also drops replayed pre-startup events. - Sandboxed shell โ€” every command is wrapped in a bubblewrap sandbox on Linux; file tools enforce workspace boundaries. - Hackable โ€” the Python package is ~58k LOC with zero monolithic orchestration layer. Read it, fork it, extend it. ๐Ÿ“ˆ 24/7 Real-Time Market Analysis ๐Ÿš€ Full-Stack Software Engineer ๐Ÿ“… Smart Daily Routine Manager ๐Ÿ“š Personal Knowledge Assistant Discovery โ€ข Insights โ€ข Trends Develop โ€ข Deploy โ€ข Scale Schedule โ€ข Automate โ€ข Organize Learn โ€ข Memory โ€ข Reasoning

Platforms

Windows, macOS, Linux

README

Pythinker

๐Ÿค– Pythinker is an open-source tiny agent framework. It keeps the core agent loop compact and readable while still supporting chat channels, long-term memory, MCP, and practical deployment paths โ€” so you can go from local setup to a long-running personal agent with minimal overhead.

> Powered by a tiny, multiplexing agent loop: one Python process listens to Slack, Telegram, Discord, WhatsApp, Signal, Matrix, MS Teams, email, a WebSocket WebUI, and an OpenAI-compatible HTTP API โ€” all backed by a single session-scoped memory layer.

> What's new in 2.7.1 โ€” The public command is now pythinker-ai, runtime state lives under ~/.pythinker-ai/ / .pythinker-ai/, and environment variables use the PYTHINKER_AI_ prefix so Pythinker can coexist with pythinker-code. Native installers are the canonical install path and use short URLs. Coding workflows gained structured apply_patch, long-running exec sessions (write_stdin, list_exec_sessions), and find_files; OpenAI providers can force Chat Completions vs. Responses API via providers.openai.apiType. See the changelog for details.

๐Ÿ’ก Key Features

  • Tiny agent โ€” a compact readable core. Stable long-running behavior without orchestration sprawl.
  • Channel-agnostic โ€” Slack, Telegram, Discord, WhatsApp, Signal, Matrix, MS Teams, email, WebSocket, plus an OpenAI-compatible HTTP API.
  • Full-screen TUI โ€” pythinker-ai tui (alias chat) opens a prompt_toolkit chat with live streaming, slash-command pickers (/model, /provider, /sessions, /theme, /help, /status), fuzzy search, themable chrome (default + monochrome), and Ctrl+C cancellation of in-flight turns.
  • Provider-rich โ€” 25+ LLM providers (Anthropic, OpenAI, Azure OpenAI, OpenAI Codex, GitHub Copilot, Qwen/DashScope, MiniMax, VolcEngine, Moonshot, DeepSeek, StepFun, and more) behind a single interface.
  • Provider hot-reload โ€” edits to model / provider / API key in ~/.pythinker-ai/config.json land at the next turn boundary. No restart of the SDK or gateway. Same-signature snapshots short-circuit; broken configs are logged and swallowed so an in-flight session can't crash on a typo.
  • Headless browser tool (opt-in) โ€” drives Playwright-managed Chromium for JavaScript-rendered pages, click/form flows, screenshots, and DOM snapshots. mode="auto" launches a packaged headless Chromium without Docker; mode="cdp" connects to an external service for hardened deployments. First-use Chromium binary installs lazily, with idle eviction, per-context page caps, SSRF route handling, and turn-boundary hot reload of browser config.
  • Governed-execution runtime (off by default) โ€” opt-in RuntimeConfig wires a PolicyService (allow-lists from agent manifests, per-turn budgets, recursion depth), a ToolEgressGateway chokepoint, an AgentRegistry directory loader, RequestContext + BudgetCounters plumbing, and a pluggable TelemetrySink (loguru / JSONL / composite). When the loader is None and policy is off, the runtime follows the default lightweight path.
  • Autonomous subagent tracking โ€” spawned subagents are first-class task records with durable output under .pythinker-ai/task-results/. Pick a role at spawn time โ€” coder (full tools), explore (read-only navigation), or plan (planning-only, no write/edit/shell) โ€” and use /tasks, /task-output, and /task-stop to inspect or stop background work from chat.
  • Memory that learns โ€” a two-phase "Dream" process consolidates long-term memory into MEMORY.md / SOUL.md / USER.md, auto-versioned with pure-Python git.
  • Skills & MCP โ€” bundled skills (GitHub, cron, weather, tmux, summarize, skill-creator, โ€ฆ) plus first-class Model Context Protocol tool access with defensive HTTP probing and provider-safe tool names.
  • Research-grade PDF reports โ€” opt-in make_pdf tool renders structured Markdown to a styled PDF via ReportLab (pip install 'pythinker-ai[reports]').
  • Safer channel ingress โ€” chat/email adapters apply allowFrom before costly side effects like media downloads, attachment extraction, or voice transcription; Matrix also drops replayed pre-startup events.
  • Sandboxed shell โ€” every command is wrapped in a bubblewrap sandbox on Linux; file tools enforce workspace boundaries.
  • Hackable โ€” the Python package is ~58k LOC with zero monolithic orchestration layer. Read it, fork it, extend it.

๐Ÿ“ฆ Install

Pythinker ships native installers for every platform alongside the PyPI wheel. Pick the row that matches your OS โ€” no Python, Node, or uv prerequisite for the native paths.

> โœ… Status note (May 2026): native installers are now the canonical path > for new installs. The short URLs below always resolve to the latest GitHub > Release artifact, verify its .sha256 sidecar, and install pythinker-ai.

Platform One-line install Artifact
๐ŸชŸ Windows irm https://pythinker.com/ai.ps1 \| iex PythinkerSetup-.exe
๐ŸŽ / ๐Ÿง macOS / Linux curl -fsSL https://pythinker.com/ai \| bash native tarball
๐ŸŽ macOS (Homebrew) brew install mohamed-elkholy95/pythinker/pythinker-ai Homebrew tap
๐Ÿง Linux packages .deb / .rpm from Releases system package
๐Ÿ Python fallback pip install pythinker-ai PyPI

Every artifact ships with a matching .sha256 file โ€” verify before install on any platform with sha256sum, shasum -a 256, or Get-FileHash.

After install, on any OS:

pythinker-ai --version                # confirm install
pythinker-ai onboard                  # interactive setup wizard
pythinker-ai                          # start the interactive CLI

> In-app updates โ€” pythinker-ai update queries the GitHub Releases API and > re-runs the right installer for your build with SHA-256 verification. Set > PYTHINKER_AI_CLI_NO_AUTO_UPDATE=1 to disable the proactive startup check.

๐ŸชŸ Windows โ€” native installer

The short PowerShell installer downloads the latest PythinkerSetup-.exe, verifies its .sha256 sidecar, and runs the Inno Setup installer silently. It installs per-user into %LOCALAPPDATA%\Programs\Pythinker, registers pythinker-ai on your user PATH (HKCU\Environment), broadcasts WM_SETTINGCHANGE so new shells see the change, and does not require UAC.

irm https://pythinker.com/ai.ps1 | iex
pythinker-ai --version

For a pinned version or an IT-managed per-machine install, download the script first and pass flags:

irm https://pythinker.com/ai.ps1 -OutFile install.ps1
powershell -ExecutionPolicy Bypass -File .\install.ps1 -Version 2.7.1
powershell -ExecutionPolicy Bypass -File .\install.ps1 -AllUsers

Manual .exe downloads from Releases still work; verify them with Get-FileHash before running.

Upgrade: pythinker-ai update from inside the running app โ€” it downloads the newest installer, verifies SHA-256, and re-runs it silently (/VERYSILENT /SUPPRESSMSGBOXES /NORESTART).

Uninstall: Apps & Features โ†’ Pythinker โ†’ Uninstall reverts both the files and the PATH edit.

> ๐Ÿ›ก First-launch SmartScreen warning โ€” until the Authenticode cert is > provisioned in CI, the installer ships unsigned and Windows shows > "Windows protected your PC." Click More info โ†’ Run anyway. Use the > published .sha256 as your integrity check until signing comes online.

๐ŸŽ macOS โ€” Homebrew tap

# 1. Install โ€” always pulls the newest pythinker-ai release on PyPI
brew install mohamed-elkholy95/pythinker/pythinker-ai

# 2. Verify
pythinker-ai --version
which pythinker-ai       # -> /opt/homebrew/bin/pythinker-ai (Apple Silicon)
                         #    or /usr/local/bin/pythinker-ai (Intel)

Works on Apple Silicon and Intel โ€” brew picks the right Python build for you. The formula provisions a clean venv and installs pythinker-ai unpinned, so every fresh brew install resolves the newest release on PyPI; the tap also auto-republishes its url/sha256 block on every Pythinker release so brew info reflects the current version.

Upgrade: brew upgrade pythinker-ai works once the tap has refreshed for the new release. To pick up a PyPI point release immediately (between tap refreshes), brew reinstall pythinker-ai.

Uninstall: brew uninstall pythinker-ai && brew untap mohamed-elkholy95/pythinker.

> The tap repo is mohamed-elkholy95/homebrew-pythinker โ€” auto-maintained, do not hand-edit.

๐Ÿง Linux โ€” system packages

Native .deb and .rpm packages for both x86_64 and aarch64 are attached to every GitHub Release.

# Debian / Ubuntu (x86_64)
sudo dpkg -i pythinker-ai_2.7.1_amd64.deb
sudo apt-get install -f       # only if dpkg reports missing deps

# Debian / Ubuntu (ARM64)
sudo dpkg -i pythinker-ai_2.7.1_arm64.deb

# Fedora / RHEL / openSUSE (x86_64)
sudo rpm -i pythinker-ai-2.7.1.x86_64.rpm
# or use the package manager (preferred โ€” handles deps):
sudo dnf install ./pythinker-ai-2.7.1.x86_64.rpm
sudo zypper install ./pythinker-ai-2.7.1.x86_64.rpm

# Fedora / RHEL (aarch64)
sudo rpm -i pythinker-ai-2.7.1.aarch64.rpm

Both packages drop a small /usr/bin/pythinker-ai launcher that execs the real binary under /usr/lib/pythinker/, so your $PATH stays tidy.

Verify before install:

sha256sum -c pythinker-ai_2.7.1_amd64.deb.sha256        # Debian/Ubuntu
sha256sum -c pythinker-ai-2.7.1.x86_64.rpm.sha256       # Fedora/RHEL

Upgrade: download the new .deb/.rpm from Releases and dpkg -i / dnf install over it. Or run pythinker-ai update from inside the running app โ€” it'll fetch the matching new package and prompt for sudo to install.

Uninstall:

sudo dpkg -r pythinker-ai                                # Debian/Ubuntu
sudo rpm -e pythinker-ai                                 # Fedora/RHEL

๐ŸŒ macOS / Linux โ€” curl-bash native installer

For containers, fresh VMs, or any host without a system package manager. The install-native.sh helper detects your OS + arch, downloads the matching PyInstaller-frozen tarball, verifies its SHA-256, and lands the single binary at ~/.local/bin/pythinker-ai.

# Latest release
curl -fsSL https://pythinker.com/ai | bash

# Pin a specific version
curl -fsSL https://pythinker.com/ai | bash -s -- --version 2.7.1

# Custom prefix (defaults to $HOME/.local)
curl -fsSL https://pythinker.com/ai | bash -s -- --prefix /opt/pythinker

Supported targets:

uname -s / -m Tarball asset
Linux / x86_64 pythinker--x86_64-unknown-linux-gnu.tar.gz
Linux / aarch64 pythinker--aarch64-unknown-linux-gnu.tar.gz
Darwin / arm64 pythinker--aarch64-apple-darwin.tar.gz

The script prints PATH guidance if ~/.local/bin isn't already on your $PATH. Intel macOS users โ€” use Homebrew or pip install pythinker-ai; no PyInstaller-built Intel Darwin binary is published.

Uninstall: rm ~/.local/bin/pythinker-ai.

3. Optional Python extras

Native installers include the common runtime surface. If you install from PyPI and need add-on channels or heavier document features, install the matching extra explicitly:

python -m pip install 'pythinker-ai[reports]'   # Markdown โ†’ PDF reports
python -m pip install 'pythinker-ai[matrix]'    # Matrix channel (E2E messaging)
python -m pip install 'pythinker-ai[discord]'   # Discord channel
python -m pip install 'pythinker-ai[msteams]'   # Microsoft Teams channel
python -m pip install 'pythinker-ai[pdf]'       # Read PDF files (PyMuPDF)
python -m pip install 'pythinker-ai[api]'       # OpenAI-compatible HTTP server
# Combine: python -m pip install 'pythinker-ai[reports,discord,api]'

The pythinker-ai[browser] compatibility extra is still accepted but no longer adds packages. Enable the browser tool in config with tools.web.browser.enable=true; the managed Chromium binary installs lazily on first browser use when allowed, or explicitly with python -m playwright install chromium.

4. Install / pin a specific version

pythinker-ai follows SemVer โ€” major-version upgrades are not auto-installed. To pin or to opt into a major bump, use the explicit pin form for your install method:

Goal Command
Pin Windows native installer powershell -ExecutionPolicy Bypass -File .\install.ps1 -Version 2.7.1
Pin macOS / Linux native installer curl -fsSL https://pythinker.com/ai \| bash -s -- --version 2.7.1
Pin Python fallback python -m pip install --force-reinstall "pythinker-ai==2.7.1"
Stay at the latest stable release pythinker-ai upgrade
From inside Pythinker, target a specific version pythinker-ai update --target 2.7.1 -y

pip install -U pythinker-ai==2.7.1 works too, but it is semantically noisy: the exact pin controls the version, not -U. pythinker-ai upgrade refuses to cross a major version (for example, 1.x โ†’ 2.x) without an explicit pythinker-ai update --target opt-in.

๐Ÿš€ Quick Start

pythinker-ai onboard                           # write a config at ~/.pythinker-ai/config.json
pythinker-ai provider login openai-codex       # OAuth sign-in (the default provider)
pythinker-ai agent                             # interactive CLI chat
pythinker-ai tui                               # full-screen interactive chat (alias: chat)

pythinker-ai onboard ships a config preconfigured for OpenAI Codex via ChatGPT OAuth (no API key needed). To use a different provider/model, edit ~/.pythinker-ai/config.json โ€” see Configuration for the full catalog of 25+ providers.

Want several independent agents on one host? pythinker-ai agents lays out per-agent configs under ~/.pythinker-ai/agents// with isolated workspace, history, and memory; pass --agent to any subcommand to target one.

  • Want different LLM providers, web search, MCP, security settings, or more config options? See Configuration.
  • Want to run Pythinker in chat apps like Telegram, Discord, Slack, WhatsApp, Signal, Matrix, or MS Teams? See Chat Apps.
  • Want Docker or Linux service deployment? See Deployment.
  • Want governed-execution (policy allow-lists, budgets, telemetry) for hardened deployments? See Architecture ยง5.X โ€” pythinker/runtime/. The layer is opt-in via runtime.policyEnabled in config.json.

โœจ Features

| ๐Ÿ“ˆ 24/7 Real-Time Market Analysis

 |

๐Ÿš€ Full-Stack Software Engineer

 |

๐Ÿ“… Smart Daily Routine Manager

 |

๐Ÿ“š Personal Knowledge Assistant

 | Discovery โ€ข Insights โ€ข Trends
 | Develop โ€ข Deploy โ€ข Scale
 | Schedule โ€ข Automate โ€ข Organize
 | Learn โ€ข Memory โ€ข Reasoning

๐Ÿ“š Docs

Browse the repo docs for the current GitHub development version.

๐Ÿ” Security

Found a vulnerability? Please do not open a public issue. Follow the private disclosure process in SECURITY.md.

Related resources