Skip to main content
Glama
cookieark7

DevVault MCP

by cookieark7
README.md
# devvault-mcp

A small [MCP](https://modelcontextprotocol.io) server that gives Claude Code
structured access to DevVault's local Postgres database — inspect schema, run
read-only queries, make guarded writes, and seed dummy data for testing.

## Connection

`DATABASE_URL` is resolved in this order:

1. `process.env.DATABASE_URL`
2. `DEVVAULT_ENV_PATH` (path to an `.env` file), if set
3. `../devvault-backend/.env`

So the DB password stays in the backend `.env` and is **not** duplicated into
any MCP config.

## Tools

| Tool | Purpose |
| --- | --- |
| `db_info` | Which database/user we're connected to (no credentials shown). |
| `list_tables` | Public tables + approximate row counts. |
| `describe_table` | Columns (name, type, nullable, default) for a table. |
| `count_rows` | Exact row counts for the main DevVault tables. |
| `run_query` | One **read-only** statement (SELECT/WITH/EXPLAIN/SHOW), run in a `READ ONLY` transaction. Supports `$1,$2…` params. |
| `run_write` | One INSERT/UPDATE/DELETE. DDL and unscoped UPDATE/DELETE (no WHERE) are refused unless `allowDangerous=true`. |
| `seed_dummy` | Insert dummy rows (valid cuid ids + timestamps) into snippets/bookmarks/notes/commands/prompts, attached to existing users. |

### Safety guards

- `run_query` rejects anything that isn't read-only and blocks statement stacking (`;`).
- `run_write` refuses `DROP/TRUNCATE/ALTER/CREATE/GRANT/…` and refuses `UPDATE`/`DELETE`
  with no `WHERE` clause, unless you pass `allowDangerous: true`.
- Writes run inside a transaction and roll back on error.

## Registering with Claude Code

Already wired up via `../.mcp.json` (project scope):

```json
{
  "mcpServers": {
    "devvault-db": {
      "command": "node",
      "args": ["/Users/cookie/project-git/devvault_2/devvault-mcp/server.js"]
    }
  }
}
```

MCP servers load at Claude Code **startup**, so restart / reconnect the session
for the `devvault-db` tools to appear.

## Local checks (no MCP client needed)

```bash
npm install
node smoke.js     # connectivity + row counts
node mcptest.js   # full MCP handshake: list tools + call a few
```

## Dummy data

Seed rows created by `seed_dummy` all have titles beginning with `Dummy `.
To remove them:

```sql
DELETE FROM prompts  WHERE title LIKE 'Dummy %';
DELETE FROM commands WHERE title LIKE 'Dummy %';
DELETE FROM snippets WHERE title LIKE 'Dummy %';
DELETE FROM bookmarks WHERE title LIKE 'Dummy %';
DELETE FROM notes    WHERE title LIKE 'Dummy %';
```

TDQS

A4/5.0

Scored across 7 tools

Disambiguation4/5

Most tools have distinct purposes: querying, writing, seeding, and introspection. However, run_query and run_write are clear opposites, and count_rows overlaps slightly with db_info/list_tables in terms of database introspection, though they serve different specific needs.

Naming Consistency5/5

All tool names use a consistent verb_noun pattern: run_query, run_write, seed_dummy, db_info, list_tables, describe_table, count_rows. Each name clearly indicates the action and the target, making the set highly predictable.

Tool Count4/5

With 7 tools, the count is well within the ideal range for a database management server. Each tool covers a core operation (query, write, seed, introspect), and none feel redundant. A couple more tools for advanced operations (e.g., transactions, backups) could be added, but the current count is appropriate.

Completeness4/5

The server covers essential database operations: querying, writing, seeding dummy data, and introspection (list tables, describe schema, row counts). It lacks tools for schema modification or data deletion scoped by ID, but the primary workflows for development (read, write, seed, introspect) are well covered.

Maintenance

ActivityMaintained
ResponsivenessNo issues