100MB FREEResidential proxiesClaim
NumberOTP

SMS Verification MCP Server: Give AI Agents a Number

Set up an SMS verification MCP server so Claude, Cursor or Codex can get a number and read the code, with a spending cap, scoped keys and refunds.

NNanami
November 27, 202610 min read

An SMS verification MCP server lets an AI agent such as Claude Code, Cursor or Codex get a real phone number, read the one-time code that arrives on it and cancel the number for a refund if nothing comes. The tools are the easy part. What matters is what stops the agent overspending or buying numbers you never asked for. This guide covers setup, the tool list, the output of a real local run and the guardrails that actually hold. We run NumberOTP and build the numberotp-mcp server for AI agents, so the examples use it.

What an SMS verification MCP server does

It turns the steps of a phone check into tools a model can call: find the service, pick a country, buy a number, wait for the code, then close or cancel the number. MCP (Model Context Protocol) is the standard way clients like Claude Desktop, Claude Code, Cursor, Windsurf and Codex discover and call tools that run outside the model.

A typical session is five calls:

  1. search_services turns a name or domain ("discord.com") into a service code, so the agent never guesses one.
  2. get_prices lists countries with stock, price and a measured success rate for that service.
  3. buy_number returns a number and an id. The agent (or you) types the number into the site and asks it to send the SMS.
  4. wait_for_code blocks for up to 120 seconds per call and returns the code and the full SMS text. If it times out, the number is still open and the agent calls again.
  5. finish_number closes the number once the code worked, or cancel_number refunds it if no SMS came.

Underneath, these are the same API calls our SDKs for Node, Python, Go and PHP make. The MCP layer adds tool descriptions a model can read, error messages written as next steps, and a spending cap.

Set up the MCP server in Claude Code, Cursor or Codex

Setup takes two steps: create a limited API key, then register the server in your client with that key and a budget. The server runs on your machine through npx and needs Node 20 or newer.

1. Create a key the agent can't misuse

In Dashboard → Developer, create a key with only the read and buy scopes, or run notp keys create agent --scope read,buy with the CLI. A read,buy key can buy and read numbers, but it can't manage keys, webhooks or your account. Add topup only if you want the agent to make payment links for you. Even then it can't pay, only hand you a link.

2. Register the server

In Claude Code, one command does it:

claude mcp add numberotp --env NOTP_API_KEY=notp_… --env NOTP_MAX_SPEND=5 -- npx -y numberotp-mcp

Everything after -- is the server command. Claude Code writes the entry to local scope unless you add --scope project or --scope user, as its MCP documentation explains. Don't use project scope for this server unless you keep the key out of the committed .mcp.json.

Claude Desktop (claude_desktop_config.json), Cursor (~/.cursor/mcp.json) and Windsurf use the same JSON block:

{
  "mcpServers": {
    "numberotp": {
      "command": "npx",
      "args": ["-y", "numberotp-mcp"],
      "env": { "NOTP_API_KEY": "notp_…", "NOTP_MAX_SPEND": "5" }
    }
  }
}

Codex reads TOML from ~/.codex/config.toml with the same command, args and env under [mcp_servers.numberotp]. The full per-client list and troubleshooting are in the MCP setup guide. Restart the client afterwards. The most common start failure is setting NOTP_API_KEY in your shell instead of in the client's config.

The 13 tools and what their annotations tell your client

numberotp-mcp 0.1.0 exposes 13 tools, and each one carries MCP tool annotations that say whether it only reads or changes something. Clients can use those hints to auto-approve safe calls and ask before risky ones. The values below are what the server returned to tools/list in our local run.

ToolWhat it doesAnnotationsSuggested client setting
search_services, get_prices, get_balanceLook up codes, prices, stock, balance and budget leftread-onlyAllow
wait_for_code, get_number, list_numbers, get_rentalRead codes and every SMS on a numberread-onlyAllow
buy_numberBuy a one-time number within the budget and an optional max_pricenot read-only, not idempotentAsk
rent_numberRent a number for hours or days (not refundable)not read-only, not idempotentAsk
request_another_smsAsk for a second code on the same numbernot read-onlyAsk or allow
cancel_numberRelease a number with no SMS and refund itdestructive, idempotentAllow (it returns money)
finish_numberClose a number after the code workedidempotentAllow
create_topup_linkMake a card or crypto payment link for younot read-onlyAsk, or don't grant topup

