MCP Setup Guide
Expose your Baseil instance as an MCP server. Connect from Claude Desktop, Claude API, or any MCP-compatible client.
The Model Context Protocol is how AI agents discover and use tools. Baseil speaks MCP natively. Every database you connect becomes a set of MCP tools that any MCP-compatible client can call. This guide covers generating a key, wiring it into Claude Desktop and the Claude API, and verifying the connection works.
What you get out of the box
When Baseil is running with one or more connections, these tools are live on the MCP endpoint:
- ‣
baseil__query: Ask a natural-language question. Baseil picks the right tool, runs the query, returns structured results. - ‣
baseil__describe: Enumerate schemas, tables, columns. Good for agents that want to look around before asking. - ‣
baseil__execute: Run a specific named tool with explicit arguments. Useful when the agent already knows what it wants. - ‣
baseil__setup: Add, list, or test database connections from an agent. The web UI is the usual path; this is the programmatic one. - ‣
baseil__status: Check background tasks (ongoing onboarding, index rebuilds, etc.). - ‣
baseil__rules: Create, list, update rules. - ‣
baseil__ack: Acknowledge tool results, used for multi-step reasoning. - ‣
baseil__help: List every available tool with descriptions. Agents use this to discover capabilities.
Every tool has a machine-readable description and typed parameters. Agents that speak MCP don't need any out-of-band knowledge to use them.
Generate an API key
Sign in to Baseil, go to Settings → API Keys, and click Create key. Give it a name so you remember what it's for. The key is shown once. Copy it somewhere safe.
Create a separate key per agent or integration so you can revoke them independently.
Connect from Claude Desktop
Claude Desktop reads MCP servers from a config file. Open Claude Desktop's settings, find the MCP section, and add Baseil:
{
"mcpServers": {
"baseil": {
"url": "http://localhost:8451/api/v1/mcp/sse",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}
Replace YOUR_API_KEY with the key you just generated. If you're running Baseil on a server, swap localhost:8451 for the public URL.
Save the config and restart Claude Desktop. In a new conversation, Claude should surface the Baseil tools automatically. You can verify by asking "what tools do you have?" and Claude will list them.
More detail in the Claude Desktop MCP docs.
Connect from the Claude API
For programmatic use, the Anthropic SDK supports MCP servers as a first-class concept. Point it at Baseil's MCP endpoint and pass the auth header. Each SDK has its own configuration shape, so check Anthropic's MCP guide for the exact form.
Baseil's endpoint uses Server-Sent Events for streaming. The URL pattern is:
http://<your-baseil-host>:8451/api/v1/mcp/sse
and auth is a bearer token in the Authorization header.
Verify the connection
Once wired up, verify end-to-end:
- Start a new conversation with your agent.
- Ask: "what databases can I query?"
- Expected behavior: the agent calls
baseil__describe, gets back the list of your connections and their schemas, and responds with a human-readable summary.
If that works, try a real question: "how many users signed up last week in the production database?" The agent should call baseil__query, and Baseil picks the right tool, runs the query, and returns results.
Example agent workflow
A concrete scenario, a customer support agent handling a ticket:
User: "Customer [email protected] is asking about their recent orders."
The agent's reasoning goes something like:
- Parse the user's intent: "look up recent orders for customer [email protected]".
- Call
baseil__querywith"orders for customer [email protected] in the last 30 days". - Baseil routes to the appropriate tool, runs the query, returns a structured list of orders.
- The agent summarizes for the human, maybe fetches more detail with a follow-up
baseil__querycall.
The important part: the agent never needed schema details in advance. Baseil's MCP tools expose everything the agent needs at runtime.
Cross-database queries
If you've connected more than one database, Baseil can answer questions that span them. An agent doesn't have to know which database has what. It just asks, and Baseil figures out the join.
Example: "Show me total revenue from customers who contacted support last week." Customer data might be in Postgres, support tickets in Elasticsearch. Baseil's query planner joins across them transparently.
The agent uses the same baseil__query tool. All the cross-database complexity is absorbed on Baseil's side.
Security considerations
A few things worth knowing:
- ‣One key per agent. Revoke any key from Settings → API Keys. A revoked key stops working immediately.
- ‣All queries are read-only. Baseil parses and validates every generated statement as read-only before it runs. There is no write capability, and a read-only database user is the second layer you control.
- ‣SQL injection protection is at the connector level. Every generated tool uses parameterized queries. User input never gets concatenated into SQL.
- ‣Full audit log. Every tool call, the parameters used, the query that ran, and the result metadata. Visible in the Activities panel and exportable.
If you're running Baseil in production, put it behind your normal auth and network boundaries. The MCP endpoint is plain HTTP on localhost. If you expose it beyond your machine, terminate TLS at your own proxy, where the usual WAF and rate-limiting tools apply.