Skip to main content
Glama

linger-mcp

让 Codex Agent 通过 stdio MCP 无缝调度 Linger 全套角色,将长耗时异步任务与分级审批策略收口成安全可控的工具层。

Version v0.1.1 Linger Official Node >= 22 TypeScript 5.8 MCP Stdio Server License: MIT

简体中文  |  English  |  官方项目:simplexai-labs/linger

核心亮点 · 实测截图 · 图文海报 · 架构流程 · 审批策略 · 快速接入 · 工具清单 · 环境变量


核心亮点

维度

说明

留在 Codex 统一指挥

不用在 Antigravity 客户端多个角色对话间来回切窗口、手动搬运上下文,一句话查看并调度 Linger 在线团队。

长任务异步不阻塞

linger_ask_agent 超时未结束自动返回 job_id,配合 linger_get_reply 与 linger_cancel_job 轮询或随时取消;默认并发上限 LINGER_MAX_CONCURRENCY=2。

三级审批防越权

默认 tiered 模式将审批卡拆为 auto(白名单只读自动放行)、codex(非白名单交 Codex 审阅)、human(高危与系统独占卡强制人工确认),并支持 relay / manual 切换。

凭据安全与透明留痕

支持 macOS 钥匙串托管密码、0600 权限 Session Cookie 自动续期;默认在独立 Codex Bridge 群聊沉淀全流程(可切换 direct 1v1 单聊)。


Related MCP server: opencode-mcp

实际应用效果

1. 在 Codex 中一句话查看 Linger 在线角色与模型

直接询问「帮我看看 Linger 里有哪些在线角色」,通过 linger_list_agents 在 14 秒内列出全员类型、底层模型(如 gemini-4-hydrogen、gemini-4-neon、gemini-pro-orchestrator-neon、claude-opus-5-5)与空闲状态:

2. Codex 自动调度 Linger 角色跑重调研并交叉核验

输入「让 linger 中的 bk 查询 linger 项目相关的 mcp」,Codex 自动串联 linger_list_agents → linger_ask_agent → 异步轮询 → linger_read_room → 追问贴出全文,并独立联网核验 GitHub Issue #686 / PR #690 与同名误匹配项后输出结论:

3. Linger 侧 Codex Bridge 群聊全程透明留痕

默认 bridge 模式下,Codex 与 Linger 角色之间的派单、追问、在线文档卡片与结构化正文都会实时沉淀在 Codex Bridge 群聊中,人类可随时查看或直接接管:


项目图文海报

配套 6 张 3:4 图文海报(2160 × 2880 px)已收入 docs/posters/,点击任意一张可查看原图:


架构与流程

sequenceDiagram
  participant C as Codex Agent
  participant M as linger-mcp (stdio)
  participant P as Approval Policy
  participant T as TeamHub /v0 API
  participant A as Linger Agent

  C->>M: linger_ask_agent(agent, prompt)
  M->>T: POST /v0/auth/login (缓存失效时, 0600 Cookie)
  M->>T: 确保 Bridge Room / Direct Room + POST .../messages
  T->>A: 唤醒 Agent Run
  loop 轮询 GET /v0/rooms/{id}/events?after=seq
    A->>T: 发送进度/回复或审批卡 (message.created)
    M->>P: evaluateDecisionCard(card)
    alt tiered 白名单只读工具或安全命令前缀
      M->>T: POST /v0/decisions/{id} (approve + expected_version)
    else 非白名单 runtime_permission / question
      M-->>C: 返回 pending_approval 与卡片详情
      C->>M: linger_decide_card(...)
      M->>T: POST /v0/decisions/{id}
    else 高风险或 Linger UI 独占卡
      M-->>C: 返回 require_human (仅人在 Linger/OS 处理)
    end
  end
  A->>T: agent_run.status_changed (completed / aborted)
  opt 回复包含 Linger 文档卡片或附件
    M->>T: GET /v0/documents/{id} & /downloads
    T-->>M: 导出 Markdown/文本正文 (<=32K 字符自动内联)
  end
  M-->>C: 合并回复文本、内联文档正文与自动审批审计记录

审批卡分级策略

默认使用 LINGER_APPROVAL_MODE=tiered,可通过环境变量切换为 relay(转发确认)或 manual(全人工模式):

分级

涵盖卡片类型

默认行为

说明与约束

自动放行 (auto)

runtime_permission (code)

满足只读白名单或安全命令前缀时自动 approve

