mercury-agent

Introduction: Soul-driven AI agent with permission-hardened tools, token budgets, and multi-channel access. Runs 24/7 from CLI or Telegram.
More: Author   ReportBugs   OfficialWebsite   
Tags:

Mercury Agent

Your own AI agent, running on your own computer, reachable from every screen you have.

It does real work on your files, apps and accounts, remembers you, keeps going when you walk away,
and never lets anything it reads turn it against you. Open source, MIT, your keys, your disk.

npm version total npm downloads CI GitHub stars node MIT license Discord

cosmicstack-labs%2Fmercury-agent | Trendshift

Download Mercury Desktop · Quickstart · Docs · Changelog · Discord

English · 简体中文 · 日本語


Chat assistants answer questions. Mercury gets things done, on your machine, and you can trust it to.

🖥️ Everywhere you are One agent, one memory, on Mercury Desktop (macOS, Windows, Linux), iPhone and Android, the terminal, and Telegram, WhatsApp, Discord, Slack and Signal. Start a task on your laptop and finish the conversation from your phone.
🛠️ Does the work, not just the talking Files, shell, git and GitHub, the web, Gmail/Drive/Docs, MCP servers and your whole screen (with the Optimus plugin). It writes code until the tests pass, runs deep research with cited reports, and makes images, video, music and voice notes.
🛡️ Safe by design Every action goes through permissions. Auto mode lets a reviewer model approve routine work and block risky actions without interrupting you. Instructions hidden in pages, files or emails can't steer it.
🧠 Remembers you A Second Brain on your disk learns your preferences, projects and decisions, and recalls them before each answer. You can see it, edit it and wipe it.
🌙 Works while you're away It runs as a background service that survives reboots and crashes. Mercury Bots are persistent specialists that research, write and ship on a schedule. Mercury can ring your phone when it needs you.
💸 Your models, your budget 15+ providers (Anthropic, OpenAI, Gemini, DeepSeek, Grok, Bedrock, OpenRouter, Ollama, LM Studio…) or Mercury Cloud, with automatic fallback, prompt caching and a daily token budget it never crosses.
🔓 Yours MIT licensed. Config, memory, chats and keys live in ~/.mercury on your machine. No account, no telemetry you didn't choose.

Quickstart

1. Install Mercury (standalone binary, no Node.js needed):

# macOS / Linux
curl -fsSL https://mercuryagent.sh/install.sh | sh
# Windows (PowerShell)
irm https://mercuryagent.sh/install.ps1 | iex

Or with npm on Node.js 22+: npm i -g @cosmicstack/mercury-agent

2. Run it.

mercury

A short wizard asks your name, your agent's name, and which model to use (your own API keys or Mercury Cloud). Mercury then starts its background service and opens the chat.

3. Add the screens you want.

  • Desktop: download Mercury Desktop. It finds the Mercury on this computer, or installs it for you.
  • Phone: type /server and choose Pair a phone with QR, then scan the code from the Mercury app.
  • Chat apps: mercury doctor connects Telegram, Discord, Slack or Signal; mercury plugins install whatsapp adds WhatsApp.
mercury            # chat (attaches to the running Mercury)
mercury code .     # Mercury Code in this repository
mercury web        # open the web dashboard, signed in
mercury upgrade    # update (rolls back on its own if the new version fails)

One agent, every screen

flowchart LR
  subgraph Screens["Where you talk to it"]
    D[Mercury Desktop<br/>macOS · Windows · Linux]
    P[iPhone · Android<br/>chat · voice calls]
    T[Terminal]
    C[Telegram · WhatsApp<br/>Discord · Slack · Signal]
  end
  subgraph Runtime["Mercury on your computer (one background service)"]
    A[Agent]
    G[Permissions<br/>Auto · Ask Me · Allow All]
    M[(Second Brain)]
    B[Bots]
    S[Scheduler]
  end
  LLM[Your models<br/>with fallback]
  D & P & T & C --> A
  A --> G
  A <--> M
  A --> LLM
  B --> LLM
  S --> A & B

Every screen reaches the same agent, with the same memory, permissions and running tasks. Closing a window never stops the work.

Mercury Desktop

A native app for macOS, Windows and Linux, built on Tauri. Download it.

  • Chat with live thinking, each tool as it runs, per-reply cost, and several chats working at once.
  • Code, Research, Bots, Brain, Artifacts and Plugins in one window: watch bots work live, explore your memory as a mind map, and find everything Mercury made.
  • Pictures and videos in a grid that opens a full-screen slideshow, with progress for big files.
  • Create images, video and music from the message box; dictate with live speech-to-text.
  • Needs you: approvals, questions and owner tasks (a CAPTCHA, a code from your bank) appear as one card at a time.
  • Many servers: connect to Mercury on this machine, a home server and a cloud box, and switch from the top bar.
  • Remote access in Settings: pair phones by QR, manage devices and allowed addresses, see the security log.
  • Updates download in the background, are verified, and never leave you broken.

