Skip to main content
HyperAgent functions as a fully functional MCP (Model Context Protocol) client. Connect to MCP servers to extend capabilities with tools like Google Sheets, Notion, Slack, and more.

What is MCP?

MCP (Model Context Protocol) is a standard for connecting AI models to external tools and data sources. HyperAgent can connect to any MCP-compatible server.

Setting Up MCP

Initialize the MCP client with your server configuration:
import { HyperAgent } from "@hyperbrowser/agent";

const agent = new HyperAgent({
  llm: {
    provider: "openai",
    model: "gpt-4o", // Recommended for MCP
  },
});

await agent.initializeMCPClient({
  servers: [
    {
      command: "npx",
      args: [
        "@composio/mcp@latest",
        "start",
        "--url",
        "https://mcp.composio.dev/googlesheets/your-connection-id",
      ],
      env: {
        npm_config_yes: "true",
      },
    },
  ],
});

Example: Web Data to Google Sheets

Scrape data from a website and write it to Google Sheets:
const agent = new HyperAgent({
  llm: {
    provider: "openai",
    model: "gpt-4o",
  },
  debug: true,
});

await agent.initializeMCPClient({
  servers: [
    {
      command: "npx",
      args: [
        "@composio/mcp@latest",
        "start",
        "--url",
        "https://mcp.composio.dev/googlesheets/...",
      ],
      env: {
        npm_config_yes: "true",
      },
    },
  ],
});

const response = await agent.executeTask(
  "Go to https://en.wikipedia.org/wiki/List_of_U.S._states_and_territories_by_population " +
  "and get the data on the top 5 most populous states from the table. " +
  "Then insert that data into a Google Sheet."
);

console.log(response);
await agent.closeAgent();

Available MCP Servers

Popular MCP servers you can connect to:
ServerUse Case
Google SheetsRead/write spreadsheet data
NotionCreate and update pages
SlackSend messages and notifications
GitHubCreate issues, PRs
AirtableDatabase operations
Find more at Composio MCP or build your own.

Multiple Servers

Connect to multiple MCP servers simultaneously:
await agent.initializeMCPClient({
  servers: [
    {
      command: "npx",
      args: ["@composio/mcp@latest", "start", "--url", "sheets-url"],
      env: { npm_config_yes: "true" },
    },
    {
      command: "npx",
      args: ["@composio/mcp@latest", "start", "--url", "slack-url"],
      env: { npm_config_yes: "true" },
    },
  ],
});

await agent.executeTask(
  "Scrape the pricing from competitor.com, save to Google Sheets, and notify #sales on Slack"
);