Skip to main content

What is MCP?

Model Context Protocol is Anthropic’s open standard for giving LLMs access to external tools. l402-kit ships a ready-made MCP server with two categories of tools:

Generic L402 tools

ToolDescription
l402_fetchFetch any URL — pays automatically if it returns 402
l402_balanceCheck remaining Lightning budget
l402_spending_reportFull breakdown of payments this session

VERITY tools — paid services, auto-pay included

ToolPriceDescription
verity_btc_price10 satsReal-time BTC price in USD, EUR, BRL
verity_worldstate80 satsUTC time + geolocation + local weather
verity_search100 satsWeb search, top 10 organic results
verity_summarize50 satsAI summarization up to 50,000 chars
verity_sentiment30 satsSentiment score + keywords
verity_scrape200 satsWeb scraping to clean markdown
verity_domain_intel500 satsWHOIS + DNS + SSL certificates
verity_translate50 satsAI translation to 11 locales, MDX-aware
verity_integration10,000 satsComplete l402-kit integration for any GitHub repo
VERITY tools pay autonomously — no manual invoice handling needed.

Setup in Claude Desktop

1. Install Node.js ≥ 18

2. Configure your wallet

Config file location:
  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

3. Restart Claude Desktop

The tools l402_fetch, l402_balance, and l402_spending_report will appear in Claude’s tool list.

Environment variables

VariableRequiredDescription
BLINK_API_KEYBlink onlyYour Blink API key
BLINK_WALLET_IDBlink onlyYour Blink wallet ID
ALBY_TOKENAlby onlyAlby access token
ALBY_HUB_URLoptionalCustom Alby Hub base URL
BUDGET_SATSoptionalMax spend per session (default: 2000)

Using the tools

Once the server is running, Claude can call VERITY and any L402-protected API autonomously:
You: What's the BTC price right now?

Claude: [calls verity_btc_price]
        [Paid 10 sats] {"bitcoin":{"usd":97500,"eur":89800,"brl":548000}}

        Bitcoin is currently $97,500 USD (Cost: 10 sats)
You: Summarize this article: <pastes 5,000 words>

Claude: [calls verity_summarize with text="..."]
        [Paid 50 sats] {"summary":"..."}
You: Search for "lightning network adoption 2026"

Claude: [calls verity_search with q="lightning network adoption 2026"]
        [Paid 100 sats] {"results":[...]}
You: How much have I spent so far?

Claude: [calls l402_spending_report]
        === L402 Spending Report ===
        Total spent:  160 sats
        Remaining:    1840 sats

        By domain:
          l402kit.com: 160 sats

HTTP MCP endpoint

In addition to the stdio package, VERITY exposes a live HTTP MCP server — no installation required:
POST https://l402kit.com/api/mcp
Content-Type: application/json
Any MCP client that supports streamable HTTP transport can connect directly. Pass your Blink credentials as headers:
X-BLINK-API-KEY: your-blink-api-key
X-BLINK-WALLET-ID: your-wallet-id
Initialize:
{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"my-agent","version":"1.0"}},"id":1}
List tools:
{"jsonrpc":"2.0","method":"tools/list","params":{},"id":2}
Call a tool:
{"jsonrpc":"2.0","method":"tools/call","params":{"name":"verity_btc_price","arguments":{}},"id":3}
The endpoint auto-pays Lightning invoices using your wallet credentials and returns the VERITY result directly.

MCP registries

l402-kit is listed in all major MCP registries:
RegistryLink
Anthropic MCP Registry (official)io.github.ThiagoDataEngineer/l402-kit
Glamaglama.ai/mcp/servers/@ShinyDapps/l402-kit
Smitherysmithery.ai/servers/shinydapps/l402-kit
mcp.sosearch l402-kit
Machine-readable manifest: GET https://l402kit.com/.well-known/mcp.json

Setup with Cursor

Add the same config block to Cursor’s MCP settings under Settings → MCP Servers.

Setup with any MCP client

The server reads from stdin / writes to stdout (stdio transport):
BLINK_API_KEY=xxx BLINK_WALLET_ID=yyy BUDGET_SATS=500 npx l402-kit-mcp
Any MCP-compatible client can connect using the stdio transport.

Building a custom MCP server

You can also embed L402Client directly in your own MCP server:
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { L402Client, BlinkWallet } from "l402-kit";
import { z } from "zod";

const client = new L402Client({
  wallet: new BlinkWallet(process.env.BLINK_API_KEY!, process.env.BLINK_WALLET_ID!),
  budgetSats: 1000,
});

const server = new McpServer({ name: "my-agent", version: "1.0.0" });

server.tool(
  "fetch_weather",
  "Get current weather for a city — pays automatically",
  { city: z.string() },
  async ({ city }) => {
    const res = await client.fetch(`https://api.weather.com/current?city=${city}`);
    const text = await res.text();
    return { content: [{ type: "text", text }] };
  },
);

const transport = new StdioServerTransport();
await server.connect(transport);

Security notes

  • The budget cap (BUDGET_SATS) is your primary safeguard — set it conservatively
  • Each npx l402-kit-mcp process has its own in-memory budget; it resets on restart
  • For production agents, persist the spending log via onSpend callback to an external store