# MCP is context, not authority

For one of the products I work on, registration worked on my machine and failed on the shared demo. The screen still moved on, as if it had finished. I pointed the agent at the database server I had named for that environment, and I told it to read. 🤔

### An empty log is a window

The first read found no new account, and an auth log with nothing in it. The agent said the app might be pointed at another project, or the attempt died before an account existed. Both fit an empty window.

I had it read again after a real attempt. The auth log was still empty. The API log was not. The request that checks the phone number, the one that runs before an account is created, came back unauthorized. Signup never started. That is why the auth log had nothing to say.

On my machine the credential that request uses was set. On the demo deploy it was not. I set it. The next registration went through.

### The finding is not a rewrite

The agent had the 401 and rewrote the action. New helpers, a new result shape, more branches than the failure had. I asked for the small version. The shape the file already used was enough.

Then I read the condition. "Greater than zero means this phone is taken" lets every other value through. A lookup that failed is not a zero. The typechecker said the count can be null, and the comparison did not narrow it. I had that fixed before I called the change done.

```ts
if (typeof count !== "number") return { error };
if (count > 0) return { error: taken };
```

Zero is the only count that means the phone is free. Anything else stops.

### Eyes I do use

Three servers, three jobs.

The database server answers schema, logs, and the list of security findings the platform will generate. I asked for that list on the same pass. It was not the bug. A finding with a name is a thing to read. It is not a migration.

The error tracker answers what already got reported. That client reports server failures. A rejected request on this path was logged and never sent. Starting from the issue list would have shown me a quiet product and a broken signup.

The code graph answers who calls a function, by name. The index sits a little behind the last save, and two functions can share a name. I open the caller before I edit it. A list of names is not a map I trust on its own.

### The keys stay off

The database tool can insert a row and apply a migration. I have not turned on a read-only flag. The control is smaller than that, and I should say so. This product's production database is not connected. The server I use for this question is named for the demo. The name is a label, not a lock. A labeled server will still write if I ask it to.

So I name the server in the prompt. I ask it to read. A write, when I want one, is a migration I review, on the environment I named, because I asked. The 401 was not that. It was a missing credential, and then one condition.

The previous post was a token that was right and late. This one is a log that was right, and easy to turn into a rewrite.

A few things I would keep in mind.

Name the server after the environment, and say that name. Two connections in one session is how a read lands on the wrong project.

An empty log is the window the tool returned. Ask which request should have been there. The failure was on the API log. The auth log was empty because the interesting call never ran.

A finding does not pick the change. The missing credential was configuration. The code change was the condition above. The rewrite around it was the agent filling the silence.

The graph, the advisor list, and the issue list do not get a migration. If I ever connect production, it is read-only, and I still do not let a session apply a change there.

That's it, fellows. Give the agent the log. Keep the decision, and the production database, with you.

Happy coding folks! 😎
