Skip to main content
Glama

MCP Blockchain Server

An MCP server that lets AI assistants read blockchain data and prepare transactions — while the user keeps full custody of their keys and signs every transaction in their own wallet.

It runs as a single, self-contained process. No database, no Redis, no API keys, no separate frontend to build. Point your MCP client at it and go.

┌──────────────┐   MCP (stdio)   ┌─────────────────────┐   RPC    ┌────────────┐
│ AI assistant │ ──────────────► │  mcp-blockchain     │ ───────► │ Blockchain │
│ (Claude …)   │ ◄────────────── │  server             │ ◄─────── │  (EVM)     │
└──────────────┘                 │   + signing web page │          └────────────┘
                                 └─────────┬───────────┘
                                           │ opens link, signs in wallet
                                           ▼
                                     ┌───────────┐
                                     │   User    │  (MetaMask / Rabby / …)
                                     └───────────┘

Why this design

The hard problem in AI + blockchain is letting an assistant act without ever touching private keys. This server solves it by splitting the work:

  • Reads (balances, contract state) happen server-side and return directly to the assistant.

  • Writes are only ever prepared server-side. The server hands back a URL; the user opens it, reviews the details, and signs in their own wallet. The wallet broadcasts the transaction. The server only ever learns the resulting transaction hash. Private keys never reach the server.

Related MCP server: ows-mcp-wallet

Quick start

Requirements: Node.js 18+. No clone, no build, no API keys.

Add the server to any MCP client that launches stdio servers. For Claude Desktop, open Settings → Developer → Edit Config and add:

{
  "mcpServers": {
    "blockchain": {
      "command": "npx",
      "args": ["-y", "mcp-blockchain-server"]
    }
  }
}

Restart the client. You can now ask things like "What's the ETH balance of vitalik.eth?" or "Send 0.01 test ETH to 0x… on Sepolia." For a send, the assistant returns a link — open it, review, and sign in your wallet.

No configuration is required: the server ships with free public RPC endpoints and defaults to the Sepolia testnet.

Use it in other clients

The same npx command works anywhere that runs an MCP stdio server — the config shape is identical across clients:

{ "command": "npx", "args": ["-y", "mcp-blockchain-server"] }

This is the block to drop into Cursor (.cursor/mcp.json), Cline, Windsurf, VS Code (.vscode/mcp.json), and others. To pass options, add an "env" block (see Configuration).

Run from source (development)

git clone https://github.com/zhangzhongnan928/mcp-blockchain-server.git
cd mcp-blockchain-server
npm install      # installs and builds (via the prepare script)

Then point the client at the build instead of npx:

{ "command": "node", "args": ["/absolute/path/to/mcp-blockchain-server/build/index.js"] }

Remote / web clients (HTTP transport)

For MCP clients that connect over HTTP instead of spawning a local process, run the server in HTTP mode. It then serves the MCP endpoint and the signing page on one port:

MCP_TRANSPORT=http PUBLIC_BASE_URL=https://your-host npx -y mcp-blockchain-server
  • MCP endpoint (Streamable HTTP): https://your-host/mcp

  • Signing links: https://your-host/tx/<id>

Bind a public interface with HOST=0.0.0.0 (or keep the default 127.0.0.1 and put it behind a reverse proxy). When exposed publicly, set MCP_ALLOWED_HOSTS and/or MCP_ALLOWED_ORIGINS to enable DNS-rebinding protection, and front it with HTTPS and access control.

To host it as a custom connector (one-click Render, Vercel, Docker, or a quick tunnel for testing) and wire it into Claude's Add custom connector dialog, see the deployment guide. On stateless hosts like Vercel, point the store at Redis (UPSTASH_REDIS_REST_URL / UPSTASH_REDIS_REST_TOKEN) so the signing flow persists across requests.

Tools

Tool

Purpose

get-chains

List supported networks and their chain ids.

get-balance

Native-token balance for an address on a chain.

read-contract

Call a read-only contract method (pass an abi or set ETHERSCAN_API_KEY).

prepare-transaction

Create an unsigned transaction and return a signing URL.

get-transaction-status

Track a prepared transaction by id.

read-contract is zero-config when you pass a human-readable ABI:

{
  "chainId": "1",
  "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
  "method": "balanceOf",
  "args": ["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"],
  "abi": ["function balanceOf(address) view returns (uint256)"]
}

Signing flow

  1. The assistant calls prepare-transaction. The server stores it and returns http://localhost:3000/tx/<id>.

  2. The user opens the link. The page shows the network, recipient, amount, and calldata.

  3. The user connects their wallet and clicks Approve & Sign. The wallet signs and broadcasts (eth_sendTransaction).

  4. The page reports the transaction hash back to the server, which watches for on-chain confirmation.

  5. The assistant polls get-transaction-status until it is CONFIRMED.

