Skip to content

Commit fd657e6

Browse files
authored
Merge pull request #1449 from reticenceji/main
update sqlite's mcp SDK version to 1.6.0
2 parents ad91def + 9120679 commit fd657e6

File tree

5 files changed

+256
-113
lines changed

5 files changed

+256
-113
lines changed

src/sqlite/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,13 @@ Docker:
111111
docker build -t mcp/sqlite .
112112
```
113113

114+
## Test with MCP inspector
115+
116+
```bash
117+
uv add "mcp[cli]"
118+
mcp dev src/mcp_server_sqlite/server.py:wrapper
119+
```
120+
114121
## License
115122

116123
This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.

src/sqlite/pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ version = "0.6.2"
44
description = "A simple SQLite MCP server"
55
readme = "README.md"
66
requires-python = ">=3.10"
7-
dependencies = ["mcp>=1.0.0"]
7+
dependencies = [
8+
"mcp[cli]>=1.6.0",
9+
]
810

911
[build-system]
1012
requires = ["hatchling"]

src/sqlite/src/mcp_server_sqlite/server.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
import logging
55
from contextlib import closing
66
from pathlib import Path
7-
from mcp.server.models import InitializationOptions
8-
import mcp.types as types
9-
from mcp.server import NotificationOptions, Server
10-
import mcp.server.stdio
117
from pydantic import AnyUrl
128
from typing import Any
139

10+
from mcp.server import InitializationOptions
11+
from mcp.server.lowlevel import Server, NotificationOptions
12+
from mcp.server.stdio import stdio_server
13+
import mcp.types as types
14+
15+
1416
# reconfigure UnicodeEncodeError prone default (i.e. windows-1252) to utf-8
1517
if sys.platform == "win32" and os.environ.get('PYTHONIOENCODING') is None:
1618
sys.stdin.reconfigure(encoding="utf-8")
@@ -366,7 +368,7 @@ async def handle_call_tool(
366368
except Exception as e:
367369
return [types.TextContent(type="text", text=f"Error: {str(e)}")]
368370

369-
async with mcp.server.stdio.stdio_server() as (read_stream, write_stream):
371+
async with stdio_server() as (read_stream, write_stream):
370372
logger.info("Server running with stdio transport")
371373
await server.run(
372374
read_stream,
@@ -380,3 +382,12 @@ async def handle_call_tool(
380382
),
381383
),
382384
)
385+
386+
class ServerWrapper():
387+
"""A wrapper to compat with mcp[cli]"""
388+
def run(self):
389+
import asyncio
390+
asyncio.run(main("test.db"))
391+
392+
393+
wrapper = ServerWrapper()

src/sqlite/test.db

Whitespace-only changes.

0 commit comments

Comments
 (0)