packages/examples/mcp/README.md
This directory contains MCP (Model Context Protocol) server implementations that expose an elizaOS agent as an MCP server. This allows any MCP-compatible client (like Claude Desktop, VS Code, etc.) to interact with your AI agent.
Uses real elizaOS runtime with OpenAI and SQL plugins!
| Framework | Language | Directory |
|---|---|---|
| @modelcontextprotocol/sdk | TypeScript | . |
The Model Context Protocol (MCP) is an open protocol that standardizes how AI applications communicate with external tools and data sources. By exposing your elizaOS agent as an MCP server, any MCP client can:
All implementations expose the same tools:
chatSend a message to the agent and receive a response.
Input Schema:
{
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "The message to send to the agent"
},
"userId": {
"type": "string",
"description": "Optional user identifier"
}
},
"required": ["message"]
}
Returns: Agent's response text
get_agent_infoGet information about the agent.
Returns: Agent name, bio, and capabilities
cd examples/mcp
bun install
OPENAI_API_KEY=your-key bun run start
All examples require an OpenAI API key:
export OPENAI_API_KEY=your-key
Optional configuration:
MCP_PORT - Port for HTTP transport (default: 3000)OPENAI_BASE_URL - Custom OpenAI-compatible endpointOPENAI_SMALL_MODEL - Model for quick responsesOPENAI_LARGE_MODEL - Model for complex responsesAdd to your Claude Desktop config (claude_desktop_config.json):
{
"mcpServers": {
"eliza": {
"command": "bun",
"args": ["run", "start"],
"cwd": "/path/to/eliza/examples/mcp",
"env": {
"OPENAI_API_KEY": "your-key"
}
}
}
}
cd examples/mcp
bun run test