# Can an AI coding agent manage my database?

> Yes. The SupaHost MCP server lets Claude Code, Cursor, Codex and other agents inspect tables, run SQL, apply migrations and deploy Edge Functions, with read-only mode and scoped tokens.

Source: https://supahost.app/kb/ai-agent-database · Updated 2026-11-11

Yes. SupaHost runs an MCP server at `https://mcp.supahost.space/mcp` that AI coding tools such as Claude Code, Cursor, Codex, VS Code and Windsurf can connect to. Through it an agent can list tables, run SQL, apply migrations, generate TypeScript types, check security advisors, and deploy and debug Edge Functions. You control the blast radius with a token scoped to one project and an optional read-only mode.

## Connect in two steps

1. Dashboard → **AI agents (MCP)**: pick your client, choose the scope (*This project only* or *Whole instance*), tick **Read-only** if you want it, and click **Create token**. The token (`shp_…`) is shown once.
2. Add the server to your tool. For Claude Code:

   ```bash
   claude mcp add --transport http supahost \
     "https://mcp.supahost.space/mcp?project=app-one" \
     --header "Authorization: Bearer shp_your_token_here"
   ```

The dashboard has ready-made snippets for 19 clients and rules text to paste into `CLAUDE.md`, `AGENTS.md` or a Cursor rule.

## What the agent can do

| Area | Tools |
|---|---|
| Inspect | `list_tables`, `list_extensions`, `list_migrations`, `get_advisors`, `get_project_url` |
| Change | `execute_sql`, `apply_migration` |
| Code | `generate_typescript_types`, `search_docs` |
| Functions | `list_edge_functions`, `get_edge_function`, `deploy_edge_function`, `get_edge_function_logs`, `delete_edge_function` |

A typical request: *"Add a `due_on date` column to `tasks`, with an index, as a migration, then regenerate types."* The agent calls `apply_migration`, which runs the change in one transaction and records it in `supabase_migrations.schema_migrations`.

## Staying safe

- **Read-only for production.** Add `read_only=true` to the URL, or create a read-only token. SQL then runs as a role that can read everything but write nothing, and write tools aren't offered at all.
- **Scope tokens to one project.** A project token can't touch other projects on the instance. URL parameters can only narrow a token, never widen it.
- **Review migrations before they run.** Ask the agent to show the SQL first.
- **Audit.** Every write through MCP appears in **Activity** as `MCP (<token name>)`. Revoke a token from **Access tokens** at any time.
- **Treat query results as data.** The server marks SQL results as untrusted so the agent doesn't follow instructions that happen to be stored in your rows.

## FAQ

### Can the agent see my service_role key?

No. `get_publishable_keys` only returns the anon key, and no MCP tool returns `service_role`.

### Does it work with Claude.ai or ChatGPT connectors?

Not yet. The server uses bearer tokens, and OAuth sign-in for those connectors is listed as coming soon in the dashboard.

### Can the agent create new projects?

With an instance-scoped token, yes, through `create_project`. It has to confirm explicitly if the new project goes beyond your plan's included projects.

## Related

- [The SupaHost MCP server](/docs/ai-tools/mcp)
- [MCP tools reference](/docs/ai-tools/mcp-tools)
- [Connect Claude Code](/docs/ai-tools/claude-code)
- [Rules and prompts for AI agents](/docs/ai-tools/agent-rules)
