An MCP server is a reusable doorway to capabilities an AI application can use. Instead of writing a separate integration for every agent, you put the capability behind a server and connect agents to it. The server can expose tools (actions), resources (data), and prompts (reusable templates). An agent is one kind of MCP client; the service or data source behind the server is a separate part of the arrangement. section 1.2 section 3.6
A server is not the tool itself. A tool is a callable action, such as searching or saving an entry; the server hosts it and presents an interface the client can discover. After connecting, an agent can request the available tools and their descriptions, choose one for its task, call it, and use the result. The agent needs the tool’s name, parameters, and expected result—not access to its implementation. section 1.2 section 3.4.1
Listing 3.1 01_claude_mcp_server.py
from mcp.server.fastmcp import FastMCP
# Create an MCP server
mcp = FastMCP("Research Tools") #1
@mcp.tool() #2
def get_research_sources() -> list[str]:
"""Provides a list of research sources."""
search_sources = [
"Wikipedia",
"Google",
"YouTube",
]
return search_sources
The smallest working shape is a Python FastMCP server with one tool. The `@mcp.tool()` decorator registers the function; its signature supplies parameters, its docstring helps the agent decide when to call it, and its return annotation describes the result. Here, the tool returns a list of research sources. section 3.2.1
To try that server in Claude Desktop, install its Python file with the MCP CLI, check that the server appears in Developer settings, and request the tool in a new conversation. If it does not load, check the launch command, file path, Python setup, and required tools before debugging the agent’s choices. section 3.2.1
Choose a connection pattern according to where the capability lives:
- Local: run the server as a subprocess and communicate over standard input/output (STDIO). This suits development and single-machine use; an agent can manage the subprocess’s startup and shutdown. section 3.1.4 section 3.3.1
- Remote: connect to a separately running server over HTTP using server-sent events (SSE). This allows multiple agents to use a shared service, but server-side in-memory state may also be shared between them. section 3.1.4 section 3.4.2
- Hybrid: connect one agent to several servers, keeping sensitive file or database operations local while using remote servers for shared services. section 3.1.4
Move journaling tools out of an agent
Put `record_event` and `load_journal` in a standalone server, then register that server with the agent instead of registering each function. The agent discovers their schemas and can call them over STDIO or SSE. The journal’s storage can change without changing the agent’s tool-facing contract. With a shared remote process, however, two agents may encounter the same in-memory journal. section 3.4.1 section 3.4.2
Reach for an MCP server when a capability belongs to another service or deployment, or when several agents should reuse it. Prefer an in-process function for logic used only by one agent: a server adds a process, connection, latency, and another failure point. Keep exposed tool sets focused, give tools clear descriptions and typed inputs, assess servers before using them, and plan for timeouts, retries, and useful failure messages. section 3.3 section 11.1.2