Mercury on your phone

Native iPhone (SwiftUI) and Android (Jetpack Compose) apps in apps/ios and apps/android. They aren't in the app stores yet, so build and install them from source for now.

  • Pair with a QR code. No passwords: scan the code /server shows, and the phone gets its own revocable device token.
  • Real-time voice calls. Talk to Mercury and it answers in about two seconds, using OpenAI Realtime or Gemini Live. Your API keys never leave your computer; the phone gets a short-lived token.
  • The full chat: streaming replies, live tool activity, the same permission modes, media grids with native file opening, and dictation.
  • Bots, Brain and Artifacts on the go, plus Mercury can call you or notify you when something needs you.

Terminal and chat apps

  • Terminal UI: full screen, streaming, command picker (/menu), approvals inline. mercury attaches to the running service instantly.
  • Telegram, Discord, Slack, Signal built in; WhatsApp as a plugin. Pairing codes and admin roles decide who can talk to it, and members can never widen their own access. Voice notes work both ways on Telegram and WhatsApp.

What Mercury can do

🛡️ Safety you can actually leave on

Three permission modes, switchable from any screen with /permissions:

Mode What happens
Auto (recommended, new in 1.5.6) A separate reviewer model decides where Mercury would ask you. It sees only your messages and the action, never web pages or tool output, so planted instructions can't argue their way through. Routine work runs; destructive, outbound, credential, deploy and "not what you asked" actions are blocked and explained. You're never interrupted.
Ask Me Mercury asks before anything outside your allowed folders and commands.
Allow All Runs freely, except the guards that always stay on.

Always on, in every mode:

  • Prompt-injection defense: content Mercury reads is tracked. Once it has read something from outside, sending data out or changing its own config needs your yes, and hidden instructions are caught.
  • Hard limits: a shell blocklist (sudo, rm -rf /…), per-folder read/write scopes, SSRF-guarded fetches, secrets redacted from logs and output.
  • Remote access you control: new devices need your approval, sensitive remote actions ask first, remote shell is off by default, and there are no passwords: only QR pairing and device tokens.
  • A security log of every approval and block (/server log), and mercury doctor --security to check it all.

👩‍💻 Mercury Code

A careful pair programmer inside your repository: mercury code . or /code.

  • Plans and builds in one flow with a live checklist, and asks once before large changes.
  • Only says "done" after a build, test or typecheck actually passed. Otherwise it names the blocker.
  • Hands work to background sub-agents (/code agent <task>); browse, stage, commit and undo with /ws.

🔎 Research, media and voice

  • Deep research (/research): a plan you approve, live progress, sources with icons, and a report exported to PDF or Word, even when a run is cut short.
  • Images, video and music from your own providers (OpenAI, Gemini image, video and Lyria music, ElevenLabs, OpenRouter…): /image, /video, /music, or just ask.
  • Speech: voice notes, /say, reading replies aloud, and live dictation with OpenAI, Gemini, Deepgram or ElevenLabs.
  • Optimus (plugin): Mercury sees your screen and uses the mouse and keyboard on macOS, Windows and Linux, by chat or out loud with a talk key.

🤖 Mercury Bots

Persistent specialists that run beside the main agent without blocking it.

  • Each has its own persona, model, memory, permissions and daily budget. Create one in words with /bots create.
  • Fleets: a lead delegates typed tasks to its crew and runs pipelines; you get one summary at the end.
  • Finished files land in ~/Documents/Mercury/<Bot name>/, or straight in your Telegram chat.
  • Governed: reversible actions go ahead, irreversible ones are refused, outcomes are judged from what the bot really did, and bots stay fully protected against what they read.

🧠 Second Brain and personality

  • After each conversation Mercury keeps a few durable facts about you (preferences, goals, projects, decisions, people), with confidence and evidence, and says what it learned.
  • Relevant memories are recalled before each answer; past conversations are searchable.
  • Everything is in SQLite under ~/.mercury. /memory and the Desktop Brain let you inspect, edit, pause or clear it.
  • Mercury's character is plain Markdown you edit: soul.md, persona.md, taste.md, heartbeat.md.

