Skip to main content
The Model Context Protocol (MCP) is an open standard for connecting AI agents to external tools and data sources. Definable’s MCP module lets you connect to any MCP-compatible server and use its capabilities inside your agents.

What MCP Provides

MCP servers expose three types of capabilities:
CapabilityDescriptionExample
ToolsFunctions the agent can callFile operations, database queries, API calls
ResourcesData the agent can readFiles, configurations, live data feeds
PromptsReusable prompt templatesAnalysis templates, code review prompts

Architecture

Transport Types

Definable supports all three MCP transport types:
TransportProtocolBest For
stdioSubprocess stdin/stdoutLocal CLI tools, npm packages
SSEHTTP + Server-Sent EventsRemote servers, legacy MCP
HTTPStreamable HTTPRemote servers, modern MCP

Quick Example

Connect to a filesystem MCP server and use it in an agent:
from definable.agent import Agent
from definable.mcp import MCPToolkit, MCPConfig, MCPServerConfig
from definable.model import OpenAIChat

config = MCPConfig(servers=[
    MCPServerConfig(
        name="filesystem",
        transport="stdio",
        command="npx",
        args=["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
    ),
])

async with MCPToolkit(config=config) as toolkit:
    agent = Agent(
        model=OpenAIChat(id="gpt-4o"),
        toolkits=[toolkit],
    )
    output = await agent.arun("List all files in /tmp")
    print(output.content)

Key Components

Getting Started

Connect to your first MCP server step by step.

Configuration

Configure servers, transports, timeouts, and tool filtering.

Resources

Read data from MCP resource providers.

Prompts

Use reusable prompt templates from MCP servers.

Error Handling

Handle connection failures, timeouts, and reconnection.

Mock Servers

Test MCP integrations without real servers.