MCP Utils

by fulfilio

5 127 downloads Not rated yet MIT

About

A Python package with utilities and helpers for building MCP-compliant servers, often using Flask and Redis.

Details

License
MIT

Explore

- Basic utilities for MCP server implementation
- Server-Sent Events (SSE) support
- Simple decorators for MCP endpoints
- Synchronous implementation
- HTTP protocol support
- Redis response queue
- Comprehensive Pydantic models for MCP schema
- Built-in validation and documentation

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 Utils
    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

pip install mcp-utils

Gunicorn is a better approach to running even locally. To run the app with gunicorn

from gunicorn.app.base import BaseApplication

class FlaskApplication(BaseApplication):
def __init__(self, app, options=None):
self.options = options or {}
self.application = app
super().__init__()

def load_config(self):
config = {
key: value
for key, value in self.options.items()
if key in self.cfg.settings
}
for key, value in config.items():
self.cfg.set(key.lower(), value)

def load(self):
return self.application

if __name__ == "__main__":
handler = logging.StreamHandler(sys.stdout)
formatter = logging.Formatter("[%(asctime)s] [%(levelname)s] %(name)s: %(message)s")
handler.setFormatter(formatter)
logger.addHandler(handler)
options = {
"bind": "0.0.0.0:9000",
"workers": 1,
"worker_class": "gevent",
"loglevel": "debug",
}
FlaskApplication(app, options).run()

To install MCP Proxy for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install mcp-proxy --client claude

The stable version of the package is available on the PyPI repository. You can install it using the following command:

```bash

Claude Desktop / Cursor

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

{
    "mcpServers": {
        "mcp utils": {
            "mcp-utils": {
                "command": "npx",
                "args": [
                    "-y",
                    "@smithery/cli",
                    "install",
                    "mcp-proxy",
                    "--client",
                    "claude"
                ]
            }
        }
    }
}

McpServers

{
    "mcp-utils": {
        "command": "npx",
        "args": [
            "-y",
            "@smithery/cli",
            "install",
            "mcp-proxy",
            "--client",
            "claude"
        ]
    }
}

A Python utility package for building Model Context Protocol (MCP) servers.

Tests PyPI - Version

Table of Contents

- mcp-utils
- Table of Contents
- Overview
- Key Features
- Installation
- Requirements
- Optional Dependencies
- Usage
- Basic MCP Server
- Flask Example
- SQLAlchemy Transaction Handling Example
- Running with Gunicorn
- Connecting with MCP Clients
- Cursor
- Claude Desktop
- Installing via Smithery
- Installing via PyPI
- Contributing
- Related Projects
- License
- Testing with MCP Inspector
- Installation
- Usage

Overview

mcp-utils provides utilities and helpers for building MCP-compliant servers in Python, with a focus on synchronous implementations using Flask. This package is designed for developers who want to implement MCP servers in their existing Python applications without the complexity of asynchronous code.

Key Features

- Basic utilities for MCP server implementation
- Server-Sent Events (SSE) support
- Simple decorators for MCP endpoints
- Synchronous implementation
- HTTP protocol support
- Redis response queue
- Comprehensive Pydantic models for MCP schema
- Built-in validation and documentation

Installation

pip install mcp-utils

Requirements

- Python 3.10+
- Pydantic 2

Optional Dependencies

- Flask (for web server)
- Gunicorn (for production deployment)
- Redis (for response queue)

Usage

Basic MCP Server

Here's a simple example of creating an MCP server:

```python
from mcp_utils.core import MCPServer
from mcp_utils.schema import GetPromptResult, Message, TextContent, CallToolResult

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.