拒绝 ; && || | \ $( > < ( )`、补丁/脚本、敏感路径及危险参数;全程记录审计日志

Codex 审阅 (codex)

非白名单 runtime_permission (code / gui)、question

返回 pending_approval,由 Codex 调用 linger_decide_card 批复或答复

approve 不允许附带 comment;question 使用 submit 传入 answers

强制留给人 (human)

connector_write、agent_change、room_creation、connection_auth、provider_key、browser_connection、computer_permission、search_key、profile_setup_*

返回 require_human,禁止自动审批

后几类系统/OAuth 卡服务端仅允许在 Linger / OS 完成,接口仅支持 deny


快速接入 Codex

1. 安装依赖并构建项目

npm ci
npm run build

2. 可选:将 Linger 登录密码存入 macOS 钥匙串

避免在配置文件中写入明文密码:

security add-generic-password -U -s linger-mcp -a "you@example.com" -w "YOUR_PASSWORD"

3. 在 ~/.codex/config.toml 中添加 MCP 配置

[mcp_servers.linger]
command = "node"
args = ["/path/to/linger-mcp/dist/src/index.js"]
tool_timeout_sec = 300

[mcp_servers.linger.env]
LINGER_URL = "http://localhost:8080"
LINGER_EMAIL = "you@example.com"
LINGER_KEYCHAIN_SERVICE = "linger-mcp"
LINGER_ROOM_MODE = "bridge"
LINGER_APPROVAL_MODE = "tiered"
NOTE

首次登录成功后会将teamhub_session Cookie 缓存在 ~/.config/linger-mcp/session.json(权限 0600),遇到 401 会自动重新登录并重试一次。


暴露的 MCP 工具

工具名

用途

linger_list_agents

列出 Linger 中的角色、描述、模型与在线状态

linger_ask_agent

向指定角色发消息触发 Run(默认等待 60s),自动内联回复中的中小文本/Markdown 文档卡片正文

linger_get_reply

轮询任务状态(支持 wait_for_followup=true 等待已完成任务后续异步投递的结果),返回新回复、内联文档与挂起审批卡

linger_read_document

读取/分页查看指定 document_id 完整正文,或将大文件/二进制附件落盘到本地(0600)

linger_decide_card

按策略校验并发起 POST /v0/decisions/{id}(含 expected_version 并发保护)

linger_list_rooms

查看当前可见的 Room 列表

linger_read_room

读取指定 Room 的历史与最新消息上下文

linger_cancel_job

取消运行中的 Linger Agent Run


环境变量说明

变量

默认值 / 要求

说明

LINGER_URL

必填

Linger TeamHub 服务地址(非回环地址必须使用 https://,除非显式设置 LINGER_ALLOW_INSECURE_HTTP=true)

LINGER_EMAIL / LINGER_PASSWORD / LINGER_KEYCHAIN_SERVICE

按认证方式配置

登录账号与密码(推荐优先使用 LINGER_KEYCHAIN_SERVICE 从 macOS 钥匙串读取)

LINGER_LOCAL_IDENTITY_KEY / LINGER_LOCAL_IDENTITY_ORIGIN

可选

本地安装时校验 POST /v0/local/identity 的 32 字节 Base64 密钥与 Web Origin

LINGER_ROOM_MODE

bridge

会话房间模式:bridge(独立 Codex Bridge 群聊)或 direct(1v1 单聊)

LINGER_DEFAULT_WAIT_SECONDS

60

单次等待回复超时秒数(范围 0..300)

LINGER_AUTO_INLINE_DOCUMENTS

true

是否自动内联回复中的文本/Markdown 文档卡片正文

LINGER_INLINE_DOCUMENT_MAX_CHARS

32768

单篇自动内联与 linger_read_document 分页单次最大字符数

LINGER_DOC_MAX_BYTES

10485760

单文档下载大小上限(10 MiB)

LINGER_DOWNLOAD_DIR

<tmpdir>/linger-mcp-downloads

linger_read_document 开启 save_to_file=true 时的本地保存目录(权限 0700)

LINGER_APPROVAL_MODE

tiered

审批策略模式:tiered | relay | manual

LINGER_APPROVAL_ALLOW_TOOLS

预设只读工具

逗号分隔允许自动放行的只读工具名

LINGER_APPROVAL_ALLOW_CMD_PREFIXES

预设安全前缀

逗号分隔允许自动放行的命令前缀

LINGER_APPROVAL_DENY_PATTERNS

内置高危规则

额外禁止自动放行的正则(推荐 JSON 数组格式,如 ["pattern1","pattern2"])

LINGER_ALLOW_GUI_APPROVAL

false

是否允许白名单内的 GUI 操作自动审批

LINGER_ALLOW_HUMAN_CONFIRMED_RELAY

relay 为 true,tiered 为 false

是否允许在带 human_confirmed=true 时经由 MCP 转发高风险卡

LINGER_MAX_CONCURRENCY

2

并发任务上限,防止本地模型资源抢占


测试与许可

npm run typecheck
npm test

本项目基于 MIT 协议开源。

Available Tools

8 tools
linger_ask_agentA

Send a task or question to a Linger agent (pass display_name or actor_id directly when known). Waits up to wait_seconds (default 60s) for completion and automatically inlines readable text/Markdown document cards returned in the reply under documents. Use linger_read_document for truncated/large docs or binary files instead of asking the agent to re-paste text in chat.

Inputs: agent (required), prompt (required), room_id, room_mode, +1 more.

linger_cancel_jobC

Request cancellation of the active Linger Agent Run associated with a job_id.

Inputs: job_id (required).

linger_decide_cardA

Submit a decision for a pending Linger card (runtime_permission approve/deny, question submit with answers, or human-confirmed relay decisions). High-risk and Linger-UI-only cards are guarded by policy.

Inputs: decision (required), decision_id (required), answers, comment, +4 more.

linger_get_replyA

Poll an active or pending-approval Linger job for new replies, auto-inlined documents, pending decision cards, or completion. Set wait_for_followup=true on a completed job when waiting for a follow-up async delivery from the agent.

Inputs: job_id (required), wait_seconds, wait_for_followup.

linger_list_agentsA

List available Linger agents in the workspace along with their description, model, and online availability.

Inputs: no named parameters.

linger_list_roomsA

List Linger rooms the authenticated user belongs to.

Inputs: limit.

linger_read_documentA

Read full or paginated UTF-8 content of a Linger document/file card (from snapshot.documents, reply segments, or linger_read_room), or save binary/large files locally via save_to_file=true. Prefer this over asking the Linger agent to paste full text into chat.

Inputs: document_id (required), offset, max_chars, save_to_file, +1 more.

linger_read_roomA

Read recent messages, document references, and any decision cards from a Linger room. To read the full content of a referenced document_id, call linger_read_document.

Inputs: room_id (required), limit, cursor.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 8 tools

    Disambiguation4/5

    Each tool maps to a distinct step in the agent-job lifecycle (list, ask, poll, decide, cancel) plus room/document reading. The main risk is overlap between linger_ask_agent and linger_get_reply, but the descriptions clarify that ask blocks for a first reply while get_reply polls an existing job, and read_document is explicitly positioned as the fallback for truncated content.

    Naming Consistency5/5

    All eight tools use the same linger_ prefix followed by a clear verb_noun pattern (list_agents, ask_agent, get_reply, decide_card, read_room, cancel_job). No mixing of casing or verb styles.

    Tool Count5/5

    Eight tools is a well-scoped set for an agent-orchestration server, with each tool covering a distinct operation (discovery, messaging, polling, decisions, rooms, documents, cancellation). Nothing appears redundant or padding.

    Completeness4/5

    The core loop of discovering agents, dispatching work, polling replies, resolving decision cards, and cancelling jobs is fully covered, and room/document reading is present. Gaps exist around writing — no tool to post a message directly into a room, create a room, or write/save a document back to Linger.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      A stdio MCP server that lets Claude Code delegate coding tasks to an OpenCode instance (optionally attached to an internal LLM gateway), with follow-up replies, status polling, output/diff retrieval, cancellation, and cleanup handled in a single session. It supports managed or attach modes, sandbox and approval policies, parallel fan-out delegations, and read-only review workflows.
      7
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables Claude Code or any MCP client to delegate hands-on coding work to OpenAI Codex over a persistent app-server process, keeping long-lived threads with follow-ups, async polling, approvals, steering, and interrupts. Supports native code review, resuming existing sessions, structured output, and parallel worktree-isolated tasks.
      10
      24 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables MCP clients such as Claude Code and Codex to delegate persistent review or isolated write-mode implementation tasks to locally installed Claude Code or Codex runtimes, then inspect progress, approve or deny individual permission requests, and continue the same native conversation. It also lists live model catalogues, lets callers follow up on saved conversations, and can run independently via its bundled CLI.
      2
      MIT