AI Agents and Multi-Agent Systems · Lesson 7
AI Communication Protocols & Building an MCP Server
The Model Context Protocol (MCP) is an open standard for connecting AI applications to tools and data. An MCP server exposes tools (actions), resources (readable data) and prompts (templates); an MCP client inside the AI app discovers and calls them.
Servers run locally over stdio or remotely over HTTP. Because the interface is standard, one server works with many clients and models.
Agent-to-Agent (A2A) protocols address a different need: letting agents from different systems discover each other and exchange tasks.
Key points
- MCP standardises tool and data access
- Servers expose tools, resources and prompts
- Local (stdio) or remote (HTTP) transports
- A2A focuses on agent-to-agent collaboration
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("course-tools")
@mcp.tool()
def add(a: int, b: int) -> int:
"""Add two numbers."""
return a + b
if __name__ == "__main__":
mcp.run()