@alchemy/mcp-server

中文文档
0.3.0发布于 2026/03/27MITES Module构建来源已验证近 30 天下载 3264

MCP server for using Alchemy APIs

原始使用文档
文档目录19 节
  1. General Usage
  2. Quick Setup
  3. Environment Variables
  4. Available Methods
  5. Token Price Methods
  6. Multichain Token Methods
  7. Transaction History Methods
  8. NFT Methods
  9. Transaction Methods
  10. Swap Methods
  11. Local Development and Open Source Contributions
  12. Installation
  13. Development
  14. Building for Production
  15. Using the MCP Inspector for Debugging
  16. Contributing
  17. License
  18. Example Prompts
  19. API Reference

Alchemy MCP Server

A Model Context Protocol (MCP) server that enables AI agents to interact with Alchemy's blockchain APIs in a structured way. This allows agents to query blockchain data directly without writing any code.

Alchemy Server MCP server

General Usage

This MCP server creates a bridge between AI agents and Alchemy's blockchain APIs, allowing agents to:

  • Query token prices and price history (including flexible time frame queries)
  • Get NFT ownership information and contract data
  • View transaction history across multiple networks
  • Check token balances across multiple blockchain networks
  • Retrieve detailed asset transfers with filtering
  • Send transactions via Smart Contract Accounts (requires configured wallet agent server)
  • Execute token swaps via DEX protocols (requires configured wallet agent server)
  • And more!

Quick Setup

To quickly set up the MCP server, use the following configuration in your MCP config file (typically in Claude Desktop or Cursor settings):

{
  "mcpServers": {
    "alchemy": {
      "command": "npx",
      "args": ["-y", "@alchemy/mcp-server"],
      "env": {
        "ALCHEMY_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}

This configuration allows you to use the server without manually cloning the repository.

Environment Variables

The MCP server requires the following environment variable:

  • ALCHEMY_API_KEY - Your Alchemy API key (required for all blockchain data queries)

For transaction and swap functionality, you must also configure:

  • AGENT_WALLET_SERVER - URL of a configured wallet agent server that handles Smart Contract Account operations

⚠️ Important: The sendTransaction and swap methods will not function without a properly configured wallet agent server. These methods require external wallet infrastructure to handle signing and broadcasting transactions.

Available Methods

You can prompt your AI agent to use the following methods:

Token Price Methods

  1. fetchTokenPriceBySymbol

    • Gets current price data for tokens by symbol
    • Example: "What's the current price of ETH and BTC?"
  2. fetchTokenPriceByAddress

    • Gets current price data for tokens by contract address
    • Example: "What's the price of the token at address 0x1234...5678 on Ethereum mainnet?"
  3. fetchTokenPriceHistoryBySymbol

    • Gets historical price data for tokens with specific date ranges
    • Example: "Show me BTC price history from Jan 1 to Feb 1, 2023, with daily intervals"
  4. fetchTokenPriceHistoryByTimeFrame

    • Gets historical price data using flexible time frames or natural language
    • Example: "Show me ETH price for the last week" or "Get BTC price for the past 30 days"

Multichain Token Methods

  1. fetchTokensOwnedByMultichainAddresses
    • Gets token balances for addresses across multiple networks
    • Example: "What tokens does 0xabc...123 hold on Ethereum and Base?"

Transaction History Methods

  1. fetchAddressTransactionHistory

    • Gets transaction history for addresses across multiple networks
    • Example: "Show recent transactions for wallet 0xdef...456 on Ethereum"
  2. fetchTransfers

    • Gets detailed asset transfer data with advanced filtering options
    • Example: "Show me all ERC-20 transfers to or from 0xghi...789"

NFT Methods

  1. fetchNftsOwnedByMultichainAddresses

    • Gets all NFTs owned by addresses with spam filtering
    • Example: "What NFTs does 0xjkl...012 own?"
  2. fetchNftContractDataByMultichainAddress

    • Gets NFT contract data for addresses
    • Example: "What NFT collections does 0xmno...345 have tokens from?"

Transaction Methods

  1. sendTransaction
    • Sends transactions via Smart Contract Accounts
    • ⚠️ Important: Requires a configured wallet agent server with AGENT_WALLET_SERVER environment variable
    • Example: "Send 0.1 ETH to 0xpqr...678"

Swap Methods

  1. swap
    • Executes token swaps via DEX protocols (Uniswap)
    • ⚠️ Important: Requires a configured wallet agent server with AGENT_WALLET_SERVER environment variable
    • Example: "Swap 100 USDC for ETH"

Local Development and Open Source Contributions

Installation

  1. Clone the repository
git clone https://github.com/alchemyplatform/alchemy-mcp.git
cd alchemy-mcp
  1. Install dependencies
pnpm install

Development

pnpm watch

Building for Production

pnpm build

Using the MCP Inspector for Debugging

The MCP Inspector helps you debug your MCP server by providing a visual interface to test your methods:

pnpm inspector

This will start the MCP Inspector which you can access in your browser. It allows you to:

  • See all available methods
  • Test methods with different parameters
  • View the response data
  • Debug issues with your MCP server

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License.

Example Prompts

Here are some example prompts you can use with your AI agent:

What's the current price of Bitcoin and Ethereum?

Show me the NFTs owned by the wallet 0x1234...5678 on Ethereum.

What tokens does wallet 0xabcd...6789 hold across Ethereum and Base?

Get me the transaction history for 0x9876...5432.

Show me the price history of Ethereum from January 1st to today with daily intervals.

Get me Bitcoin price data for the last week with hourly intervals.

Show me ETH price performance for the past month.

What ERC-20 transfers happened to address 0x1234...5678 in the last 100 blocks?

API Reference

For more information about Alchemy's APIs, refer to:

版本与发布记录

@alchemy/mcp-server 共发布 12 个版本,首次发布于 2025/04/17;过去 12 个月发布了 2 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.3.0latest2026/03/277 个月前
0.2.22026/03/217 个月前
0.2.0-rc.0rc2025/08/081.3 年前
0.1.82025/07/091.3 年前
0.1.72025/07/041.3 年前
0.1.62025/07/041.3 年前

关于 @alchemy/mcp-server 的常见问题

@alchemy/mcp-server 是什么?

MCP server for using Alchemy APIs

如何安装 @alchemy/mcp-server?

在项目目录运行 npm install @alchemy/mcp-server,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 mcp-server-alchemy,可以用 npx mcp-server-alchemy 直接运行。

@alchemy/mcp-server 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/alchemy__mcp-server 是否存在。

@alchemy/mcp-server 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@alchemy/mcp-server 可以商用吗?

@alchemy/mcp-server 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@alchemy/mcp-server 的下载量有多少?

根据 npm 官方下载统计,@alchemy/mcp-server 在 2026/10/06 – 2026/11/04 这 30 天内被下载 3,264 次,日均约 109 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@alchemy/mcp-server 还在维护吗?

最新版本 0.3.0 发布于 2026/03/27(7 个月前);至今共发布 12 个版本,其中过去 12 个月发布了 2 个;首次发布于 2025/04/17。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。