Two caveats from the protocol itself. The MCP tools specification says clients must treat annotations as untrusted unless the server is trusted, and that there should always be a human able to deny a tool call. Annotations are labels, not locks. The real limits must be enforced somewhere the model can't talk its way past, which is the next section.

What a local run of the MCP server showed

We started numberotp-mcp 0.1.0 over stdio on 28 November 2026 (01:26 IST) with a deliberately invalid placeholder key and a $0.50 budget, then sent JSON-RPC calls from a short Node script. With an invalid key nothing can be bought, so the run cost $0. Here is the trimmed raw output:

[stderr] numberotp-mcp 0.1.0 ready (session budget $0.5)
server: {"name":"numberotp","version":"0.1.0"} protocol: 2025-06-18
tools: 13

### search_services {"query":"discord.com"} (607 ms)
Best match: Discord (code "ds").

### search_services {"query":"some-internal-staging-app.example"} (433 ms)
No match. For sites not in the list use code "ot" (Any other service).

### get_prices {"service":"other","country":"usa"} (1983 ms)
Any other (code "ot") — 1 countries, most reliable first:
  { "country_name": "USA", "price_usd": 1.05, "best_pool": "pool1", ... }

### buy_number {"service":"other","country":"usa"} (692 ms) isError=true
This number costs about $1.05 but this session's budget has $0.50 left (cap $0.5).
Pick a cheaper country with get_prices, or ask the user to raise NOTP_MAX_SPEND.

### get_balance {} (348 ms) isError=true
The NumberOTP API key is missing, invalid or revoked. Ask the user to set
NOTP_API_KEY (Dashboard → Developer).

Three things are worth noticing. Service and price lookups worked without a valid key, because they read public catalogue data. The budget check refused the $1.05 purchase before any account call was made, so the cap held even though the key was bad. And every failure came back as an instruction the model can act on, not a stack trace. The $1.05 is the live price for that service and country at that moment. Current prices are on the pricing page.

Guardrails that actually hold, and their limits

Four controls sit outside the model and don't depend on it behaving: the key's scopes, the session spending cap, the per-purchase max_price, and the fact that the agent can only create a payment link, never pay. Your client's approval prompts are a fifth, and that layer is yours to configure.

  • Key scopes are enforced by the API. A read,buy key gets a 403 on anything else, however the agent asks.
  • NOTP_MAX_SPEND (default $5) is checked inside the server before every buy_number and rent_number. If the quoted price is over what's left, the server refuses.
  • max_price is passed to the API with the order, so a price change between quote and purchase can't push the cost higher.
  • Refunds: if no SMS arrives within the activation window (typically 20 minutes), the cost goes back to your wallet automatically, per our refund policy. cancel_number does it sooner.

Limits of the spending cap you should know

We read the 0.1.0 source so you don't have to. The cap is per server process: it lives in memory, so restarting the client starts a fresh budget. The counter goes down when the agent calls cancel_number, but an automatic refund after the window expires does not lower it, so a session where numbers lapse can hit its cap early. And the cap covers numbers only. It doesn't limit how many read-only calls the agent makes. If you need a hard daily limit across sessions, keep the account balance low and top up as needed.

Keep a human on the spending tools

Allow the read-only tools and keep anything that spends on "ask". That matches the protocol's own advice and costs you one click per purchase. In Claude Code, permission rules name MCP tools as mcp__<server>__<tool>, so an allow list in .claude/settings.json could look like this:

{
  "permissions": {
    "allow": [
      "mcp__numberotp__search_services",
      "mcp__numberotp__get_prices",
      "mcp__numberotp__get_balance",
      "mcp__numberotp__wait_for_code",
      "mcp__numberotp__get_number",
      "mcp__numberotp__cancel_number",
      "mcp__numberotp__finish_number"
    ]
  }
}

buy_number, rent_number and create_topup_link aren't listed, so Claude Code will ask before each one. Cursor and other clients have their own per-tool approval settings. Whatever the client, see what the agent did afterwards: every number shows in your dashboard, and notp events tail streams events live. If you'd rather have your own code react, the signed webhook receiver in Node.js gets the same events.

When an agent shouldn't do the verification

An agent with a phone number is useful for your own accounts and for testing your own sign-up flow end to end. It is the wrong tool for anything a platform's rules forbid. Use it for your own accounts and follow each platform's terms; some platforms don't allow virtual numbers. Our acceptable use policy rules out bulk or fake accounts and getting round one-account limits, and an agent doesn't change that.