The signing page is plain HTML + vanilla JS served by the same process — there is nothing extra to build or deploy.

Configuration

Everything is optional. Copy .env.example to .env to override defaults.

Variable

Default

Description

MCP_TRANSPORT

stdio

stdio for local clients, or http to serve MCP over Streamable HTTP at /mcp.

PORT

3000

Port for the signing web server (and the /mcp endpoint in http mode).

HOST

127.0.0.1

Interface to bind (localhost only by default). Set 0.0.0.0 to expose remotely.

PUBLIC_BASE_URL

http://localhost:<PORT>

Base URL used in signing links and the /mcp URL (set when hosting remotely).

DEFAULT_CHAIN_ID

11155111

Default chain (Sepolia testnet).

LOG_LEVEL

info

error | warn | info | debug (logs go to stderr).

MCP_DATA_DIR

~/.mcp-blockchain

Where pending transactions are stored (file backend).

UPSTASH_REDIS_REST_URL / _TOKEN

Use a Redis store instead of the file backend. Required on stateless hosts (Vercel). KV_REST_API_URL / _TOKEN also work.

RPC_URL_<chainId>

built-in public RPC

Override the RPC for a chain, e.g. RPC_URL_1=https://….

INFURA_API_KEY

If set, upgrades default RPCs to Infura.

ETHERSCAN_API_KEY

If set, read-contract can auto-fetch verified ABIs.

MCP_ALLOWED_HOSTS

Comma-separated Host allowlist for http mode (enables DNS-rebind protection).

MCP_ALLOWED_ORIGINS

Comma-separated Origin allowlist for http mode (enables DNS-rebind protection).

Supported chains

Ethereum (1), Sepolia (11155111), Polygon (137), Polygon Amoy (80002), Base (8453), Base Sepolia (84532), Arbitrum One (42161), OP Mainnet (10). Each has a built-in public RPC; override any with RPC_URL_<chainId>.

Development

npm run dev        # run from source with auto-reload (tsx)
npm run build      # compile TypeScript to build/
npm start          # run the compiled server
npm test           # run the test suite (node:test)
npm run typecheck  # type-check without emitting

Releasing

CI (build + tests) runs on every push and PR. To publish a new version to npm:

  1. Add an NPM_TOKEN repository secret (an npm automation token) — once.

  2. Bump the version and tag: npm version patch (or minor / major), then git push --follow-tags.

  3. Create a GitHub Release for that tag. The release workflow runs the tests and publishes to npm (with provenance).

You can also publish manually: npm publish.

Security

  • Private keys never reach the server. It only prepares transactions; the user's wallet signs and broadcasts them.

  • The signing server binds to localhost by default and sets a strict, nonce-based Content-Security-Policy on the signing page.

  • All tool inputs (addresses, amounts, calldata) are validated before use.

  • Logs are written to stderr so they never corrupt the MCP stdio stream.

See docs/security.md for details.

Documentation

License

MIT — see LICENSE.

Available Tools

5 tools
get-balanceGet native balanceA
Read-only

Get an address's native-token balance (e.g. ETH) on a given chain.

ParametersJSON Schema
NameRequiredDescriptionDefault
addressYesThe wallet/contract address to check.
chainIdYesChain id, e.g. "1" for Ethereum or "11155111" for Sepolia.

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already provide readOnlyHint=true and openWorldHint=true, so the agent knows it's a safe, read-only operation. The description clarifies the asset type (native token) but adds no further behavioral traits like error handling or rate limits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, concise sentence containing all essential information with no redundant words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple balance query tool with readOnlyHint, the description is largely complete. However, it omits the return format (e.g., wei or decimal) and potential error conditions, which could be helpful given no output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema has 100% coverage with descriptions for both parameters (address, chainId). The description adds context about native tokens but no additional parameter-level details beyond what the schema provides, aligning with baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Get') and identifies the resource ('native-token balance') with an example ('ETH'). It clearly states the scope ('on a given chain'), differentiating it from sibling tools like 'get-chains' or 'get-transaction-status'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It does not mention prerequisites, contexts where it is appropriate, or when to avoid it, such as for token balances other than native.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get-chainsList supported chainsA
Read-only

List the blockchain networks this server supports, with their chain ids and native currencies.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.1/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true (safe read) and openWorldHint=true (dynamic results). The description adds that it returns chain ids and native currencies, which is consistent and adds value. No further behavioral traits disclosed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, front-loaded with the verb and resource, no extraneous words. Each word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given zero parameters, no output schema, and annotations covering safety and dynamism, the description is fully adequate for a simple listing tool. It specifies what is returned (chain ids and native currencies) without needing more.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameters exist (schema coverage 100%), so the description's job of explaining the tool's action is fulfilled. The description adds meaning beyond the empty schema by detailing the output content.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool lists blockchain networks with chain ids and native currencies. The verb 'list' and resource 'supported chains' are specific and distinguish it from siblings like get-balance or prepare-transaction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit when-to-use or alternatives given, but the context implies it is for retrieving supported networks. Since siblings are functionally distinct, no exclusion guidance is needed, though mentioning its use as a prerequisite could improve clarity.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get-transaction-statusGet transaction statusA
Read-only

