https://github.com/day50-dev/simplest-mcp-server
This is the simplest MCP server and simplest MCP client possible
https://github.com/day50-dev/simplest-mcp-server
example mcp mcp-client mcp-server
Last synced: 6 months ago
JSON representation
This is the simplest MCP server and simplest MCP client possible
- Host: GitHub
- URL: https://github.com/day50-dev/simplest-mcp-server
- Owner: day50-dev
- Created: 2025-07-27T20:54:02.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-07-27T20:58:50.000Z (6 months ago)
- Last Synced: 2025-07-27T22:25:06.363Z (6 months ago)
- Topics: example, mcp, mcp-client, mcp-server
- Language: Python
- Homepage: https://day50.dev
- Size: 10.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simplest MCP Ever
This repository demonstrates a minimal, working example of an MCP server and client. There's no LLM involved, this uses what's called the "stdio" method.
However, there are branches that introduce things such as LLMs. After understanding the base code, go to the various branches to see how things get stacked on top.
## Functionality
This example server exposes a single tool:
* **`get_users_favorite_number`**: This tool, when called, simply returns the string "42" as the user's favorite number. This is a *very* basic example illustrating the server's capability to expose tools and return results.
## Repository Contents
* **`server.py`**: This is the core of the MCP server. It defines:
* The server initialization (`Server("favorite-number-server")`).
* The `list_tools` function, responsible for providing the list of available tools to the client.
* The `call_tool` function, which handles the execution of the tool based on the tool name and arguments.
* **`test_mcp.py`**: This file contains an automated test for the MCP server. It connects to the server, lists the available tools, calls the `get_users_favorite_number` tool, and asserts that the returned value is "42".
* **`test.sh`**: A simple shell script to execute the tests. It activates the virtual environment (if one exists) before running the test to ensure dependencies are correctly managed.
## Getting Started
Follow these steps to run the example:
3. **Set up a Virtual Environment (Recommended):**
```bash
python3 -m venv venv
source venv/bin/activate # On Linux/macOS
# venv\Scripts\activate # On Windows
```
4. **Install the `mcp` library:**
```bash
python3 -m pip install mcp
```
5. **Run the Tests:**
```bash
./test.sh
```
This script will:
* Activate the virtual environment (if it exists).
* Execute the `test_mcp.py` file, which will start the server, connect to it, call the tool, and verify the results.
If the test passes, you'll see the following output (or similar):
```
๐งช Testing Favorite Number MCP Server
โ Server initialized: favorite-number-server
โ Available tools: ['get_users_favorite_number']
โ Tool result: 42
โ Test passed! Favorite number is 42
โ
All tests passed!
```