TL;DR: The SQLite MCP server cannot find your database because the `--db-path` you gave it is relative, and the server resolves it against its own working directory, not yours. Pass an absolute path to the database file in your client config and the error goes away.

```text
Error: unable to open database file
```

## Fix it

1. Replace the relative path with an absolute one in your MCP client config:

```json
{
  "mcpServers": {
    "sqlite": {
      "command": "uvx",
      "args": ["mcp-server-sqlite", "--db-path", "[HOME]/..."]
    }
  }
}
```

   On Windows use the full drive path, e.g. `C:[HOME]/...`.

2. Fully quit and restart the MCP client so the server respawns with the new argument.

   Expected: the server starts and tools like `read_query` list your tables. No open error in the logs.

3. If it still fails, check the parent directory exists. SQLite cannot create missing parent directories, only the file itself:

```bash
ls -la [HOME]/...
```

## When to use this

- The database file exists and opens fine in the sqlite3 CLI, but the MCP server says it cannot open it.
- You used a relative path, `~`, or an env-var-style path in `--db-path`.

## When NOT to use this

- The error is `no such table`. The file opened fine; you are pointing at the wrong (probably auto-created empty) database.
- The error is `database is locked`. That is a concurrency problem, not a path problem.

## Compatibility

- @modelcontextprotocol/server-sqlite (takes `--db-path`).
- Claude Desktop, Claude Code, Cursor, Windsurf.

## Why it happens

GUI MCP clients launch the server as a child process with an unpredictable working directory (often the app bundle or system root). A relative `--db-path` like `data/app.db` resolves against that directory, not your project. SQLite then fails to open it because the parent directory does not exist there. Absolute paths remove the ambiguity entirely.

## Edge cases

- `~` is not expanded by the server. Write out `[HOME]/...` (or `C:[HOME]/...`) in full.
- Paths with spaces work if quoted correctly in JSON. The JSON string quoting handles it; do not add shell quotes inside the arg.
- If the parent directory is missing, create it first. The server will create the `.db` file itself if it does not exist.