About Introduction to MCP
Introduction to MCP is a minimal Python example of an MCP calculator server and client, intended for developers learning the protocol. It demonstrates both SSE and stdio transports.
Key features
- 01Basic calculator operations
- 02SSE transport example
- 03stdio transport example
- 04Python server and clients
Use cases
- 01Learn a basic MCP server setup
- 02Test stdio client connections
- 03Explore SSE client connections
MCP support
It demonstrates an MCP server exposing basic calculator operations and clients connecting over SSE or stdio.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEIntroduction to MCP
A minimal MCP server and client example demonstrating basic calculator operations using both SSE and stdio transports.
Installation
To install all packages from your requirements.txt file using pip, you can use the following command in your terminal:
pip install -r requirements.txt
Running the Server
Make sure you have installed the mcp package. You can do this by running the following command in your terminal:
pip install mcp[cli]
Then, you can run the server.py script using the following command:
mcp dev server.py
You can also run the script using Python directly:
python server.py
Use python server.py for normal execution. Use mcp dev server.py for development with hot-reloading and a better developer experience.
Important Note
When you run
mcp dev server.py, you are starting the MCP Inspector and its proxy server, not your FastMCP server directly. The MCP Inspector runs its own proxy (default port 6277) and does not use the port (8050) specified in yourserver.py.
To run your FastMCP server on port 8050 as defined in server.py, you should execute:
python server.py
The mcp dev command is for development and debugging with the MCP Inspector, not for running your server directly on the specified port. If you want to use the Inspector, connect your client to the proxy port (6277). If you want your server to listen on 8050, run it with
python server.py.
Running the Client
STDIO Client
Launches the server as a subprocess and connects to it using the stdio transport. This is useful for testing and debugging.
python client_stdio.py
SSE Client
Connects to the server using the sse transport. This is useful for real-time updates and notifications.
python client_sse.py
Links
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.