TL;DR: `~` in `--db-path` does not mean your home directory to the SQLite MCP server. Tilde expansion is a shell feature and the server is launched without a shell, so it looks for a literal directory named `~` and fails. Write out the full path.

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

(With `--db-path` set to something like `~/data/app.db`.)

## Fix it

1. In your MCP client config, replace the tilde with the real home directory:

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

   Find your home directory with `echo $HOME` in a terminal.

2. Restart the MCP client.

   Expected: the server opens the database and tools work.

## When to use this

- `--db-path` contains `~` and the server cannot open the file.
- The same path works when pasted into a terminal (because your shell expands the tilde there).

## When NOT to use this

- The path has no tilde and still fails. Then it is a permissions or missing-directory problem.
- The error is `no such table`. The file opened; it is just the wrong or an empty one.

## Compatibility

- @modelcontextprotocol/server-sqlite.
- All MCP clients, since none of them run a shell to expand the argument.

## Why it happens

When you type `~/data/app.db` in a terminal, your shell rewrites it to `[HOME]/...` before the program ever sees it. MCP clients spawn servers directly via process APIs, with no shell in between, so the server receives the literal two-character string `~/...` and treats it as a relative path. There is no `~` directory, so the open fails.

## Edge cases

- Environment variables like `$HOME` in args are not expanded either, for the same reason. Some clients support `${HOME}` in the `env` block, but not in `args`.
- On Windows, `%USERPROFILE%` is not expanded in args either. Use the full `C:[HOME]/...` path.
- If you generate configs with a script, expand the path in the script before writing the JSON.