MCP Fundamentals
Model Context Protocol (MCP)
Large Language Models (LLMs) like Claude, ChatGPT, and other AI assistants are powerful, but they normally operate in isolation. They cannot directly access your computer, read files, run programs, or query databases.
The Model Context Protocol (MCP) is a standard that allows language models to safely interact with external tools and data sources.
Instead of executing code directly, the language model communicates with an MCP server, which exposes specific capabilities that the model can use.
This enables AI systems to interact with real software and data.
Learn more: Model Context Protocol Documentation
MCP Architecture
The interaction between the user, the language model, and your MCP server looks like this:
User Prompt
↓
Language Model (Claude)
↓
MCP Client
↓
MCP Server
↓
Tools / Data Sources
The language model analyzes the user prompt and determines whether a tool should be used.
If a tool is needed:
1. The language model selects the appropriate tool. 2. The MCP client sends the request to the MCP server. 3. The server executes the tool. 4. The result is returned to the model. 5. The model formats the response for the user.
The model never directly runs code on your computer.
MCP Building Blocks
MCP servers provide three types of capabilities.
Tools
Tools are executable functions that perform actions or retrieve data.
Examples include:
- querying a database
- reading files
- performing calculations
- calling APIs
- searching datasets
A language model can decide to call one of these tools to answer a user's request.
Example tool:
get_weather(city="St. Louis")
The MCP server runs the function and returns the result to the language model.
Resources
Resources are data sources that the MCP server can access.
Examples include:
- files
- databases
- documents
- datasets
- logs
Resources provide context for the tools.
For example, a tool might read a dataset stored in a file.
Prompts
Prompts are the instructions given by the user.
Example:
"Show the top hitters on the 1940 Cardinals."
The language model interprets the prompt and decides whether it needs to call a tool.
The user never directly runs the tool — the model decides when tools are needed.
Example Workflow
Suppose the user asks:
"Show the top hitters on the 1940 Cardinals."
The system might behave like this:
1. Claude reads the prompt.
2. Claude determines that the request requires the tool get_top_players.
3. Claude calls the MCP server.
4. The server runs the Python function.
5. The result is returned and displayed to the user.
This process happens automatically.
Why MCP Matters
Without MCP, language models can only generate text.
With MCP, language models can:
- access real data
- run programs
- query databases
- analyze datasets
- automate workflows
This transforms AI systems from simple chatbots into agents capable of performing real tasks.
MCP in This Course
In this module, you will build a simple MCP server using Python.
Your server will expose tools that allow Claude Desktop to analyze historical St. Louis Cardinals batting statistics.
Claude will automatically call your tools when appropriate and display the results in the chat interface.