🔌 Connects to everything

  • Google Workspace: mercury google connect for Gmail, Drive and Docs. Read-only by default, and sends or shares always ask.
  • MCP servers: mercury mcp add for any Model Context Protocol server, with tools you allow one by one.
  • Skills: six useful built-ins (web search, computer health, tidy files, data analysis, any-to-PDF…) plus community skills from skills.mercuryagent.sh. Mercury can also write skills for itself.
  • Plugins: Optimus (computer use and voice), WhatsApp, CAPTCHA solver, installed with mercury plugins install. Isolated and hot-pluggable.
  • Owner tasks: when only a human can do something (a CAPTCHA, a one-time code), Mercury sends it to you on every channel and waits for your answer.
  • Scheduler and Kanban: cron schedules, one-shot reminders, and boards Mercury works through card by card.

💸 Models and cost control

  • Your default provider first, the others as fallback; a rejected key is skipped until fixed.
  • Prompt caching, trimmed tool output and lean requests keep repeat turns cheap; the exact cost of each reply is one hover away.
  • A daily token budget enforced on every turn, with Token Saver mode and per-bot budgets.
  • Choose how hard the model thinks, per chat (Effort: Low to Max, where the model supports it).
Supported providers and default models
Provider Default model Key
Mercury Cloud mercury-mini paired with mercury cloud connect
DeepSeek deepseek-chat DEEPSEEK_API_KEY
OpenAI (API or ChatGPT Plus/Pro sign-in) gpt-4o-mini OPENAI_API_KEY
Anthropic claude-sonnet-4 ANTHROPIC_API_KEY
Amazon Bedrock us.anthropic.claude-sonnet-4-6 your AWS credentials (SSO profile, env keys, or role), or AWS_BEARER_TOKEN_BEDROCK
Grok (xAI) grok-4 GROK_API_KEY
Atlas Cloud qwen/qwen3.5-flash ATLASCLOUD_API_KEY
Runcrate deepseek-ai/DeepSeek-V4.1-Flash RUNCRATE_API_KEY
CloudGPU deepseek-v4.1-flash CLOUDGPU_API_KEY
AI/ML API anthropic/claude-sonnet-4.6 AIMLAPI_API_KEY
MiMo (Xiaomi) mimo-v2.5-pro MIMO_API_KEY
Ollama Cloud gpt-oss:120b OLLAMA_CLOUD_API_KEY
Ollama Local your local model none
LM Studio your local model none
OpenAI-compatible any OPENAI_COMPAT_API_KEY and OPENAI_COMPAT_BASE_URL
OpenRouter any namespaced id, e.g. anthropic/claude-sonnet-4.6 OPENROUTER_API_KEY

LiteLLM, Atomic Chat and GitHub Copilot endpoints are also available through mercury doctor. Gemini keys power speech, images, video and music.

ChatGPT Plus/Pro: Mercury discovers models from the signed-in account's Codex catalog; Refresh ChatGPT models in the dashboard's model picker checks again.

Amazon Bedrock uses the standard AWS credential chain, including IAM Identity Center (SSO) profiles. Set BEDROCK_ENABLED=true, BEDROCK_REGION and BEDROCK_MODEL, and optionally BEDROCK_AWS_PROFILE. Foundation model IDs and inference profile IDs both work. The Settings model check needs bedrock:ListInferenceProfiles and bedrock:ListFoundationModels; BEDROCK_BASE_URL overrides the endpoint.

A server behind a username and password (for example Ollama behind nginx) works with Ollama Local, OpenAI-compatible, LM Studio, LiteLLM and Atomic Chat: set username and password on the provider in mercury.yaml and Mercury sends HTTP Basic auth. Use https:// for anything not on your own machine (behind Cloudflare, use Full (strict) SSL).

providers:
  ollamaLocal:
    baseUrl: https://ollama.example.com/v1
    model: gemma4:12b
    username: me
    password: my-password
    enabled: true

Reference

CLI commands
Command What it does
mercury Start Mercury, or attach to it if it is already running
mercury up Install the login service and make sure Mercury is running
mercury code [dir] Open Mercury Code in a directory
mercury start [-d] / stop / restart Control the runtime
mercury status / logs Show status and recent logs
mercury doctor [--platform | --security] Reconfigure; compatibility report; security check
mercury setup Run the setup wizard again
mercury update / upgrade [--force] See what's new; upgrade (rolls back if the new version fails)
mercury server Remote access: pair a phone, devices, approvals, allowed addresses, security log
mercury devices Make and revoke device tokens
mercury web Open the web dashboard here, signed in (a one-time link)
mercury telegram / discord / slack / signal Manage channel access
mercury plugins Install, enable, disable, update and remove plugins
mercury mcp Manage MCP servers
mercury google Connect Gmail, Drive and Docs
mercury skills search, browse, view, install, remove, update, doctor
mercury bots doctor, list, storage
mercury cloud connect, disconnect, status, login, models
mercury service install, uninstall, status
mercury uninstall [--purge-data] Remove Mercury, optionally with all data
In-chat commands

