Skip to content

update sqlite's mcp version to 1.6.0 #1449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/sqlite/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ Docker:
docker build -t mcp/sqlite .
```

## Test with MCP inspector

```bash
uv add "mcp[cli]"
mcp dev src/mcp_server_sqlite/server.py:wrapper
```

## License

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.
4 changes: 3 additions & 1 deletion src/sqlite/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ version = "0.6.2"
description = "A simple SQLite MCP server"
readme = "README.md"
requires-python = ">=3.10"
dependencies = ["mcp>=1.0.0"]
dependencies = [
"mcp[cli]>=1.6.0",
]

[build-system]
requires = ["hatchling"]
Expand Down
21 changes: 16 additions & 5 deletions src/sqlite/src/mcp_server_sqlite/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
import logging
from contextlib import closing
from pathlib import Path
from mcp.server.models import InitializationOptions
import mcp.types as types
from mcp.server import NotificationOptions, Server
import mcp.server.stdio
from pydantic import AnyUrl
from typing import Any

from mcp.server import InitializationOptions
from mcp.server.lowlevel import Server, NotificationOptions
from mcp.server.stdio import stdio_server
import mcp.types as types


# reconfigure UnicodeEncodeError prone default (i.e. windows-1252) to utf-8
if sys.platform == "win32" and os.environ.get('PYTHONIOENCODING') is None:
sys.stdin.reconfigure(encoding="utf-8")
Expand Down Expand Up @@ -366,7 +368,7 @@ async def handle_call_tool(
except Exception as e:
return [types.TextContent(type="text", text=f"Error: {str(e)}")]

async with mcp.server.stdio.stdio_server() as (read_stream, write_stream):
async with stdio_server() as (read_stream, write_stream):
logger.info("Server running with stdio transport")
await server.run(
read_stream,
Expand All @@ -380,3 +382,12 @@ async def handle_call_tool(
),
),
)

class ServerWrapper():
"""A wrapper to compat with mcp[cli]"""
def run(self):
import asyncio
asyncio.run(main("test.db"))


wrapper = ServerWrapper()
Empty file added src/sqlite/test.db
Empty file.
Loading