---
title: "Cline MCP setup for a Postgres backend | Backenly"
description: The cline_mcp_settings.json block that connects Cline to a Backenly Postgres backend over MCP, and the one field it needs that Cursor does not.
url: https://backenly.com/agents/cline
markdown_url: https://backenly.com/agents/cline.md
updated: 2026-11-30
---

# Connect Cline to Backenly

Cline reaches Backenly through one block in cline_mcp_settings.json. It then builds and runs a Backenly project: tables, auth, storage and functions, with anything destructive held for you.

## One block in cline_mcp_settings.json.

### Remote

Nothing to install. The entry must set `"type": "streamableHttp"`: without it Cline falls back to SSE, and the endpoint answers 405.

`cline_mcp_settings.json`:

```json
{
  "mcpServers": {
    "backenly": {
      "type": "streamableHttp",
      "url": "https://backenly.com/api/mcp",
      "headers": { "x-api-key": "<scoped-key>" }
    }
  }
}
```

### Local, over stdio

Runs the `@backenly/mcp-server` package through npx, on Node.js 20 or later, in the same block Cursor takes. On a self-hosted Backenly, the args end with `--endpoint` and your instance’s address.

`cline_mcp_settings.json`:

```json
{
  "mcpServers": {
    "backenly": {
      "command": "npx",
      "args": [
        "-y", "@backenly/mcp-server",
        "--project", "<id>",
        "--key", "<scoped-key>"
      ]
    }
  }
}
```

MCP hosts read their server configuration when a session starts, so save the file before you start the conversation. To keep the key out of the file, run `npx @backenly/mcp-server init` once: it saves the key to `~/.backenly/mcp.json`, readable only by you, and the local block then needs no `--project` or `--key`.

## Teach the agent Backenly. Even before the tools load.

### Instructions on connect

The server sends them when the connection opens: read the backend’s state before changing anything, say which project it is connected to, and never put the `mcp_live_` key in app code.

### The docs in one call

`fetch_docs` returns Backenly’s agent guide in full, at most 40,000 characters, or one topic of it, such as `fetch_docs { topic: "database" }`.

### The agent guide

backenly.com/skill.md is the guide Backenly writes for agents: which tool does what, the order that works, the error codes to branch on, and which key an app needs. Point the agent at it, or keep a copy in the repository.

### Before the tools load

Cline reads its MCP servers when a session starts. Until the Backenly tools appear, the agent can run every one of them from the terminal, with the same key and the same approval rules.

```bash
npx -y @backenly/cli@latest link --project <id> --key <scoped-key>
npx -y @backenly/cli@latest call read_backend_state
npx -y @backenly/cli@latest chat "add a likes counter to posts"
```

`link` keeps the key in `.backenly/config.json` and, if the repository has a `.gitignore`, adds `.backenly/` to it.

## Questions about Cline

### Why does Cline need "type": "streamableHttp" when Cursor does not?

Cursor infers the transport from the url. Cline does not: without the type field it connects over SSE, and Backenly’s endpoint answers 405. The local block over stdio needs no type field in either host.

### Can I give Cline read-only access?

Yes. Choose read-only when you create the key on the Connect page. A read-only key sees 16 tools instead of 23, and a write called anyway is refused with READ_ONLY_KEY before it runs. The agent cannot upgrade its own key.

### Does it work with my existing PostgreSQL database?

No. The MCP server operates a Backenly project, hosted on Backenly Cloud or on your own Backenly install, with a PostgreSQL schema that Backenly manages. You can still reach that database directly with a connection string from the Connect page, and export it with pg_dump.

### What can the agent not do without me?

Anything destructive or irreversible. apply_migration refuses DROP statements. Dropping or emptying a table, deleting files or functions, deploying, rolling back and revoking keys are parked on the project’s Autonomy page until a person approves them. The agent can request and poll with check_approval; it cannot approve.

### Can I undo something the agent changed?

Yes, from the project’s History: restore that one change, or everything back to a point. History covers the schema, auth, storage, functions, webhooks, environment variables, keys, integrations, allowed origins and allowed database addresses, and each restore is checked before it runs. Data your app wrote since is never rewound, and a restore that would affect it waits for your approval. The agent can ask for a restore, but only you can approve one.

### Does it work with a self-hosted Backenly?

Yes. Use your instance’s /api/mcp as the url, or end the local block’s args with --endpoint and your instance’s address. Keys and projects come from your own dashboard.

## Read next

- [Connect, step by step](https://backenly.com/docs/connect): Creating a key, every client’s setup, and how your app connects.
- [The 23 tools](https://backenly.com/mcp): What each tool is for, and which actions wait for a person.
- [Safe database changes with AI agents](https://backenly.com/guides/safe-ai-database-changes): How a schema change is checked, applied and recovered.
- [Backenly in Claude Code](https://backenly.com/agents/claude-code): Three ways to connect, and what to do before the tools load.
- [Backenly in Cursor](https://backenly.com/agents/cursor): The mcp.json block, and why it belongs in your user config.
- [Backenly in Codex](https://backenly.com/agents/codex): One codex mcp add command, or a table in config.toml.
- [Backenly in Antigravity](https://backenly.com/agents/antigravity): The mcp_config.json block, and why it names serverUrl.

## Give Cline a backend

One free project, no credit card. Paste one block and start a new task.

---

Source: [Cline MCP setup for a Postgres backend | Backenly](https://backenly.com/agents/cline). Every page in Markdown: https://backenly.com/index.md. Agent docs: https://backenly.com/llms.txt.
