How MCP works (in 30 seconds)
An MCP server exposes three things to an MCP client:- Tools — functions the AI can call. (For QueryBear:
list_connections,get_schema,run_query.) - Resources — pieces of data the AI can read. (For QueryBear: your database schemas.)
- Prompts — pre-defined prompt templates the user can invoke.
Why MCP matters for databases
Until MCP, hooking up an AI to a database meant one of three bad options:- Hand-roll an integration per client. Write a Claude tool. Write a separate ChatGPT plugin. Rewrite both when the API changes.
- Give the AI a shell. Let it run
psqldirectly. Pray. - Build a chat UI yourself. Tightly couple your AI to a custom frontend you have to maintain.
MCP transports
MCP runs over two transports:- stdio — the client spawns the server as a subprocess and pipes JSON-RPC over stdin/stdout. Best for local-only tools (file system, git).
- HTTP / SSE — the server runs as a remote service the client connects to. Best for tools that need credentials, persistence, or shared state across users.
https://mcp.querybear.com/mcp). This means:
- No local install of a database driver or QueryBear CLI required.
- Connection credentials are stored once in the QueryBear dashboard, not in every client’s config file.
- The same connection works across your laptop, your team’s laptops, and any other device you add the MCP server to.
What’s the alternative to QueryBear?
You can run an MCP server yourself. Anthropic previously published reference MCP servers for Postgres, but they archived them — pointing users at managed options for a reason: the hard part isn’t the protocol, it’s the security model. If you do roll your own, you’ll need to handle:- A SQL parser that distinguishes
SELECTfromWITH ... INSERT(CTEs can hide writes). - Column-level redaction.
- Per-table allow-listing that survives schema changes.
- Query timeouts that interrupt long-running planner work, not just network reads.
- An audit log that survives the agent crashing mid-query.
- OAuth so each client’s calls are attributable.
Learn more
Quickstart
Hook up your first database in 5 minutes.
Security model
How QueryBear protects your DB from misbehaving agents.