Build an AI Agent That Uses MCP
The basic architecture has three layers: the agent runtime manages reasoning and tool selection; the MCP client discovers and calls external capabilities; the MCP server owns the business capability.
User → Agent Runtime → MCP Client → MCP Server → API/DB/Service
Start with one narrow capability
Do not begin by connecting ten servers. Give the agent one MCP server with a small, well-described tool set. Verify tool selection, arguments, errors, approvals, and traces before expanding.
Keep authorization outside the prompt
The server must enforce permissions. The model deciding to call a tool is not proof that the user may perform the action.
Normalize outputs
Prefer structured results with stable IDs. That allows the agent to chain tool calls without parsing prose.
Design goal: the agent should know what a tool means, not how the downstream service implements it.