MCP Utils is a Python utility package for building synchronous Model Context Protocol (MCP) servers using standard web technologies like Flask and Redis. It connects Python web applications and existing relational databases to MCP-compliant AI clients such as Cursor and Claude Desktop. Built specifically for developers who prefer synchronous architectures over asynchronous event loops, MCP Utils offers simple decorators for defining tools and prompts, built-in Pydantic v2 data models for MCP schema compliance, and Server-Sent Events (SSE) support. Developers working with existing web frameworks can integrate MCP servers directly into Flask routes, coordinate message handling, manage SQLAlchemy database transactions, and deploy using production WSGI servers such as Gunicorn. This eliminates the need to rewrite Python application backends into async code while still exposing custom backend capabilities and contextual prompt templates to AI coding assistants.
Category: AI & LLM Tooling
Tags: flask, framework, python, redis
pip install mcp-utils. 2. In your Python project, define your server endpoints using Flask and the MCPServer class. 3. Run your server using Flask or Gunicorn on your desired port (for example, port 9000). 4. To connect with Cursor, add your server URL to the configuration: json { "mcpServers": { "server-name": { "url": "http://localhost:9000/mcp" } } } 5. For Claude Desktop, which requires stdio transport, install mcp-proxy and configure claude_desktop_config.json: json { "mcpServers": { "weather": { "command": "/Users/yourname/.local/bin/mcp-proxy", "args": ["http://127.0.0.1:9000/sse"] } } }Part of MCP Servers
You can install MCP Utils from PyPI by running pip install mcp-utils in your Python 3.10 or newer environment. Optional dependencies such as Flask, Gunicorn, and Redis can also be installed if you intend to run a web server or handle response queues.
MCP Utils provides decorators and Pydantic schemas to build synchronous Model Context Protocol servers in Python. It allows developers to register custom tools and prompt templates, process MCP messages inside Flask routes, handle Server-Sent Events, and manage transactional database sessions via SQLAlchemy.
MCP Utils works natively with HTTP-compatible clients like Cursor by pointing to the server endpoint. For clients like Claude Desktop that rely on stdio transport, you can connect by running the third-party utility mcp-proxy against the server's SSE endpoint.
Yes, MCP Utils is open source software published under the MIT License. The code repository, documentation, and example applications are publicly hosted on GitHub.
You can test and debug your MCP server using the official MCP Inspector tool. By starting your Flask server and pointing the inspector web interface to your SSE endpoint, you can test server connections, monitor events, and send sample messages.