Skip to main content
Glama
Python MCP Server

Python MCP Server

by SaikiranBP

Python Model Context Protocol (MCP) Server & Client

A simple implementation of a Model Context Protocol (MCP) server and client in Python using the official mcp SDK.

This repository demonstrates how to expose tools, resources, and prompts from an MCP server using standard I/O (stdio) transport, and how an MCP client can connect, list tools, and invoke tool calls programmatically.

πŸ“ Repository Structure

.
β”œβ”€β”€ server.py         
β”œβ”€β”€ client.py         
β”œβ”€β”€ requirements.txt  
β”œβ”€β”€ .gitignore        
└── README.md         

Related MCP server: mcpscope

✨ Features

MCP Server (server.py)

  • Tools:

    • add(a, b): Adds two integers.

    • multiply(a, b): Multiplies two integers.

    • greet(name): Returns a personalized greeting string.

  • Resources:

    • queue://{facility}/status: Dynamic resource exposing queue status for a given facility.

  • Prompts:

    • analyze_queue(facility): Pre-defined prompt template for evaluating facility bottlenecks and waiting times.

MCP Client (client.py)

  • Spawns the MCP server sub-process over stdio.

  • Establishes a ClientSession.

  • Automatically retrieves and prints registered server tools and schemas.

  • Demonstrates executing a tool call (add) and printing the result.

πŸš€ Getting Started

Prerequisites

  • Python 3.10 or higher installed.

Installation

  1. Create and activate a virtual environment:

    • Windows:

      python -m venv venv
      .\venv\Scripts\activate
    • macOS / Linux:

      python3 -m venv venv
      source venv/bin/activate
  2. Install dependencies:

    pip install -r requirements.txt

πŸ§ͺ Running the Code

Execute the client script to automatically launch the MCP server in a subprocess and execute sample tool calls:

python client.py

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol server that provides basic tools for arithmetic operations (addition) and dynamic greeting resources, demonstrating MCP integration patterns for other projects and clients.
      7 npm
      ISC
    • F
      license
      A
      quality
      D
      maintenance
      A simple local MCP server that provides greeting and integer addition tools.
      2
      -
    • A
      license
      A
      quality
      D
      maintenance
      A minimal MCP server example demonstrating Tools, Resources, and Prompts. It enables calculations, time queries, note management, and code review prompts via stdio transport.
      3
      21 npm
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      A basic MCP server that provides arithmetic tools (add, subtract) and a greeting resource, demonstrating core MCP concepts.
      GPL 3.0