Simple MCP Client / Server

by tikoehle

97 downloads
Not rated
GitHub

Description

# Simple MCP Client / Server https://modelcontextprotocol.io/quickstart/server Install [uv](https://docs.astral.sh/uv/getting-started/installation/), on macOS and Linux. ```sh $ curl -LsSf https://astral.sh/uv/install.sh | sh ``` Then git clone the repo. ## MCP Server (stdio)…

About

# Simple MCP Client / Server https://modelcontextprotocol.io/quickstart/server Install [uv](https://docs.astral.sh/uv/getting-started/installation/), on macOS and Linux. ```sh $ curl -LsSf https://astral.sh/uv/install.sh | sh ``` Then git clone the repo. ## MCP Server (stdio) ``` uv init mcp_server cd mcp_server/ uv…

Details

Author
tikoehle
Downloads
97
Categories
Other

- Provides two weather tools: forecast and alerts.
- Supports both stdio and SSE transport.
- Includes a client that connects to the server.
- Testable via VSCode/Cline or MCP Inspector.
- Uses uv for dependency management and execution.
- Designed as a quickstart example for MCP development.

Install uv and then clone the repository. Create an MCP server project with uv init mcp_server, add dependencies (mcp[cli] and httpx), and write a Python server file. Start the server with uv run weather_stdio.py. Run the client with uv run client_stdio.py ../mcp_server/weather_stdio.py. Test with VSCode/Cline or MCP Inspector.

Simple MCP Client / Server

https://modelcontextprotocol.io/quickstart/server

Install uv, on macOS and Linux.

$ curl -LsSf https://astral.sh/uv/install.sh | sh

Then git clone the repo.

MCP Server (stdio)

uv init mcp_server
cd mcp_server/
uv run main.py                        # just to create the .venv, then rm the main.py

uv add "mcp[cli]" httpx # MCP server Python lib

touch weather_stdio.py # STDIO server implementation

Start the server

mcp_server$ uv run weather_stdio.py

Test with VSCode + Cline

Add MCP server to Cline.
Cline -> MCP Servers (icon close to '+') -> Installed -> Add
You get a json template "mcpServers": {} and you add the new server. Here is the cline_mcp_settings.json:
{
  "mcpServers": {
    "weather": {
            "command": "uv",
            "args": [
                "--directory",
                "/home/users/tikoehle/mcp_server",
                "run",
                "weather_stdio.py"
            ]
        }
  }
}

=> Cline shows the 2 get_* Tools functions. Click 'Done' to return to Cline Task input trying the new server.

Test

Type a task calling the two tools: "Can you tell me the weather forecast for San Francisco, CA" "Can you tell me the weather alerts for San Francisco, CA"

=> uses my two new MCP 'weather' server tools.

Note:
Local MCP servers should not log messages to stdout because this will interfere with protocol operation.

MCP Client

https://modelcontextprotocol.io/quickstart/client
uv init mcp_client
cd mcp_client/
uv run main.py                     # create venv

uv add mcp

touch client_stdio.py # MCP client impl.

Run the client

uv run client.py path/to/server.py
mcp_client$ uv run client_stdio.py ../mcp_server/weather_stdio.py

MCP Inspector

Installation Node.js

On the MCP server compute, get ``Node.js` (Current) for `Linux` using `nvm` with `npm`. https://nodejs.org/en/download

``
cd $HOME

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.