MCP Server Basic Example

by ugundhar

263 downloads
Not rated
GitHub

About

MCP Server Basic Example is a minimal reference implementation of the Model Context Protocol (MCP) server in Python. It demonstrates core MCP capabilities—tools and resources—and is intended for developers learning how to build MCP servers.

Details

Author
ugundhar
Downloads
263
Categories
Other

- add(a, b) tool: adds two integers
- subtract(a, b) tool: subtracts second integer from first
- greeting://{name} resource: returns a personalized greeting
- Fully compatible with MCP Inspector and Claude Desktop
- Minimal Python implementation using uv as package manager

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name MCP Server Basic Example
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Initialize a project with uv init mcp-server-basic, create a virtual environment, and install mcp[cli]. Run the server for inspection with uv run mcp dev main.py, or normally with uv run mcp run. To install in Claude Desktop, use uv run mcp install main.py. For VS Code, run uv run main.py then open the chat with Ctrl+Shift+I.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "mcp server basic example": {
            "mcp-server-ugundhar": {
                "command": "uv",
                "args": [
                    "init",
                    "mcp-server-basic"
                ]
            }
        }
    }
}

McpServers

{
    "mcp-server-ugundhar": {
        "command": "uv",
        "args": [
            "init",
            "mcp-server-basic"
        ]
    }
}

MCP Server Basic Example

This is a basic example of a Model Context Protocol (MCP) server implementation that demonstrates core functionality including tools and resources.

Setup Steps

1. Initialize the project (Go to any local folder and launch powershell or cmd):

uv init mcp-server-basic
cd mcp-server-basic

2. # Create virtual environment and activate it

  uv venv
.venv\Scripts\activate

3. Install dependencies:

uv add "mcp[cli]"

or
uv add -r requirements.txt

Features

The server implements the following features:

Tools

- add(a: int, b: int): Adds two numbers - subtract(a: int, b: int): Subtracts second number from first

Resources

- greeting://{name}: Returns a personalized greeting

Running the Server

To run the server with the MCP Inspector for development:

uv run mcp dev main.py

To run the server normally:

uv run mcp run

To install the server in Claude desktop app:

uv run mcp install main.py

MCP connect in VS code

- Open folder/mcp-server-basic in vs code - open terminal and run below command :
uv run main.py
- Click Cntrl+Shift+I to launch chat in vs code - Do login with Github and setup - Folow the below steps (two way to add mcp configuration for vs code user settings):

#hello from mcp

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.