You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

mercury-ai

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mercury-ai

Personal AI assistant for chat platforms (WhatsApp, Slack, Discord)

latest
Source
npmnpm
Version
0.4.5
Version published
Maintainers
1
Created
Source

Mercury

There are many claws, but this one is mine.

GitHub npm

Mercury is a personal AI assistant that lives where you chat. It connects to WhatsApp, Slack, and Discord, runs agents inside containers for isolation, and uses pi as the runtime.

Quick Start

npm install -g mercury-ai
mkdir my-assistant && cd my-assistant
mercury init

Authenticate:

mercury auth login              # Interactive OAuth (Anthropic, GitHub Copilot, etc.)
mercury auth login anthropic    # Or specify provider directly
mercury auth status             # Check what's configured

Or set an API key in .env:

MERCURY_ANTHROPIC_API_KEY=sk-ant-...

Configure identity and adapters in .env:

MERCURY_BOT_USERNAME=Mercury
MERCURY_TRIGGER_PATTERNS=@Mercury,Mercury

# Enable adapters
MERCURY_ENABLE_WHATSAPP=true
MERCURY_ENABLE_DISCORD=true
MERCURY_DISCORD_BOT_TOKEN=your-bot-token

Start:

mercury run
# or install as a background service:
mercury service install

Set up spaces and conversations

Mercury discovers conversations from incoming traffic. They start unlinked — you assign them to spaces (memory boundaries).

# Create spaces
mercury spaces create main
mercury spaces create work
mercury spaces create family

# Send a message from WhatsApp/Discord/Slack, then:
mercury conversations              # See discovered conversations
mercury conversations --unlinked   # See unlinked ones
mercury link <id> main             # Link a conversation to a space

Multiple conversations can point at the same space — they share memory, session, and vault.

How It Works

┌──────────────────────────────────────────────────────────────┐
│                        Host Process                          │
│                                                              │
│   ┌──────────┐  ┌─────────┐  ┌─────────┐  ┌───────────────┐  │
│   │ WhatsApp │  │  Slack  │  │ Discord │  │   Scheduler   │  │
│   │ Adapter  │  │ Adapter │  │ Adapter │  │ (cron tasks)  │  │
│   └───┬──────┘  └────┬────┘  └───┬─────┘  └──────┬────────┘  │
│       └──────────────┴───────────┴───────────────┘           │
│                              │                               │
│                     ┌────────▼────────┐                      │
│                     │  Router/Queue   │                      │
│                     └────────┬────────┘                      │
│                              │                               │
│                     ┌────────▼────────┐                      │
│                     │    SQLite DB    │                      │
│                     └────────┬────────┘                      │
└──────────────────────────────┼───────────────────────────────┘
                               │
                     ┌─────────▼──────────┐
                     │  Docker Container  │
                     │  ┌──────────────┐  │
                     │  │    pi CLI    │  │
                     │  └──────────────┘  │
                     │ /spaces/<space-id> │
                     └────────────────────┘

Each space is a user-defined memory boundary with its own workspace and pi session. Incoming platform conversations are discovered automatically, then linked into spaces.

Features

FeatureDescriptionDocs
Multi-platformWhatsApp, Slack, Discorddocs/pipeline.md
MemoryObsidian-compatible vault per spacedocs/memory.md
Scheduled TasksCron-based recurring promptsdocs/scheduler.md
PermissionsRole-based access controldocs/permissions.md
MediaImages, documents, voice notesdocs/media/overview.md
KB DistillationExtract lasting knowledge from chatsdocs/kb-distillation.md
ExtensionsTypeScript plugins for CLIs, skills, jobs, hooksdocs/extensions.md

Workspaces

Each space gets an isolated workspace:

.mercury/spaces/<space-id>/
├── AGENTS.md              # Space instructions
├── .mercury.session.jsonl # pi session
├── inbox/                 # Media received from users
└── outbox/                # Files produced by the agent

Memory/vault structure (for example .obsidian/, knowledge/, daily/) is created by installed extensions.

Multiple platform conversations can point at the same space.

CLI

mercury (host CLI)

# setup + runtime
mercury init
mercury run
mercury build              # only needed when developing the base image from source
mercury status
mercury doctor             # preflight check — validates Docker, credentials, adapters

# auth
mercury auth login [provider]
mercury auth logout [provider]
mercury auth status
mercury auth whatsapp

# chat + routing
mercury chat "hello"
mercury chat --file photo.jpg "what's in this?"
mercury chat --space work "check status"
echo "summarize" | mercury chat
mercury spaces list
mercury spaces create <id>
mercury conversations
mercury conversations --unlinked
mercury link <conversation-id> <space-id>

