You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Connecting with MCP Clients](#connecting-with-mcp-clients)
24
-
-[Cursor](#cursor)
25
-
-[Claude Desktop](#claude-desktop)
26
-
-[Installing via Smithery](#installing-via-smithery)
27
-
-[Installing via PyPI](#installing-via-pypi)
28
-
-[Contributing](#contributing)
29
-
-[Related Projects](#related-projects)
30
-
-[License](#license)
31
-
-[Testing with MCP Inspector](#testing-with-mcp-inspector)
32
-
-[Installation](#installation-1)
33
-
-[Usage](#usage-1)
34
-
35
9
## Overview
36
10
37
11
`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.
@@ -43,39 +17,37 @@ A Python utility package for building Model Context Protocol (MCP) servers.
43
17
- Simple decorators for MCP endpoints
44
18
- Synchronous implementation
45
19
- HTTP protocol support
46
-
-Redis response queue
47
-
- Comprehensive Pydantic models for MCP schema
20
+
-SQLite response queue
21
+
- Comprehensive msgspec models for MCP schema
48
22
- Built-in validation and documentation
49
23
50
24
## Installation
51
25
52
-
```bash
53
-
pip install mcp-utils
54
-
```
26
+
Install from this repo
55
27
56
28
## Requirements
57
29
58
30
- Python 3.10+
59
-
-Pydantic 2
31
+
-msgspec >= 0.18
60
32
61
33
### Optional Dependencies
62
34
63
35
- Flask (for web server)
64
-
- Gunicorn (for production deployment)
65
-
- Redis (for response queue)
36
+
66
37
67
38
## Usage
68
39
69
40
### Basic MCP Server
70
41
71
-
Here's a simple example of creating an MCP server:
42
+
Here's a simple example of creating an MCP server (using the built-in SQLite queue):
72
43
73
44
```python
74
45
from mcp_utils.core import MCPServer
46
+
from mcp_utils.queue import SQLiteResponseQueue
75
47
from mcp_utils.schema import GetPromptResult, Message, TextContent, CallToolResult
76
48
77
-
# Create a basic MCP server
78
-
mcp = MCPServer("example", "1.0")
49
+
# Create a basic MCP server with SQLite-backed queue
For production use, you can integrate the MCP server with Flask, Redis, and SQLAlchemy for better message handling and database transaction management:
# Convert msgspec Struct to builtin types for jsonify
92
+
return jsonify(msgspec.to_builtins(response))
156
93
157
94
158
95
if__name__=="__main__":
@@ -201,69 +138,13 @@ if __name__ == "__main__":
201
138
FlaskApplication(app, options).run()
202
139
```
203
140
204
-
## Connecting with MCP Clients
205
-
206
-
### Cursor
207
-
208
-
* Edit MCP settings and add to configuration
209
-
210
-
```json
211
-
{
212
-
"mcpServers": {
213
-
"server-name": {
214
-
"url": "http://localhost:9000/mcp"
215
-
}
216
-
}
217
-
}
218
-
```
219
-
220
-
### Claude Desktop
221
-
222
-
As of this writing, Claude Desktop does not support MCP through SSE and only supports stdio. To connect Claude Desktop with an MCP server, you'll need to use [mcp-proxy](https://github.com/sparfenyuk/mcp-proxy).
0 commit comments