rcarmo / umcp

A micro MCP server for stdio only (asyncio and synchronous)

Repository from Github https://github.comrcarmo/umcpRepository from Github https://github.comrcarmo/umcp

🐚 MicroMCP

This is a lightweight, zero-overhead implementation of Model Context Protocol (MCP) in pure Python inspired by the original bash implementation by Muthukumaran Navaneethakrishnan.

Why? I found the idea of using the simplest possible implementation of MCP in a shell script fascinating, but I wanted to see how it would look in Python with true introspection capabilities.


πŸ“‹ Features

  • βœ… Full JSON-RPC 2.0 protocol over stdio
  • βœ… Complete MCP protocol implementation
  • βœ… Dynamic tool discovery via function naming convention
  • βœ… Complete introspection of function signatures
  • βœ… Easy to extend with custom tools

πŸ”§ Requirements

  • Python 3

πŸš€ Quick Start

  1. Clone the repo
git clone https://github.com/rcarmo/umcp
  1. Try it out
echo '{"jsonrpc": "2.0", "method": "tools/call", "params": {"name": "get_movies"}, "id": 1}' | python ./movie_server.py

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ MCP Host    β”‚         β”‚ MCP Server    β”‚
β”‚ (AI System) │◄──────► β”‚ (myserver.py) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ stdio   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚
                      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                      β–Ό                    β–Ό
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚ Protocol Layer β”‚  β”‚ Business Logic β”‚
              β”‚ (umcp.py)      β”‚  β”‚(tool_* methods)β”‚
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚                    β”‚
                      β–Ό                    β–Ό
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚ Introspection β”‚    β”‚ External      β”‚
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚ Services/APIs β”‚
                                   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”Œ Examples

This implementation includes two simple example servers that demonstrate how to use the MCP protocol, one for a movie booking system and another for a calculator.

Both are supplied in synchronous and asynchronous versions, showcasing how to implement tools and introspection.


πŸ–₯️ Using with VS Code & GitHub Copilot

  1. Update VS Code settings.json
"mcp": {
    "servers": {
        "my-weather-server": {
            "type": "stdio",
            "command": "/path/to/your/server.py",
            "args": [],
            "env": {
                "MCP_API_KEY": "anything_you_need"
            }
        }
    }
}
  1. Use with GitHub Copilot Chat
/mcp my-weather-server get weather for New York

🚫 Limitations

  • No concurrency/parallel processing in synchronous version
  • No streaming responses
  • Not designed for high throughput

For AI assistants and local tool execution, these aren't blocking issues.


πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A micro MCP server for stdio only (asyncio and synchronous)

License:MIT License


Languages

Language:Python 100.0%