📚Academy
likeone
online

MCP Integration

Connect your agent to databases, APIs, and services through the Model Context Protocol

What Is MCP?

The built-in tools (Bash, Read, Write) let your agent interact with the local file system. But real-world agents need to talk to everything — databases, APIs, cloud services, Slack, GitHub, Google Calendar, and more. That is what MCP (Model Context Protocol) is for.

MCP is an open standard that defines how AI agents connect to external tools and data sources. Instead of writing custom integration code for every service, you plug in an MCP server and your agent immediately knows how to use it. One protocol, infinite connections.

Real-world analogy: MCP is USB for AI. Before USB, every device needed its own proprietary cable and driver. USB created one standard that works for keyboards, cameras, phones, and everything else. MCP does the same for AI tool connections — one protocol that works for databases, APIs, email, calendars, and everything else.

How MCP Works in the Agent SDK

The SDK makes MCP integration straightforward. You define MCP servers in your agent configuration, and the agent can use their tools alongside the built-in ones:

TypeScript — agent with MCP servers
import { Claude } from "@anthropic-ai/claude-agent";

const agent = new Claude({
  model: "claude-sonnet-4-6",
  tools: "defaults",

  // Connect MCP servers — each one adds new tools
  mcpServers: {
    // A database server that gives Claude SQL access
    database: {
      command: "npx",
      args: ["@anthropic-ai/mcp-server-sqlite", "./data.db"],
    },

    // A GitHub server for repo operations
    github: {
      command: "npx",
      args: ["@modelcontextprotocol/server-github"],
      env: {
        GITHUB_TOKEN: process.env.GITHUB_TOKEN,
      },
    },
  },
});

// Now Claude can query the database AND interact with GitHub
const result = await agent.query(
  "Check the database for users who signed up this week, then create a GitHub issue summarizing the count."
);

console.log(result.text);
🔒

This lesson is for Pro members

Unlock all 355+ lessons across 36 courses with Academy Pro. Founding members get 90% off — forever.

Already a member? Sign in to access your lessons.

Academy
Built with soul — likeone.ai