mcpField
S
Solana MCP

Solana MCP

本地服务
github.com/Cubie-AI金融数据577 周前更新

关于 Solana MCP

Solana MCP 是用于 Solana 的 MCP 服务,并提供配套客户端,面向需要将 Solana 能力接入 MCP 工作流的开发者。README 展示了查询代币持有者的工具示例。

主要功能

  1. 01提供 Solana MCP 服务
  2. 02提供 Solana MCP 客户端
  3. 03示例包含代币持有者查询工具

适用场景

  1. 01在 MCP 工作流中接入 Solana
  2. 02通过示例查询代币持有者

MCP 相关

该项目提供 Solana MCP 服务及客户端;示例展示了名为 getTokenHolders 的工具。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

暂未收录安装方式

我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。

代码仓库

工具

还没有获取到工具列表

本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。

详细介绍

Solana MCP

一个 Solana MCP 服务。

Cubie

目录

安装

要安装并使用 @cubie-ai/solana-mcp 包,请使用以下命令:

npm i @cubie-ai/solana-mcp

文档

阅读文档:文档

快速入门

创建服务
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { solanaMCPServer } from "../../dist";
import { SOLANA_RPC_URL } from "./contants";

async function main() {
  await solanaMCPServer({
    transport: new StdioServerTransport(),
    config: {
      solanaRpcUrl: SOLANA_RPC_URL,
      commitment: "confirmed",
    },
  });
}

main();
创建客户端
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
import { solanaMCPClient } from "../../dist";

const CUBIE_MINT = "2MH8ga3TuLvuvX2GUtVRS2BS8B9ujZo3bj5QeAkMpump";
async function main() {
  const transport = new StdioClientTransport({
    args: ["dist/server.js"],
    command: "node",
  });

  const client = await solanaMCPClient({
    name: "Solana MCP Client",
    version: "1.0.0",
    transport: transport,
  });

  const tools = await client.listTools();
  console.dir(tools, { depth: null });

  const supply = await client.callTool({
    name: "getTokenSupply",
    arguments: {
      mint: CUBIE_MINT,
    },
  });
  console.dir(supply, { depth: null });
}

main();

示例

运行示例将生成以下输出:

{
  tools: [
    {
      name: "getTokenHolders",
      description: "Get token holders for a specific mint address",
      inputSchema: {
        type: "object",
        properties: { mint: { type: "string" } },
        required: ["mint"],
        additionalProperties: false,
        $schema: "http://json-schema.org/draft-07/schema#",
      },
    },
    {
      name: "getTokenSupply",
      description: "Get the total supply of a specific token",
      inputSchema: {
        type: "object",
        properties: { mint: { type: "string" } },
        required: ["mint"],
        additionalProperties: false,
        $schema: "http://json-schema.org/draft-07/schema#",
      },
    },
    {
      name: "getTokenProgramByMintAddress",
      description: "Get the token program by mint address",
      inputSchema: {
        type: "object",
        properties: { mint: { type: "string" } },
        required: ["mint"],
        additionalProperties: false,
        $schema: "http://json-schema.org/draft-07/schema#",
      },
    },
    {
      name: "getAddressBalance",
      description: "Get the balance of a specific address",
      inputSchema: {
        type: "object",
        properties: { address: { type: "string" } },
        required: ["address"],
        additionalProperties: false,
        $schema: "http://json-schema.org/draft-07/schema#",
      },
    },
    {
      name: "getAddressHoldings",
      description: "Get the holdings of a specific address",
      inputSchema: {
        type: "object",
        properties: { address: { type: "string" } },
        required: ["address"],
        additionalProperties: false,
        $schema: "http://json-schema.org/draft-07/schema#",
      },
    },
    {
      name: "getSignaturesForAddress",
      description: "Get the signatures for a specific address",
      inputSchema: {
        type: "object",
        properties: { address: { type: "string" } },
        required: ["address"],
        additionalProperties: false,
        $schema: "http://json-schema.org/draft-07/schema#",
      },
    },
    {
      name: "getJupiterQuote",
      description: "Get a quote from Jupiter for a specific swap",
      inputSchema: {
        type: "object",
        properties: {
          inputMint: { type: "string" },
          outputMint: { type: "string" },
          amount: { type: "string" },
          slippage: { type: "string" },
        },
        required: ["inputMint", "outputMint", "amount"],
        additionalProperties: false,
        $schema: "http://json-schema.org/draft-07/schema#",
      },
    },
    {
      name: "getPrice",
      description: "Get the price of a specific token",
      inputSchema: {
        type: "object",
        properties: {
          inputMint: { type: "string" },
          outputMint: {
            type: "string",
            default: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
          },
        },
        required: ["inputMint"],
        additionalProperties: false,
        $schema: "http://json-schema.org/draft-07/schema#",
      },
    },
  ];
}
{
  content: [
    {
      type: "text",
      text: '{"amount":"999725949874932","decimals":6,"uiAmount":999725949.874932,"uiAmountString":"999725949.874932"}',
    },
  ];
}

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。