#
Installation
To install the required package:
npm install @modelcontextprotocol/sdk
Or with pnpm:
pnpm add @modelcontextprotocol/sdk
Caution: Treat your MCP server URL like a password! It can be used to run tools attached to this server and access your data.
#
Usage Example
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
// Initialize the client
const client = new Client(
{
name: "mushroom-typescript-client",
version: "1.0.0",
},
{
capabilities: {},
}
);
// Replace with your Mushroom cluster's MCP Endpoint URL
// Get this from mushroom.viasocket.com → your Cluster → Claude Configuration panel
const serverUrl = "https://mcp.viasocket.com/mcp/YOUR_UNIQUE_ID";
const transport = new SSEClientTransport(new URL(serverUrl));
async function main() {
// Connect to your Mushroom cluster
console.log("Connecting to Mushroom MCP...");
await client.connect(transport);
console.log("Connected to Mushroom MCP");
// List all Mushrooms (apps) your cluster has access to
console.log("Fetching available Mushroom tools...");
const tools = await client.listTools();
console.log("Available Mushroom tools:", tools.tools.map(t => t.name));
// Example: call a tool from a connected Mushroom app (e.g. Google Sheets)
const result = await client.callTool({
name: "Add New Row To Sheet",
arguments: {
spreadsheet_id: "your_spreadsheet_id",
sheet_name: "Sheet1",
values: ["2026-04-09", "New Lead", "Pending"],
},
});
console.log("Tool result:", result);
// Close the connection
await client.transport?.close();
await client.close();
}
main();#
Notes:
Server URL: Copy the MCP Endpoint URL from your Mushroom cluster dashboard — it's unique to your cluster and authorises all its connected apps.
listTools(): Returns every action available across all Mushrooms (apps) in your cluster — one URL, all your apps.
callTool(): Executes a specific action on a connected Mushroom app. Tool names match exactly what you configured in your cluster (e.g.
"Add New Row To Sheet","Send Message","Create Contact").
This setup will connect to your Mushroom cluster, list all available app tools, and let you call any of them programmatically.
Was this helpful?