<!-- Source: @site/projects/sqlens-for-laravel/docs/security/mcp-transport-assumptions.md -->
<!-- Canonical: https://docs.pushery.com/sqlens-for-laravel/security/mcp-transport-assumptions/ -->

# MCP transport: the trust boundary, stated

> What you are assuming when you start the SQLens MCP server, and which test holds each assumption.

Starting a server is a decision about trust, and a tool that is itself about database safety
owes you that decision in writing rather than in its release notes. This page is the boundary:
what SQLens assumes, what it therefore does **not** protect you from, and — for every claim on
this page — the test that keeps it true.

## The server is your agent's child process

`sqlens:mcp` is started by your agent, as a child process, under your user, inheriting your
environment. That includes your database credentials, because that is what an environment is.

There is no authentication layer, and the reason is not that one was skipped. **There is no
second channel to authenticate.** The only way to reach this server is to be the process that
started it — and anything able to start it already runs as you, with your environment, and could
open those same connections directly without SQLens' help.

An authentication step here would guard a door that is already inside the house. Worse, it would
suggest a protection that is not there.

## Therefore: your agent's MCP configuration is the access control

That sentence is the whole practical consequence, and it is worth reading twice. **SQLens adds
nothing to it and takes nothing away.** If your agent can start this server, your agent can ask
it everything the four default tools answer — about the database your application is configured
against.

What SQLens does control is what those tools are *able* to do:

- they read; none of the default four writes anything, anywhere;
- the two that touch a database are off, and each is enabled on its own, by name;
- no tool accepts free-text SQL, a connection string, a host, a user or a password — every
  parameter is a bounded value or a name your application already configured.

Those are properties of the tools, not of the channel. They hold whoever is at the other end.

## What is not there, deliberately

- **No listener and no port.** Nothing binds, so nothing is reachable from anywhere else on your
  machine or your network.
- **No authentication layer.** See above: there is no second channel to authenticate.
- **No tenancy model.** One server answers about one application's configured connections.
- **No telemetry**, and no switch to turn telemetry off — an opt-out is a confession that
  something is being sent.

## The channel split you can rely on

`stdout` belongs to the protocol and carries nothing else. Every diagnostic — a startup banner, a
warning, the reason a run stopped — goes to `stderr`.

This matters more than it sounds: an MCP client parses `stdout` as a frame stream, and one stray
line from anywhere in the host application corrupts the session. SQLens engages a shield around
the run for exactly that reason, so a noisy service provider in *your* application cannot break
*your* agent's connection.

## HTTP is out of scope for this version

Decided when the transport was chosen, and recorded rather than re-argued here: this version
speaks stdio and nothing else.

An HTTP server is a shared endpoint. It needs authentication, authorization, transport security
and an answer to "who may ask what" — an entire surface, and one that is worse half-built than
absent. stdio needs none of it, because it inherits the trust boundary of the process that
started it.

If HTTP ever arrives it is a separate decision with a threat model of its own, and the
`transport` setting exists so that day is a value in a configuration file rather than a new shape.

## Every assumption above, and the test that holds it

A written assumption decays at the first refactoring unless something fails when it stops being
true. Each of these is checked on every run:

| Assumption | How the suite checks it |
| --- | --- |
| Nothing binds a socket or a port; the transport is stdio only | unit tests drive the stdio loop that is the whole transport: frames in order, a frame in two pieces, a read that returns nothing, and the end of the stream |
| The configuration accepts no transport but `stdio` | the configuration check refuses every transport value but `stdio` |
| `stdout` carries frames and nothing else, in a real process | the real command runs as a subprocess and holds a conversation over a real pipe, while a provider that prints, a forgotten dump and a log channel on standard output stay out of the frames |
| A noisy host application cannot reach `stdout` | foreign output and PHP notices are taken off the channel and reported on the diagnostic one, and a protocol frame passes untouched |
| No credential value leaves the server, over a whole session | marked credential values are searched for in the whole transcript of a session: handshake, tool list, every tool and every provoked failure |
| No tool call reaches the network, and none triggers a refresh | every declared tool is called behind an HTTP handler that fails on the first request, and none may trigger an advisory refresh |
| No tool accepts free-text SQL or a connection string | every parameter of every registered tool has to match a shape on an allowlist, and anything else fails by default |
| The agent layer holds no engine logic and no rights of its own | an architecture test lets the agent layer reach the engine only through the contracts the commands use |
| Enabling one database-touching tool takes no other along | each mutating tool is enabled alone and takes no other along, and no environment profile or variable brings one |
| A hostile parameter value never reaches a database | hostile values are sent against a real PostgreSQL 18 and refused before a connection opens, while a well-formed value still goes through |
| The server survives a client's socket read timeout | the server runs behind a socketpair, the way node-based clients start it, and still answers after a silence longer than the read timeout |

A documentation test ties each row to the test that holds it, and fails when a row loses its test
or the test is gone. That coupling is the point: a boundary nobody can verify is a boundary nobody
should believe.
