Model Context Protocol (MCP)

Connect your agent to any MCP server for expanded capabilities and context.

What is MCP?

Model Context Protocol (MCP) is an open standard that enables AI applications to securely access external data sources, tools, and services. Instead of building custom integrations for every service, MCP provides a universal interface.

Your Daydreams agent becomes an MCP client that can connect to any MCP server and use its capabilities as if they were native actions.

Adding MCP to Your Agent

MCP integration happens through the extension system - just add servers and start using their tools:

mcp-setup.ts
import { createDreams } from "@daydreamsai/core";
import { createMcpExtension } from "@daydreamsai/mcp";

const agent = createDreams({
  extensions: [
    createMcpExtension([
      {
        id: "sqlite",
        name: "Database Access",
        transport: {
          type: "stdio",
          command: "npx",
          args: ["@modelcontextprotocol/server-sqlite", "./data.db"],
        },
      },
      {
        id: "filesystem",
        name: "File Access",
        transport: {
          type: "stdio",
          command: "npx",
          args: ["@modelcontextprotocol/server-filesystem", "./docs"],
        },
      },
    ]),
  ],
});

Available Actions

The MCP extension adds these actions:

  • mcp.listServers - Show connected MCP servers
  • mcp.listTools - List tools available on a server
  • mcp.callTool - Execute a server's tool
  • mcp.listResources - List server resources (files, data, etc.)
  • mcp.readResource - Read a specific resource
  • mcp.listPrompts - List server-defined prompts
  • mcp.getPrompt - Get a prompt with arguments

Transport Types

Local Servers (stdio)

Most MCP servers run as local processes:

{
  id: "server-name",
  transport: {
    type: "stdio",
    command: "node",
    args: ["server.js", "--option", "value"]
  }
}

Remote Servers (SSE)

For HTTP-based MCP servers:

{
  id: "remote-api",
  transport: {
    type: "sse",
    serverUrl: "https://mcp-server.example.com"
  }
}

The MCP ecosystem includes servers for common use cases:

Browse all available servers →

Next Steps

Key Benefits

Universal interface - Same API for all external tools
No custom integrations - Use existing MCP servers
Secure by default - Controlled access to external resources
Scalable - Connect to multiple servers simultaneously

MCP transforms your agent from isolated code into a connected system with access to the entire MCP ecosystem.