For your own product, a real SMS is often not the first step anyway. Fictional test numbers and emulators cover most cases for free (see how Firebase test numbers and the Auth emulator work). Keep real numbers for the final check that your SMS provider actually delivers, which is what our developer guide to testing SMS OTP without your own phone walks through. If you'd rather script that check than chat with an agent, the Playwright end-to-end OTP test uses the same SDK. Numbers usually work but not on every platform. When no code arrives, the eight common reasons an OTP never shows up apply to agents too, and the refund covers the cost.

Frequently Asked Questions

Which AI clients can use an SMS verification MCP server?

Any client that supports MCP over stdio can run numberotp-mcp, including Claude Code, Claude Desktop, Cursor, Windsurf, Codex and Zed. The server runs locally through npx and needs Node 20 or newer. Each client stores the command and environment variables in its own config file, so set the API key there rather than in your shell profile.

Can the agent spend more than I allow?

Not through the server. NOTP_MAX_SPEND, five dollars by default, is checked before every purchase and rental, and the server refuses anything over the remaining budget. The budget resets when the client restarts, because it is held per process. For a firm overall ceiling, keep a small account balance and use a key without the topup scope.

What happens if no SMS code arrives?

The wait tool times out after up to 120 seconds per call and tells the agent the number is still open, so it can wait again or cancel. Cancelling refunds the full price right away. If nobody cancels, the cost is credited back automatically when the activation window ends, which is typically 20 minutes after purchase.

Does the MCP server cost extra?

No. numberotp-mcp is free and MIT-licensed, and numbers bought through it cost the same as buying on the website. You pay per activation from a balance topped up by card or crypto, with no subscription. The price lookup tool shows the live price for each country before the agent buys anything.

Is it safe to give an AI agent an API key?

It is reasonably safe if the key is limited. A key with only the read and buy scopes cannot manage other keys, webhooks or account settings, and the spending cap limits purchases. Keep the key out of shared project config files, require approval for buying tools in your client, and revoke the key in the dashboard if it leaks.

Give your agent a phone number with a budget

If you want an agent that can finish a phone check without handing it your own SIM, create a read,buy key and add numberotp-mcp with a spending cap. It takes two minutes, the server is free, and any number that never gets a code is refunded. Create a free NumberOTP account, then follow the MCP setup guide.

Frequently Asked Questions

Which AI clients can use an SMS verification MCP server?+

Any client that supports MCP over stdio can run numberotp-mcp, including Claude Code, Claude Desktop, Cursor, Windsurf, Codex and Zed. The server runs locally through npx and needs Node 20 or newer. Each client stores the command and environment variables in its own config file, so set the API key there rather than in your shell profile.

Can the agent spend more than I allow?+

Not through the server. NOTP_MAX_SPEND, five dollars by default, is checked before every purchase and rental, and the server refuses anything over the remaining budget. The budget resets when the client restarts, because it is held per process. For a firm overall ceiling, keep a small account balance and use a key without the topup scope.

What happens if no SMS code arrives?+

The wait tool times out after up to 120 seconds per call and tells the agent the number is still open, so it can wait again or cancel. Cancelling refunds the full price right away. If nobody cancels, the cost is credited back automatically when the activation window ends, which is typically 20 minutes after purchase.

Does the MCP server cost extra?+

No. numberotp-mcp is free and MIT-licensed, and numbers bought through it cost the same as buying on the website. You pay per activation from a balance topped up by card or crypto, with no subscription. The price lookup tool shows the live price for each country before the agent buys anything.

Is it safe to give an AI agent an API key?+

It is reasonably safe if the key is limited. A key with only the read and buy scopes cannot manage other keys, webhooks or account settings, and the spending cap limits purchases. Keep the key out of shared project config files, require approval for buying tools in your client, and revoke the key in the dashboard if it leaks.

Need a number right now? Get $0.10 in free credits — no card required.

Sign up free →

Written by

N

Nanami

Nanami is a telecom and digital privacy specialist at NumberOTP with over 8 years of experience in SMS verification systems, virtual phone infrastructure, and online identity protection. He covers OTP security, number masking, developer APIs, and privacy-first verification workflows for businesses and developers worldwide.

Get your first OTP number free

$0.10 in credits on signup. No card required. Works for 800+ platforms.

Get started free →