
索拉纳示范背景协议
概览
该存储库展示了一个用于索拉纳开发的示范背景协议服务器的简单实施。 模式背景协议(MCP)是AI模型与工具与资源互动的标准化界面. 此演示演示一个简单的 MCP 服务器执行, 提供: 1. 索拉纳的基本RPC方法(GetBalance, get AccountInfo, get Transaction) 2. 推动索拉纳发展的一些有益因素 - Node.js (v16或更高推荐) - pnpm 包管理器(v9.1.0或相容) 清除此寄存器并安装依赖性 : 要在 MCP 检查器中运行此服务器, 请使用 : 1.:主要执行方式为index.ts,它设置了MCP服务器,配备了简单的取取工具和一些提示. 2. :您可以通过添加更多的工具,资源和提示来扩展服务器.
概述(AI 翻译)
该存储库展示了一个用于索拉纳开发的示范背景协议服务器的简单实施。
□ 什么是MCP吗?
模式背景协议(MCP)是AI模型与工具与资源互动的标准化界面. 此演示演示一个简单的 MCP 服务器执行, 提供:
- 索拉纳的基本RPC方法(GetBalance、Get AccountInfo、Get Traction)
- 推动索拉纳发展的一些有益因素
□ 先决条件
- 节点.js(建议采用v16或更高)
- pnpm软件包管理器(v9.1.0或兼容)
□ 安装
清除此寄存器并安装依赖性 :
要在 MCP 检查器中运行此服务器, 请使用 :
∮开始∮
-
** 探索代码**:主要执行在
index.ts中,它设置了一个MCP服务器,有简单的取取取工具和一些提示. -
** 修改服务器**: 您可以通过添加更多的工具、资源和提示来扩展服务器。
-
** 获得延长的想法**: 检查一下为索拉纳发展部分扩展MCP的想法,以获得新工具和资源添加的灵感.
□ 实例使用
本节解释如何使用克洛德的索拉纳MCP服务器.
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
Solana Model Context Protocol (MCP) Demo
This repository demonstrates a simple implementation of a Model Context Protocol (MCP) server for Solana development.
What is MCP?
The Model Context Protocol (MCP) is a standardized interface for AI models to interact with tools and resources. This demo showcases a simple MCP server implementation that provides:
- Basic RPC methods for Solana (getBalance, getAccountInfo, getTransaction)
- Some helpful prompts for Solana development
Prerequisites
- Node.js (v16 or higher recommended)
- pnpm package manager (v9.10.0 or compatible)
Installation
Clone this repository and install dependencies:
git clone https://github.com/solana-foundation/solana-dev-mcp.git
cd solana-dev-mcp
pnpm install
To run this server in the MCP inspector, use:
npx @modelcontextprotocol/inspector ts-node index.ts
Getting Started
-
Explore the code: The main implementation is in
index.ts, which sets up an MCP server with simple fetching tools and some prompts. -
Modify the server: You can extend the server by adding more tools, resources, and prompts.
-
Get ideas for extensions: Check out the Ideas Extending MCP for Solana Development section to get inspiration for new tools and resources to add.
Example Usage
This section explains how to use the Solana MCP server in Claude. Follow the same steps to use the Solana MCP server in Windsurf and Cursor.
Generate the configuration file
To use this Solana MCP server, you need to generate a configuration file that Claude can use to connect to the server. Run one of the following commands to generate the configuration file:
pnpm generate-configif you havets-nodeinstalled globallypnpm build && pnpm generate-config:jsif you don’t havets-nodeinstalled globally
This will print a JSON config with the following content:
If you have ts-node:
{
"mcpServers": {
"solana-dev": {
"command": "ts-node",
"args": ["/index.ts"]
}
}
}
If you don’t have ts-node installed globally:
{
"mcpServers": {
"solana-dev": {
"command": "node",
"args": ["/dist/index.js"]
}
}
}
Project Structure
index.ts- Main server implementationpackage.json- Project dependencies and metadatatsconfig.json- TypeScript configuration
Ideas Extending MCP for Solana Development
This MCP server implementation provides a foundation that you can extend or fork for your own Solana development needs. Here are some ideas to get you started:
Ideas for Extension
安装
npx @modelcontextprotocol/inspector ts-node index.ts配置
{
"mcpServers": {
"solana-dev": {
"command": "ts-node",
"args": ["<full-path-to-repo>/index.ts"]
}
}
}