Sub topic 1
What MCP Is and Why It Fits Team Tooling
Prerequisites
You should know basic Python, JSON, JSON Schema, terminal commands, and how an LLM calls tools. This chapter uses the Python MCP SDK.
What MCP Is and Why It Fits Team Tooling
The Model Context Protocol (MCP) is an open protocol for connecting an AI application to external tools and data. Instead of building a custom integration for every host application, you expose a standard MCP server.
A team MCP server can wrap internal APIs, command-line tools, databases, or runbooks. The model receives explicit descriptions and input schemas, so it can select tools and construct arguments more reliably.
Hosts, Clients, and Servers
An MCP host is the AI application, such as an IDE or chat application. The host creates an MCP client for each connected server. The server provides tools, resources, or prompts.
The server does not decide when the model should call a tool. The host supplies the server’s capabilities to the model, asks for approval when appropriate, and sends tool calls through the client.
How a Session Starts: Messages and Capability Negotiation
MCP uses JSON-RPC messages. A client first sends an initialize request containing its protocol version and capabilities. The server responds with its supported version and capabilities. The client then sends an initialized notification.
After this handshake, the client can list tools with tools/list and call one with tools/call. Capability negotiation prevents a peer from assuming support for features that the other peer does not provide.
Choosing a Transport: Stdio or Streamable HTTP
Stdio runs the server as a local subprocess. It is simple and keeps communication private to the host. The server must reserve standard output for protocol messages.
Streamable HTTP exposes an HTTP endpoint. It fits shared or remote services, but requires authentication, authorization, request validation, and deployment controls.
Your First Tool
A tool is an operation the model may request. The SDK derives its schema from type hints and its description from the docstring.
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("team-tools")
@mcp.tool()
def get_service_owner(service: str) -> str:
"""Return the team that owns a service."""
owners = {"billing": "payments-team", "search": "discovery-team"}
if service not in owners:
raise ValueError(f"Unknown service: {service}")
return owners[service]
if __name__ == "__main__":
mcp.run()Exercise
Which transport is the better default for a server used only by one developer's local host?
Show answer
Stdio, because the host can launch the server locally without exposing an HTTP endpoint.