{"id":9101,"library":"mcp-server-sqlite","title":"MCP Server SQLite","description":"A specialized server implementation for the Minecraft Protocol (MCP) project, providing a persistent backend using SQLite. It extends `mcp-server` to manage user data and game state within an SQLite database. Current version is 2025.4.25, following a rapid release cycle often synchronized with Minecraft client updates or changes to the underlying MCP protocol.","status":"active","version":"2025.4.25","language":"en","source_language":"en","source_url":"https://github.com/PyPrickle/mcp-server-sqlite","tags":["minecraft","sqlite","server","protocol","game"],"install":[{"cmd":"pip install mcp-server-sqlite","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Provides the core Minecraft Protocol server logic; mcp-server-sqlite builds upon and extends its functionality.","package":"mcp-server","optional":false}],"imports":[{"note":"The main server class resides in the `server` submodule, not directly in the top-level package.","wrong":"from mcp_server_sqlite import MCPSQLiteServer","symbol":"MCPSQLiteServer","correct":"from mcp_server_sqlite.server import MCPSQLiteServer"}],"quickstart":{"code":"import logging\nfrom mcp_server_sqlite.server import MCPSQLiteServer\n\n# Configure basic logging for better visibility\nlogging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')\n\n# Initialize the SQLite MCP server.\n# By default, it creates 'mcp_server.db' in the current working directory.\n# For production, it's recommended to specify an explicit path:\n# server = MCPSQLiteServer(database_file='/var/lib/mcp/my_server.db')\nserver = MCPSQLiteServer()\n\nprint(\"Starting MCP SQLite server on 0.0.0.0:25565...\")\ntry:\n    server.run()\nexcept KeyboardInterrupt:\n    logging.info(\"Server stopped by user (KeyboardInterrupt).\")\nexcept Exception as e:\n    logging.error(f\"An unexpected error occurred: {e}\", exc_info=True)\n","lang":"python","description":"Initializes and runs a basic MCP server with SQLite persistence. By default, it creates `mcp_server.db` in the current working directory. For robust applications, always specify an absolute database file path and include error handling for graceful shutdown."},"warnings":[{"fix":"Always specify an absolute or relative path for `database_file` in the `MCPSQLiteServer` constructor, e.g., `MCPSQLiteServer(database_file='path/to/my_server.db')`.","message":"The server defaults to creating `mcp_server.db` in the current working directory if no `database_file` is specified during initialization. Running the server from different directories will create separate, distinct database files, leading to data inconsistencies or loss if not explicitly managed.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always pin both `mcp-server-sqlite` and `mcp-server` to specific versions in your `requirements.txt` to ensure compatibility. Consult the `mcp-server` documentation for its own breaking changes and update both libraries in sync.","message":"As `mcp-server-sqlite` heavily relies on the `mcp-server` base library, breaking changes or API shifts in `mcp-server` may indirectly break `mcp-server-sqlite`. The `YYYY.MM.DD` versioning of both projects suggests frequent updates that might not always be backward compatible with older `mcp-server` versions.","severity":"breaking","affected_versions":"Potentially all major `YYYY` versions if `mcp-server` updates significantly."},{"fix":"Wrap the `server.run()` call in a `try...except KeyboardInterrupt` and a general `except Exception` block to handle unexpected shutdowns gracefully, as shown in the quickstart example.","message":"If the server's `run()` method is not wrapped in a `try...except` block (e.g., `KeyboardInterrupt` or other exceptions), the server will abruptly terminate without graceful shutdown, potentially leaving database connections open or causing data corruption.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"`pip install mcp-server-sqlite`","cause":"The `mcp-server-sqlite` package is not installed in the current Python environment.","error":"ModuleNotFoundError: No module named 'mcp_server_sqlite'"},{"fix":"Change `from mcp_server_sqlite import MCPSQLiteServer` to `from mcp_server_sqlite.server import MCPSQLiteServer`","cause":"Incorrect import path. The `MCPSQLiteServer` class is located within the `server` submodule, not directly under the top-level package.","error":"AttributeError: module 'mcp_server_sqlite' has no attribute 'MCPSQLiteServer'"},{"fix":"Ensure no other applications are accessing the `.db` file. If a previous server instance crashed, try restarting your application or system to clear any lingering locks. Consider using an absolute path for `database_file` in `MCPSQLiteServer()` to avoid ambiguity and ensure consistent file access.","cause":"Another process or application is holding a lock on the SQLite database file, preventing the server from accessing it, or a previous server instance didn't shut down cleanly.","error":"sqlite3.OperationalError: database is locked"}]}