
Liveauth Mcp
io.github.dulzuradev由 GitHub 帳號 dulzuradev 發布v1.0.8更新於 Oct 24, 2026
MCP server for LiveAuth: PoW + Lightning auth, L402 bundles, and paid MCP tool receipts.
概覽
LiveAuth MCP 伺服器:以工作量證明或閃電網路付款為代理程式驗證身分,並對付費工具呼叫計量並簽發簽章收據。
- 可以做什麼
- 啟動、確認、更新與輪詢 LiveAuth 工作階段,透過工作量證明挑戰、閃電網路發票或 L402 憑證取得 JWT
- 取得工作階段的 BOLT11 發票並查詢付款狀態,直到付款完成
- 在呼叫後計量用量,可歸屬到已註冊工具以套用其定價並產生收益事件
- 在不產生扣費的情況下查詢剩餘預算、已用呼叫次數與限流視窗
- 將此套件當作 TypeScript SDK 使用,為自己的 MCP 工具加上由呼叫方付費的逐次計費與 HMAC 簽章收據
- 適用情境
- 適合想以工作量證明或真實聰數限制 API 或 MCP 工具存取、不需註冊帳號即可向代理程式逐次收費,或為付費工具呼叫保留可驗證稽核紀錄的情境。也適合在桌面 MCP 用戶端測試 LiveAuth 的工作量證明與閃電網路流程。
- 執行需求
- 以 stdio 在本機執行,通常透過 npx 或全域 npm 安裝,因此需要 Node.js。可選設定 LIVEAUTH_API_KEY 為 LiveAuth 專案公開金鑰;未設定時使用匿名示範專案。LIVEAUTH_API_BASE 可指向自架的 LiveAuth 端點,LIVEAUTH_DEMO 會強制使用舊版模擬閃電網路示範。需要能連線至 LiveAuth API 的網路。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Liveauth Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
LiveAuth MCP Server
Caller-funded MCP (1.3.0): use the existing createMcpGate({ publicKey, toolName, fundingMode: 'caller' }). LiveAuthCore verifies caller payment and owns accounting; this package owns payment challenges, retry binding and duplicate execution prevention. Caller funding, API examples and migration. PoW authenticates; it does not fund paid tools.
[npm version] [MIT license] [L402] [MCP] [M8ven Score]
Authentication, pay-per-call metering, and signed receipts for AI agents and MCP tools: Bitcoin-native, Lightning-backed, and L402 compatible.
This MCP server lets any AI agent authenticate against your API using proof-of-work (free, no account) or Lightning Network micropayments (sats), then meter and monetize subsequent tool calls with per-call pricing, idempotent revenue events, and HMAC-signed receipts that auditors can verify offline.
Use it when you want to:
- Gate an API or MCP tool behind real cost-of-compute or real sats (anti-spam by design, not by CAPTCHA).
- Charge AI agents per call without signing them up for an account.
- Issue a tamper-evident audit trail (signed
mcp-call-receipt-v1) for every paid tool invocation. - Offer Lightning-backed L402 bundle access for prepaid MCP sessions.
Try it in 5 seconds — no account, no API key:
Without configuration, the server uses LiveAuth's anonymous demo project and the real PoW flow. Add LIVEAUTH_API_KEY only when you need a specific project's policy, pricing, or attribution.
Available Tools (Glama / MCP auto-discovered)
Full parameter and response schemas are in the Tool Reference below.
5-Minute Quick Start
Option 1 — Credential-free PoW (no account, no key, no wallet)
In an MCP client, call liveauth_mcp_start, then call liveauth_mcp_confirm with only the returned quoteId. The package reuses its existing PoW solver locally and the LiveAuth API verifies the signed challenge before issuing a short-lived session JWT.
Option 2 — Production Mode
- Grab an API key at liveauth.app.
- Add to Claude Desktop's
claude_desktop_config.json:
- Restart Claude. Done.
Option 3 — Programmatic (CLI / SDK)
The package is also a TypeScript SDK — see SDK Usage below. The CLI bin is liveauth-mcp.
Why LiveAuth?
For API providers / tool developers:
- Stop bots at the protocol layer. PoW and Lightning sats are non-replayable, non-phishable, and don't require user accounts.
- Charge per call in sats. We sign a receipt you can show auditors, your customers, or your accountant.
- Wrap any MCP tool with one line (
createMcpGate) and you get per-tool revenue, per-tool min/max pricing, and idempotent retries.
For AI agents / agent builders:
- Permissionless access to paid APIs — solve a PoW or pay sats, get a JWT. No signup, no email, no OAuth dance.
- Use PoW, Lightning invoices, or L402 bundle macaroons for agent access.
- Projects can settle through a custom Lightning node when configured; otherwise payments use the LiveAuthCore-configured node.
The math that matters: if your tool is being scraped by a bot, charging 1 sat per call is enough to make the scraper unprofitable. We call this cost-of-attack economics, and it's the whole reason we exist.
Installation
Or use directly with npx:
Stdio verification (including MCPVault)
Configure the command as npx and arguments as ["-y", "@liveauth-labs/mcp-server"].
No environment variables are required for initialize, notifications/initialized,
or tools/list. Keep stdin open throughout the session. Startup diagnostics go to
stderr; stdout is reserved for MCP messages when running without CLI arguments.
Do not pass --help or setup goose to a verifier: those commands intentionally exit.
LIVEAUTH_API_KEY optionally selects a project's public key, and LIVEAUTH_API_BASE
defaults to https://api.liveauth.app. Leave LIVEAUTH_DEMO unset for verification;
the legacy simulated mode is not needed. Authentication and payment requirements
remain enforced when tools are called. A safe offline discovery test can set
LIVEAUTH_API_BASE=http://127.0.0.1:1, leave the key unset, and only initialize and
list tools; those operations do not contact the API.
Run npm run test:package to build and pack the project, install the tarball into a
temporary directory, and test the direct entry point and npm bin with an MCP client.
The test includes paths with spaces and reserved characters and verifies that an
unauthenticated charge is rejected.
Version 1.3.1 fixes the 1.3.0 entry-point detection bug that could exit with
code 0 when invoked through an npm bin symlink or from a path containing spaces
or URL-reserved characters. For a reproducible verification, use
npx -y @liveauth-labs/[email protected]. A successful local handshake does not
establish that MCPVault's own retest passes; the separately reported exit 134
has not been reproduced.
For an unexplained exit (especially code 134), retain complete stderr from process launch, the exit code and signal, resolved package version, Node/npm versions, OS/architecture, exact argv, working directory, and stdin/handshake timing. A deprecation warning alone does not establish the cause of an abort.
Goose
LiveAuth for Goose uses the same standards-based stdio MCP server as every other client—there is no Goose wrapper, daemon, or duplicate authentication runtime.
Install in Goose
Or print the official deep link and current fallbacks:
For a one-off Goose CLI session:
Manual Goose stdio configuration, when the deep link is unavailable:
Do not edit an existing Goose config destructively. Prefer the deep link or goose configure; if you add project configuration later, enter it through Goose's extension secret settings rather than shared plaintext YAML.
Goose quick test
Ask Goose:
Use LiveAuth to start the default authentication flow. Confirm the returned quote, then show my LiveAuth usage.
The initial flow uses the anonymous demo project's PoW challenge and does not require a wallet. A project public key is optional:
When a paid flow is requested, tool results retain the existing invoice fields and also include portable structured data:
Clients with MCP Apps support can render the included QR, Open Wallet action, expiration, and live paid/pending/expired state. Other clients receive the JSON and QR image content as ordinary MCP results.
Goose troubleshooting
- If the link does not open, run
npx @liveauth-labs/mcp-server setup gooseand use its one-session or manual fallback. - If
npxis unavailable, install a current Node.js release (Node 18 or newer). - If a supplied project key is rejected, remove it to verify the anonymous PoW flow; invalid and revoked keys intentionally do not fall back to demo.
- If a Lightning invoice expires, call
liveauth_mcp_startagain to obtain a fresh quote. - Keep refresh tokens and any non-public credentials out of logs and plaintext configuration.
LiveAuth lets agents acquire authorization at runtime instead of requiring every tool to be provisioned with permanent credentials in advance.
SDK Usage
The package can also be imported as a TypeScript/JavaScript SDK. Importing the package does not start the stdio MCP server; the CLI lives at the liveauth-mcp bin.
Client Auth Helper
The client stores confirmed JWTs, refreshes them before expiry when a refresh token is returned, and exposes the current token through liveauth.token. Call liveauth.destroy() when your app is shutting down to clear token state and refresh timers.
For PoW, config.publicKey is the credential sent in X-LW-Public. It may be either the project's primary public key or an active API public key belonging to that project. The API returns the canonical project key in session.powChallenge.projectPublicKey; the solver hashes that returned key, and confirmation still sends the configured credential. These two key strings can legitimately differ, so comparing them for equality is not a project-isolation check.
Use sessions from your trusted LiveAuth API endpoint. The server binds the quote and signed challenge to the resolved project and issues a JWT with projectId and authType. For diagnostics, compare the JWT's projectId with the expected project ID from your console, without logging the token. Decoding claims alone does not verify a JWT signature.
To require a real paid invoice:
Server Gate Helper
gate.invoke(...) validates the JWT, charges the configured sats cost or the backend project default, and passes context.liveAuth into your handler. The older gate.gateTool(...) name is still supported.
Paid Tool Attribution
If your MCP server has a registered LiveAuth tool ID, pass toolId when creating the gate. Charges then go to:
instead of the legacy generic endpoint:
You can also pass a registered tool slug/name as toolName. In that mode charges go to the generic endpoint with tool identity in the body:
Tool charges preserve the same session budget checks, but also record an immutable revenue event with gross sats, LiveAuth platform fee, developer net sats, tool method name, paying project/session/token, metadata, and idempotency key. When costSats is omitted, LiveAuthCore uses the registered tool's default price; without toolId or toolName, it falls back to the project's global MCP price.
Registered tools can also have a paid-call webhook URL. On every successful new paid call, LiveAuthCore queues a liveauth.mcp.tool.paid_call webhook with the tool identity, gross/platform/net sats, revenue event ID, metadata, and the signed receipt. If the tool webhook URL is blank, LiveAuthCore falls back to the project's webhook URL; idempotent retries do not enqueue duplicates.
When toolId or toolName is set, GateToolOptions supports:
Tool charge responses include the normal budget counters plus revenue accounting:
The receipt is a signed per-call audit artifact returned by LiveAuthCore for paid tool charges. Store it with your tool result when you need proof of charge or later reconciliation.
If no toolId or toolName is configured, the SDK keeps using /api/mcp/charge for backward-compatible usage metering.
Configuration
Claude Desktop
Add to your claude_desktop_config.json:
Credential-free mode: If you omit LIVEAUTH_API_KEY, the server calls the normal MCP endpoints without a project header. LiveAuth binds its configured anonymous demo project, returns a signed PoW challenge, and preserves normal verification, JWT, rate-limit, and metering boundaries. LIVEAUTH_DEMO=true remains an explicit opt-in to the older locally simulated Lightning preview.
Other env vars:
Other MCP Clients
The server speaks stdio (JSON-RPC 2.0). Start it with:
It also works with any MCP-compatible client: Cursor, VS Code, ChatGPT, Windsurf, Continue, Cline.
Tool Reference
Full schemas for each MCP tool. Each tool is JSON-RPC 2.0 compatible and tested under src/index.test.ts and src/cli.test.ts.
liveauth_mcp_start
Start a new LiveAuth MCP session. Returns a PoW challenge by default, or a Lightning invoice if forceLightning=true.
Parameters:
forceLightning(boolean, optional): If true, request Lightning invoice instead of PoW challengeforceL402(boolean, optional): If true, start a session that should be confirmed with an L402 bundle macaroon
Returns (PoW):
Returns (Lightning):
Returns (L402 bundle):
liveauth_mcp_confirm
Submit a solved proof-of-work challenge, let the package solve its cached challenge, poll a Lightning payment, or present an L402 macaroon to receive a JWT authentication token.
Parameters:
quoteId(string): The quoteId from the start responsechallengeHex(string, optional, PoW only): The challenge hex from the start responsenonce(number, optional, PoW only): The nonce that solves the PoW challengehashHex(string, optional, PoW only): The resulting hash (sha256 ofprojectPublicKey:challengeHex:nonce)expiresAtUnix(number, optional, PoW only): Expiration timestamp from the challengedifficultyBits(number, optional, PoW only): Difficulty bits from the challengesignature(string, optional, PoW only): Signature from the challengemacaroon(string, L402 only): Bundle macaroon returned from the L402 bundle claim flow
When the challenge came from this MCP server, calling confirm with quoteId alone reuses the package's existing PoW solver. Explicit solution fields remain supported for compatibility.
Returns:
Note: Store the refreshToken securely. It is returned in MCP tool data but never written to stderr or application logs. Use liveauth_mcp_refresh to get a new JWT without re-authenticating.
liveauth_mcp_charge
Meter API usage after making an authenticated call. The bundled MCP server calls the generic /api/mcp/charge endpoint. Supplying toolName lets LiveAuth resolve a registered tool, apply its configured price, and create a paid-tool revenue event; omitting toolName keeps backward-compatible generic metering.
Parameters:
callCostSats(number, optional): Cost of the API call in sats. Omit to use backend pricing.toolName(string, optional): Registered MCP tool slug/name for per-tool pricing and attribution.
Returns:
If budget is exceeded:
liveauth_mcp_status
Check the status of an MCP session. Use to poll for Lightning payment confirmation.
Parameters:
quoteId(string): The quoteId from the start response
Returns:
When paymentStatus is "paid", the session is confirmed. Call liveauth_mcp_confirm again to get the JWT.
liveauth_mcp_lnurl
Get the Lightning invoice for a session (lnget-compatible). Use this to retrieve the BOLT11 invoice for payment with any Lightning wallet.
Parameters:
quoteId(string): The quoteId from the start response
Returns:
Note: This is compatible with lnget and other Lightning payment tools. Use this to poll for the invoice when liveauth_mcp_confirm returns "payment pending".
liveauth_mcp_usage
Query current usage and remaining budget without making a charge. Use this to check status before making API calls.
Parameters: (none required)
Returns:
liveauth_mcp_refresh
Refresh the JWT token without re-authenticating. Use the refreshToken returned from confirm to get a new JWT when the current one expires.
Parameters:
refreshToken(string): The refreshToken from the confirm response
Returns:
Note: Save the refreshToken securely. You'll need it to extend the session without solving a new PoW or making another Lightning payment.
Usage Example
PoW Authentication
- Call
liveauth_mcp_startto get a PoW challenge and quoteId - Call
liveauth_mcp_confirmwith the quoteId; the MCP server solves its cached challenge with the existing package solver - Advanced clients may still submit an explicit solution (
hash = sha256(projectPublicKey:challengeHex:nonce)wherehash < targetHex) - Use the JWT in
Authorization: Bearer <token>header for API requests - After each generic API call, call
liveauth_mcp_chargewith a call cost, or omit it to use the project global MCP price - For monetized MCP tools, wrap handlers with
createMcpGate({ toolId })orcreateMcpGate({ toolName })so each call creates a revenue event and signed receipt
Lightning Authentication
- Call
liveauth_mcp_startwithforceLightning: trueto get a Lightning invoice - Use
liveauth_mcp_lnurl(or pollliveauth_mcp_status) to get the BOLT11 invoice - Pay the invoice using your Lightning node/wallet
- Poll
liveauth_mcp_statuswith the quoteId until paymentStatus is "paid" - Call
liveauth_mcp_confirmwith just the quoteId to receive the JWT - Use the JWT with either generic
liveauth_mcp_chargemetering or SDK paid-tool attribution
Authentication Flow
Paid tool servers use the same JWT but charge through an attributed endpoint:
L402 Bundle Flow
LiveAuthCore supports Lightning-backed L402 bundles for prepaid MCP access. Buy a bundle, claim the macaroon after payment, then start an MCP session in L402 mode and confirm it with that macaroon.
Development
Resources
License
MIT
Categories: authentication · payments · lightning · l402 · bitcoin · pay-per-call · metering · agent-tools · anti-abuse · mcp-server · typescript
Paid execution and diagnostics contract (SDK 1.2.0)
The gate validates the session, records the charge, then invokes the handler.
Authorization plus an accepted execution attempt is billable, including a handler
exception, timeout, or cancellation after charging. There is no automatic refund.
Input rejection before the gate and charge denials do not consume usage. A revenue
event with status Charged proves billing, not successful tool execution.
Register the tool and move its lifecycle from Draft to Active before serving paid
calls. Draft means unpublished (tool_unpublished); Paused or other non-active states
return tool_inactive. Public discovery also requires Visibility=Public, but
visibility is separate from lifecycle: active private/internal tools can be charged.
There is no separate publication flag or new visibility restriction in this change.
Unknown or removed tools return HTTP 404 with JSON status=deny,
reason=tool_not_found, and the supplied tool identity. Registered-tool lifecycle
and budget denials retain HTTP 200 with status=deny.
gate.charge() returns structured denials with ok=false, including JSON HTTP
error responses with status=deny. gate.invoke() and gate.gateTool() throw
ChargeDeniedError with reason, code, toolName, and toolId. For compatibility
it extends BudgetExceededError (and LiveAuthMcpError); new handlers must inspect
reason rather than assume every instance means budget exhaustion. Unrelated HTTP
authentication, transport, and validation failures keep their existing error path.
Older backends may still return plain-text unknown-tool errors until upgraded.
On handler failure the gate throws ToolExecutionError with charge,
idempotencyKey, and a non-enumerable cause. Its public message is generic.
Expose an allowlist of charge fields: grossSats, revenueEventId, signed receipt,
and the idempotency key. Keep isError=true in the MCP response. Do not serialize
or log the error cause, JWT-bearing handler context, or arbitrary metadata.
Receipt payload/signature are existing public response artifacts and can be returned.
A successful charge can have no receipt; preserve this distinction rather than
inventing one. Billing metadata does not imply successful execution.
Three distinct identifiers
- Receipt
body.requestId: LiveAuth's server HTTP request/correlation identifier for the original recorded charge. A retry returns that original receipt. - Receipt
body.idempotencyKey: caller-controlled stable retry key. Deduplication is scoped to caller session, provider and registered tool for caller funding; legacy provider funding uses paying project and tool. - InvokeWorks
_meta.requestId: MCP/client correlation ID, taken fromX-Request-Idor derived from the JSON-RPC request ID. InvokeWorks also uses it as the LiveAuth idempotency key.
For example, _meta.requestId="client-123", receipt
body.idempotencyKey="client-123", and receipt body.requestId="server-456"
are valid together. The SDK accepts idempotencyKey; it does not send a separate
client request-ID option. Caller context { requestId } is local handler context.
Use a new key for a new logical call and reuse a key only for the same intended
operation. Deduplicated charging does not cache handler results: retries can execute
the handler again in legacy provider mode. Caller-funded duplicate authorizations return recorded payment status and do not execute again. Tool-state and price checks still precede deduplication.
來源:README.md,提交 5a3d172
工具
0版本歷史
1- v1.0.8最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分