# extensions
mercury add ./path/to/extension
mercury add npm:<package>
mercury add git:<repo-url>
mercury remove <name>
mercury extensions list

# service (recommended for background)
mercury service install
mercury service uninstall
mercury service status
mercury service logs [-f]

mrctl (in-container API CLI)

mrctl whoami
mrctl tasks list|create|pause|resume|run|delete
mrctl roles list|grant|revoke
mrctl permissions show|set
mrctl config get|set
mrctl spaces list|name|delete
mrctl conversations list
mrctl stop
mrctl compact

For full command docs, run mercury --help, mercury <command> --help, or mrctl help.

Extensions

Mercury supports TypeScript extensions that add CLIs, skills, background jobs, lifecycle hooks, config keys, and dashboard widgets.

.mercury/extensions/
├── napkin/
│   ├── index.ts
│   └── skill/SKILL.md
└── my-extension/
    └── index.ts

Each extension exports a setup function:

export default function(mercury) {
  mercury.cli({ name: "napkin", install: "bun add -g napkin-ai" });
  mercury.permission({ defaultRoles: ["admin", "member"] });
  mercury.env({ from: "MERCURY_NAPKIN_API_KEY" });
  mercury.skill("./skill");
  mercury.on("workspace_init", async ({ workspace, containerWorkspace }) => { ... });
  mercury.on("before_container", async ({ workspace, containerWorkspace }) => {
    return { env: { MY_VAR: containerWorkspace + "/data" } };
  });
}

Extensions with CLIs get auto-installed into a derived Docker image. Skills are symlinked for agent discovery. Permissions integrate with the existing RBAC system.

Official Extensions

Install curated extensions from the @mercuryai scope:

mercury add @mercuryai/knowledge        # Obsidian-based knowledge vault with KB distillation
mercury add @mercuryai/web-browser      # Web browsing via Playwright/Chromium
mercury add @mercuryai/charts           # Chart generation
mercury add @mercuryai/github           # GitHub CLI integration
mercury add @mercuryai/google-workspace # Google Workspace (Gmail, Calendar, Drive)
mercury add @mercuryai/pdf-tools        # PDF processing, OCR, and form filling

See mercury-extensions for the full list and documentation.

See docs/extensions.md for the extension system guide.

Configuration

Environment Variables

Core:

VariableDefaultDescription
MERCURY_DATA_DIR.mercuryData directory
MERCURY_MAX_CONCURRENCY3Max concurrent runs
MERCURY_PORT8787API port
MERCURY_BOT_USERNAMEmercuryBot display name
MERCURY_LOG_LEVELinfoLog level

Auth:

Credentials are resolved in this order:

  • OAuth credentials from mercury auth login (saved to .mercury/global/auth.json)
  • API keys from .env (e.g., MERCURY_ANTHROPIC_API_KEY)

Supported OAuth providers: Anthropic, GitHub Copilot, Google Gemini CLI, Antigravity, OpenAI Codex.

Model:

VariableDefaultDescription
MERCURY_MODEL_PROVIDERanthropicProvider
MERCURY_MODELclaude-opus-4-6Model
MERCURY_ANTHROPIC_API_KEYAPI key
MERCURY_ANTHROPIC_OAUTH_TOKENOAuth token (alternative)

Adapters:

VariableDescription
MERCURY_ENABLE_WHATSAPPEnable WhatsApp
MERCURY_WHATSAPP_AUTH_DIRAuth storage path
MERCURY_ENABLE_DISCORDEnable Discord
DISCORD_BOT_TOKENDiscord bot token
SLACK_BOT_TOKENSlack bot token
SLACK_SIGNING_SECRETSlack signing secret

Container:

VariableDefaultDescription
MERCURY_AGENT_CONTAINER_IMAGEmercury-agent:latestContainer image
MERCURY_CONTAINER_TIMEOUT_MS300000Container timeout (5 min)

KB Distillation:

VariableDefaultDescription
MERCURY_KB_DISTILL_INTERVAL_MS0 (disabled)Distillation interval

Triggers:

VariableDefaultDescription
MERCURY_TRIGGER_MATCHmentionmention, prefix, always
MERCURY_TRIGGER_PATTERNS@Mercury,MercuryTrigger patterns
MERCURY_ADMINSPre-seeded admin user IDs

Per-space Config

Conversations are discovered from incoming traffic. Unlinked conversations stay idle until you attach them to a space via mercury link <conversation-id> <space-id> or the dashboard.

mrctl config set trigger_match always
mrctl config set trigger_patterns "@Bot,Bot"

Docs

License

MIT

There are many claws, but this one is mine. 🪽

Keywords

ai

FAQs

Package last updated on 14 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts