Account Pool

io.github.ankitsxchdeva由 GitHub 帳號 ankitsxchdeva 發布v0.1.1更新於 Oct 24, 2026

Exclusive, crash-safe leases on a pool of test accounts for parallel agent QA runs.

已驗證STDIO僅桌面資料庫開發者工具

概覽

AI 產生的概覽

本機 MCP 伺服器,將測試帳號以獨佔租約分配給並行的代理工作階段,避免兩個工作階段使用同一個帳號。

可以做什麼
從指定帳號池租用帳號,取得帳號、其憑證與租約權杖,在釋放或過期前獨佔使用。歸還已租用的帳號(可重複呼叫),或在工作耗時較長時續租作為心跳。查看帳號池狀態,了解哪些帳號已租出、哪些閒置,且不揭露憑證值。透過共用的 SQLite 檔案協調彼此無關的工作階段,租約到期後自動回收。
適用情境
適合多個代理工作階段並行執行 QA 或瀏覽器測試、每個工作階段都需登入測試帳號,且帳號衝突會破壞狀態或測試結果的情況。也適合需要透過隨附 CLI 使用同一套租約協調的指令碼與人工操作。
執行需求
透過 stdio 在本機執行,通常以 npx 從 npm 套件 account-pool-mcp 啟動,需要 Node.js。需要一個定義帳號池與帳號的 JSON 檔案(APM_ACCOUNTS_FILE),以及所有需協調工作階段共用的 SQLite 路徑(APM_DB_PATH)。選用的 APM_DEFAULT_TTL_SECONDS 與 APM_LEASE_WAIT_MS 可調整租約長度與等待時間。所有工作階段必須共用同一個檔案系統。
安裝前請注意
帳號檔案保存測試帳號憑證;憑證值可寫成環境變數參照,讓真實密鑰不進入檔案。帳號檔案與資料庫應排除於版本控制之外。伺服器信任本機執行者,不要指向正式環境憑證。租約會將工作階段所需憑證交給呼叫方,並寫入共用資料庫。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Account Pool,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

account-pool-mcp

[npm version] [npm downloads] [CI] [license] [Model Context Protocol] [Glama score]

An MCP server that hands out test accounts to agent sessions one at a time, so two sessions never end up logged into the same account.

[account-pool-mcp demo: two sessions lease different accounts, a third is refused, the pool recovers on release]

The problem

When you run several agent sessions at once — say a few Claude sessions each driving their own Playwright browser — they all need to log in, and left alone they'll grab the same test account and step on each other. Two sessions on one account corrupt each other's state and your test results become meaningless. Picking a random account doesn't really help either: with 10 accounts and 5 sessions, a collision is already more likely than not.

The fix is to lease accounts. A session checks one out, uses it, and returns it. While it's checked out, no one else can be handed it.

How it works

The server keeps a pool of accounts in a small SQLite database and gives them out one at a time. Allocation happens inside a BEGIN IMMEDIATE transaction, so even if several sessions ask at the exact same moment, they can't be handed the same account. Each lease has a TTL, so if a session crashes without returning its account, it gets reclaimed automatically — there's nothing to clean up.

All of this happens in the background. The agent just asks for an account when it needs one; the broker decides which one it gets and guarantees no one else has it. There's no shared parent process — unrelated sessions coordinate purely through the database file.

Tools

  • lease_account(pool, holder?) — check out an account. Returns the account, its credentials, and a lease_token. Hold it until you're done.
  • release_account(lease_token) — give it back. Idempotent.
  • renew_lease(lease_token) — extend the lease if your work runs long (a heartbeat).
  • pool_status(pool?) — what's leased vs. free. Never returns credential values.

There's also a small account-pool CLI (lease / release / renew / status) over the same database, for scripts and humans.

Setup

Want to see it first? bash examples/demo.sh runs a 60-second, no-install walkthrough — two sessions lease different accounts, a third is correctly refused, and the pool recovers on release.

It's on npm, so there's nothing to clone or build. Register it with your MCP client (e.g. .mcp.json) — npx fetches and caches it on first launch:

jsonc
{  "mcpServers": {    "account-pool": {      "command": "npx",      "args": ["-y", "account-pool-mcp"],      "env": {        "APM_ACCOUNTS_FILE": "./accounts.json",        "APM_DB_PATH": "./account-pool.db"      }    }  }}

Then define your pools in accounts.json (an id and a credentials blob per account):

json
{ "pools": { "realtor": [  { "id": "realtor_01", "credentials": { "username": "[email protected]", "password": { "env": "REALTOR_01_PW" } } }] } }

Want the CLI too? Run it ad-hoc with npx account-pool status, or install it on your PATH:

bash
npm install -g account-pool-mcp     # adds `account-pool` (CLI) and `account-pool-mcp` (server)

Point every session's APM_DB_PATH at the same file — that shared file is how they coordinate.

Env varDefaultWhat it does
APM_ACCOUNTS_FILE./accounts.jsonPools + accounts to load on startup.
APM_DB_PATH./account-pool.dbThe SQLite file. Same path for every session.
APM_DEFAULT_TTL_SECONDS1800How long a lease lasts before it's reclaimable.
APM_LEASE_WAIT_MS00 = fail fast when the pool is empty; >0 = wait this long for one to free up.

A credential value can be { "env": "VAR_NAME" } instead of a literal, so real secrets stay in the environment and out of the accounts file.

Making your agent reach for it automatically

The server ships agent instructions in the MCP handshake — clients like Claude Code, Cursor, and Windsurf inject them into context, so the agent knows to call lease_account before logging in without being told each time. The tool descriptions reinforce it (lease is exclusive; you must release).

For the most reliable pickup, also add a line to your project's own rules file (CLAUDE.md, .cursor/rules/, .windsurfrules) so the agent's instructions and the server's instructions agree:

md
## Test accountsThis repo has account-pool-mcp configured. Before logging into any test account in a QA orPlaywright run, call `lease_account` to check one out, and `release_account` when done.Never hard-code, guess, or reuse an account — one account per session at a time.

Security

These are test accounts, not a secrets vault. Credential values are never logged or returned by pool_status — a redacting logger masks them, and all logs go to stderr so they can't corrupt the MCP stream. Keep accounts.json and *.db out of git (only the .example files are committed). The stdio server trusts whoever runs it locally, so don't point it at production credentials.

Limitations

Single host for now: coordination is through one SQLite file, so all sessions have to share a filesystem. The storage layer is isolated behind one module, so a Postgres or Redis backend could swap in later for multi-host coordination without changing the tools.

來源:README.md,提交 7587b83

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.1.1最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分