Discover on-chain tools
Start with a program ID. Read its config PDA, load its published tools, and use them through Solana RPC.
Start with a program ID
Web3MCP starts from the target Solana program ID. This Devnet vault is a reference program; its tools are published in a PDA owned by the same program.
9zJzM4rHDPR4pd3vXHQjQ7whTVmx4zxB3ZH4Gb9iXRwDJ8Ph37LoQsv4yED6USdupCooCZzsVMqJkgBTm9uSkvCwapi.devnet.solana.comInstall the SDK
In a Node.js 20 or later project, install the SDK and Solana library.
npm install @web3mcp/sdk @solana/web3.jsDiscover the published tools
The SDK derives the config PDA, fetches it through RPC, and validates its ownership, status, digest, manifest, and IDL before returning tools.
node --input-type=module <<'JS'
import { Connection } from '@solana/web3.js';
import { Web3McpSdk } from '@web3mcp/sdk';
const programId = '9zJzM4rHDPR4pd3vXHQjQ7whTVmx4zxB3ZH4Gb9iXRwD';
const sdk = new Web3McpSdk({ connection: new Connection('https://api.devnet.solana.com') });
await sdk.discover(programId);
console.log(sdk.getTools(programId).map(({ name, solana }) => ({ name, kind: solana.kind })));
JSRead an account
The published get_vault_by_owner tool derives a vault PDA from an owner public key. The SDK verifies the returned account before decoding it. This read needs no signature.
node --input-type=module <<'JS'
import { Connection } from '@solana/web3.js';
import { Web3McpSdk } from '@web3mcp/sdk';
const programId = '9zJzM4rHDPR4pd3vXHQjQ7whTVmx4zxB3ZH4Gb9iXRwD';
const ownerAddress = 'Bp9Va3Qx9oFwme5uuXhDMdh2uUf3o8YHDBwcg4VYxc2L';
const sdk = new Web3McpSdk({ connection: new Connection('https://api.devnet.solana.com') });
await sdk.discover(programId);
console.log(await sdk.executeRead('get_vault_by_owner', { ownerAddress }, { programId }));
JSPrepare a write for approval
For a published instruction such as deposit, a compatible host validates arguments, resolves accounts, constructs one instruction, and simulates the transaction. The user reviews the exact message before their wallet signs. The SDK rejects a changed signed message.