Check the current status of a prepared transaction by its id.

ParametersJSON Schema
NameRequiredDescriptionDefault
idYesThe transaction id returned by prepare-transaction.

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds 'current status', implying time-sensitivity, beyond the readOnlyHint and openWorldHint annotations. However, it does not disclose what the status entails, potential behaviors, or any side effects, leaving some ambiguity.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence with no wasted words. Every word serves a purpose, making it highly efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (one parameter, no output schema, annotations present), the description is minimally adequate but lacks clarity on the return value or possible status types, which could improve completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with a clear parameter description. The tool description adds no additional meaning beyond what is already in the schema, so baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'check', the resource 'status of a prepared transaction', and the method 'by its id'. It distinguishes from siblings like get-balance and prepare-transaction by focusing on transaction status.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when you have a transaction id from prepare-transaction, but it does not explicitly state when to use or when not to use this tool, nor does it mention alternatives among siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

prepare-transactionPrepare a transaction for signingA

Create an unsigned transaction and return a URL the user opens to review and sign it in their own wallet. Private keys never reach this server. Share the returned URL with the user.

ParametersJSON Schema
NameRequiredDescriptionDefault
toYesRecipient address.
dataNoCalldata hex for contract interactions. Defaults to "0x".
valueNoAmount of native token to send, e.g. "0.01". Defaults to "0".
chainIdYesChain id, e.g. "1".
gasLimitNoOptional gas limit (integer). The wallet estimates if omitted.

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds value beyond annotations by disclosing that private keys never reach the server, a key security trait. With annotations already indicating openWorldHint=true, the description reinforces the user-involved workflow.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences with zero waste. Purpose is front-loaded and essential information is efficiently conveyed.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema, but the description explains the return is a URL for the user to review and sign. This covers the essential output without needing further detail.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and parameter descriptions in the schema are clear. The description does not need to duplicate param details, so baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool creates an unsigned transaction and returns a URL for user signing. It distinguishes itself from sibling tools which are read-only or informational (get-balance, get-chains, etc.).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when needing to prepare a transaction for signing, but does not explicitly state when not to use or provide alternatives. It gives practical instructions (share URL with user) but lacks exclusion criteria.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

read-contractRead a smart contractA
Read-only

Call a read-only (view/pure) contract method. Provide abi as human-readable signatures (e.g. ["function balanceOf(address) view returns (uint256)"]) for zero-config use, or set ETHERSCAN_API_KEY to auto-fetch verified ABIs.

ParametersJSON Schema
NameRequiredDescriptionDefault
abiNoOptional ABI: a signature string, array of signatures, or JSON ABI.
argsNoArguments for the method, in order.
methodYesMethod name to call, e.g. "balanceOf".
addressYesContract address.
chainIdYesChain id, e.g. "1".

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already provide readOnlyHint and openWorldHint. Description adds behavioral context: calls view/pure methods, details ABI handling (zero-config or auto-fetch). No contradictions. Adequate beyond annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two concise sentences; first sentence states core purpose, second explains ABI configuration. No unnecessary words, front-loaded with key information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema and generic nature of the tool, the description sufficiently covers how to invoke it. Mentions zero-config and Etherscan integration. Could optionally mention return format, but not critical.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline 3. Description adds specific meaning for the abi parameter (how to provide signatures or use Etherscan), going beyond the schema's generic 'Optional ABI' description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool calls read-only (view/pure) contract methods, with specific verb and resource ('call a... contract method'), and distinguishes from sibling tools like prepare-transaction by emphasizing read-only.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides clear context for when to use (calling read-only methods) and explains ABI provision options (human-readable signatures or Etherscan). Implicitly excludes state-changing methods, but no explicit when-not-to-use statement.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

A4.1/5.0
Disambiguation5/5

Each tool targets a distinct blockchain operation: balance query, chain listing, transaction status, transaction preparation, and contract reading. No functional overlap.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern with snake_case (e.g., get-balance, prepare-transaction). No mixing of styles.

Tool Count5/5

With 5 tools, the server covers core blockchain interactions without being excessive or too sparse. Each tool serves a clear purpose.

Completeness4/5

The tool set covers essential operations: balance, chain info, contract reading, and transaction lifecycle. Missing features like event log retrieval or gas estimation, but for basic blockchain interactions it is largely complete.

Maintenance

ActivityStale
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/zhangzhongnan928/mcp-blockchain-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server