These run locally and use no tokens. /help lists everything.

Command What it does
/menu Command picker
/status, /trace [id] Configuration and usage; what a turn did
/new, /sessions Fresh conversation; list and switch sessions
/models List providers; /models use <provider> to switch
/permissions Switch between Auto, Ask Me and Allow All
/server Remote access: pair a phone with QR, devices, approvals, security log
/budget, /saver Token budget; Token Saver mode
/memory Inspect and manage the Second Brain
/code, /ws Mercury Code; workspace view
/research [topic] Deep research
/image, /video, /music, /say, /media Make media; choose the models and voice
/bg, /agents Background tasks; sub-agents
/bots, /bot <id> <task> Bot fleet; give a bot a task
/tools, /skills, /plugins Loaded tools; installed skills; plugins
/google, /cloud, /spotify Google Workspace; Mercury Cloud; Spotify
/stop, /halt, /reset Stop this chat, stop everything, reset context
/whatsnew What changed in this version
Built-in tools
Area Tools
Files read_file, write_file, create_file, edit_file, list_dir, delete_file, send_file, approve_scope
Shell run_command, cd, approve_command
Git git_status, git_diff, git_log, git_add, git_commit, git_push
GitHub create_pr, review_pr, list_issues, create_issue, github_api (when GITHUB_TOKEN is set)
Web fetch_url, web search, isolated public-page reader
Media image, video, music and speech generation
Skills install_skill, list_skills, use_skill
Scheduler schedule_task, list_scheduled_tasks, cancel_scheduled_task
Memory save_memory, search_memory, search_sessions, read_session
Agents delegate_task, list_agents, stop_agent, dispatch_bot
You ask_user, ask_owner, call_owner, notify_owner, send_message, update_plan, budget_status
Plus MCP server tools, plugin tools (Optimus, CAPTCHA…), Google Workspace, Spotify
Files and configuration

Everything Mercury stores lives in ~/.mercury/, never in your project. What it makes goes in ~/mercury-artifacts/, one folder per chat.

Path Contents
mercury.yaml Main configuration: providers, channels, budget, web, autoMode
.env API keys and tokens
soul/*.md Personality: soul, persona, taste, heartbeat
permissions.yaml Scopes and approval rules
skills/, plugins/ Installed skills and plugins
schedules.yaml Scheduled tasks
sessions/ Conversations
memory/second-brain/ Second Brain database
bots/ Bot personas, journals, queues and permissions
boards.db Kanban boards
daemon.log, daemon.pid Runtime log and process id

Build from source

Requirements: Node.js 22+, and Bun 1.3+ only for standalone binaries.

git clone https://github.com/cosmicstack-labs/mercury-agent.git
cd mercury-agent
npm install
npm run build        # dist/ plus the web UI
npm test             # vitest
node dist/index.js   # run your build
Part Where Build
Runtime and CLI src/ npm run build; binaries with npm run build:bin / build:bin:all
Mercury Desktop apps/desktop Tauri 2 + React
iPhone app apps/ios SwiftUI, Xcode
Android app apps/android Kotlin + Jetpack Compose, Gradle
Plugins plugins/ Optimus, WhatsApp, CAPTCHA

Each app's folder has its own README with setup steps.

Documentation

Resource
mercuryagent.sh/docs Guides, platform and channel setup, reference
ARCHITECTURE.md How the runtime is put together
BOTS-ARCHITECTURE.md Bots, fleets and their governance
DECISIONS.md Architecture decision records
CHANGELOG.md Every release
SECURITY.md Reporting vulnerabilities

Contributing

Contributions are welcome, from bug reports to new tools. Mercury runs unattended for days with access to real accounts, so a few principles matter more here than in a typical project:

  • Every external action goes through permissions. Files, shell, network and git never bypass the permission system or the SSRF guard.
  • Assume no human and no terminal. Tools must behave the same on every channel and app.
  • Spend tokens carefully. Keep tool output small; it ends up in the model's context.
  • Fail soft. A provider outage or a missing file should produce an honest message, not a crash.
  • Test the loop, not only the function. A tool that works alone can still stall a multi-step turn.

Fork, npm install, make your change with tests next to it, run npm run lint, npm run typecheck and npm test, and open a pull request that explains what changed and why, one change per PR.

Questions are welcome on Discord or at mercury@cosmicstack.org. Bugs and ideas go in GitHub Issues. Report a vulnerability through SECURITY.md.

License

MIT © Cosmic Stack

Mercury is an AI agent and can make mistakes. Review what it does, especially in Allow All mode.

Apps
About Me
GitHub: Trinea
Facebook: Dev Tools
AI Daily Digest