Skip to main content
Glama
db-oauth-mcp
by kpconnell

db-oauth-mcp

Node.js MCP server (TypeScript, distributed as a .mcpb Desktop Extension) that lets Claude Desktop run read-only SQL against one or more databases, gated by OAuth 2.0 PKCE. Credentials are per-user, short-lived, and never touch disk.

Supported engines: MariaDB / MySQL and Microsoft SQL Server. A single OAuth session can expose any number of connections across either engine — the backend decides what to hand out.

This is the Node port of db-oauth-mcp (previously Go). Same OAuth contract, same tool surface, same behavior — but distributed as one platform-neutral zip with no code signing, no cross-compilation, and no native binary.

Status

Under construction. The Go implementation at v0.2.x remains the current recommendation until this repo tags v0.3.0.

Related MCP server: MCP OAuth Server

Development

Requires Node 18+ and pnpm 10+.

pnpm install
pnpm run typecheck
pnpm run test
pnpm run build
OAUTH_AUTHORIZE_URL=https://auth.example.com/mcp/authorize \
OAUTH_API_BASE_URL=https://api.example.com \
LOG_LEVEL=debug \
node dist/server.js

See the Go repo README for the OAuth contract, tool documentation, and engine-specific safety rules, all of which are inherited verbatim here.

License

MIT. See LICENSE.

Available Tools

5 tools
connection_statusA

Show whether you're connected and, for each available database connection, which user and engine it uses and when it expires.

disconnectA

Disconnect from all database connections. Revokes the current access token and clears cached credentials. The next tool call will require re-authentication.

list_connectionsA

List the database connections available in the current session. Returns the name (pass to query_database / list_schema via the connection argument), engine type (mariadb or mssql), and the databases each connection grants access to. Calling this will trigger authentication if not yet connected.

list_schemaA

List tables or describe a specific table's columns for a given connection. Pass connection with the name of the target (omit if only one connection exists). Call with no table argument to see all tables, or with table set to 'schema.table' (MariaDB uses database.table; MSSQL uses schema.table within the connection's initial catalog) to describe its columns.

Inputs: connection, table.

query_databaseA

Execute a read-only SQL query against one of the configured database connections. Pass connection with the name of the target (omit if only one connection exists — use list_connections to see the names and which engine each uses). Only read statements are allowed (SELECT/SHOW/DESCRIBE/EXPLAIN/WITH on MariaDB; SELECT/WITH and a small allowlist of sp_help / sp_columns / sp_tables procs on MSSQL). Results are capped at a configurable row limit (default 1000). Use list_schema first if you don't know the table structure.

Inputs: sql (required), connection.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.3/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool has a distinct purpose: showing connection status, disconnecting, listing connections, exploring schema, and querying data. No overlap in functionality.

    Naming Consistency5/5

    All tool names follow a consistent snake_case verb_noun pattern (e.g., list_connections, query_database), including the standalone verb 'disconnect' which is standard for such actions.

    Tool Count5/5

    With 5 tools, the server covers essential operations for a read-only database interface without being overly numerous or sparse. The count fits the scope perfectly.

    Completeness5/5

    The tools provide full lifecycle coverage for a read-only database MCP: status, listing connections, schema exploration, querying, and disconnection. No obvious missing features.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers