a pi extension as well as a rust discord mcp binary for letting a pi agent create discord threads for each workspace

Files
README.md

mira #

discord ↔ agent bridges. pi extension for pi agents, rust mcp server for generic agents, and a typescript mcp server with codex sdk bridging.

folders #

folder what
mira/ rust discord mcp server (generic, serenity-based)
mira-codex/ typescript mcp server with codex SDK bridging (discord.js)
pi-extension/ pi extension source code
pi-mcp-adapter-patch/ patch for pi-mcp-adapter to wake up from mcp notifications

tools (all variants) #

tool what it does
find_or_create_thread find or create a discord thread for a project. thread name is the folder name. posts a link in the parent channel on creation
send_message post a message to a thread
read_messages fetch recent messages (default 20, chronological). includes your own
list_threads list all tracked project threads. persisted across restarts
wait_for_message block until a new message arrives. timeout in seconds (default 300). use as idle loop

mira-codex #

typescript rewrite of the rust mcp server, using discord.js. adds codex SDK bridging: when a discord message arrives, it forwards it to the registered codex session via @openai/codex-sdk.

flow #

  1. codex cli connects to mira-codex as an MCP server
  2. codex calls find_or_create_thread(project, model_name, codex_session_id) — passing its session ID to register for bridging
  3. someone messages the discord thread
  4. mira-codex forwards the message to codex via codex.resumeThread(id).run(msg)
  5. codex processes the message and can reply via send_message

running #

cd mira-codex
npm install
npm run build
DISCORD_TOKEN=... DISCORD_CHANNEL_ID=... node dist/index.js

then configure codex to use it as an MCP server (codex reads .mcp.json):

{
  "mcpServers": {
    "mira-codex": {
      "command": "node",
      "args": ["dist/index.js"],
      "cwd": "/path/to/mira-codex"
    }
  }
}

config #

same as the rust server and pi extension:

  1. env vars: DISCORD_TOKEN, DISCORD_CHANNEL_ID, MIRA_PROJECT
  2. .pi/discord.json (project-local)
  3. ~/.pi/discord.json (global)
{
  "token": "your-bot-token",
  "channelId": "parent-channel-id",
  "project": "optional-override"
}

project defaults to the current folder name. set MIRA_PROJECT or the json key to override.

config (pi extension) #

install with pi install npm:mira-pi

the extension reads config from the same sources as above. project defaults to the current folder name.