MCP automation
What it does
Phasor makes its model and study operations available as an MCP server. MCP is the Model Context Protocol. This is the same tool surface that the in-app assistant uses. Everything that the assistant can do, your own scripts and agents can also do — over a documented protocol, not through the user interface.
This makes repetitive engineering work practical:
- Batch studies. Run a power flow for forty demand scenarios. Collect the violation lists.
- Sweeps. Change a transformer tap or a cable size in steps. Record where the result crosses a limit.
- Report generation. Pull the results into your own document template.
- Regression checks. After a model change, run the cases from last month again. Compare the answers.
- Bulk edits. Apply a naming convention or a rating update to hundreds of elements.
How it connects
Phasor hosts a local HTTP endpoint — normally http://127.0.0.1:27183/mcp — using the
MCP Streamable HTTP transport. It binds to your own machine only; nothing listens on the
network. A client identifies itself with a bearer secret that Phasor generates for you.
Setup is three steps: turn the server on, copy the configuration, and add it to your client. The two clients people ask about most are the Claude Desktop app and OpenAI's Codex; both are covered below. Phasor must be running, with the server enabled, whenever a client connects.
Turn the server on
- In Phasor, select Settings → Automation & MCP.
- Turn on Local MCP server.
- Check the Connection status card. Bound should read Yes, Secret should read Provisioned, and Endpoint shows the address — normally port 27183. If another program holds that port, Phasor picks a different one, which is why the next step copies the configuration instead of typing it.
Enabling the server connects nothing by itself. A client connects later, by presenting the bearer secret.
Copy the configuration
In the Client configuration card, select Copy configuration. Your clipboard now holds a JSON snippet with the endpoint URL and the real bearer secret:
{
"mcpServers": {
"phasor": {
"url": "http://127.0.0.1:27183/mcp",
"headers": { "Authorization": "Bearer YOUR-SECRET" }
}
}
}
The two values you need for any client are in this snippet: the URL and the Authorization header value. The secret is a password to your projects. Paste it into a client configuration and nowhere else. If it ever lands somewhere it should not, select Rotate secret in the same panel — every connected client is cut off until you give it the new value.
Connect Claude Desktop
Claude Desktop starts its MCP servers as local processes. Its config file does not accept an
HTTP URL directly, and its cloud-side "custom connectors" cannot reach 127.0.0.1 on your
machine. The standard bridge is mcp-remote, a small npm package that Claude Desktop runs
as a process and that forwards to Phasor's HTTP endpoint. You need Node.js 18 or newer
installed.
- In Claude Desktop, open Settings (⌘‑comma on macOS, Ctrl‑comma on Windows), select the
Developer tab, then Edit Config. This opens
claude_desktop_config.json:- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
- Add the block below. Replace
Bearer YOUR-SECRETwith the Authorization value from the configuration you copied, and match the URL. If the file already has anmcpServersblock, add the"phasor"entry inside it.
{
"mcpServers": {
"phasor": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"http://127.0.0.1:27183/mcp",
"--transport", "http-only",
"--header", "Authorization:${PHASOR_AUTH}"
],
"env": {
"PHASOR_AUTH": "Bearer YOUR-SECRET"
}
}
}
}
- Save the file, then quit Claude Desktop completely and start it again. On macOS that is ⌘‑Q; closing the window is not enough.
- Verify: open a new chat and select the sliders icon under the message box ("Search and tools"). Phasor should be listed with its tools. In Phasor, Active sessions in the Connection status card counts up when the client connects.
If Phasor does not appear in Claude Desktop
Keep the header argument exactly as written — Authorization:${PHASOR_AUTH} with no
space, and the full Bearer YOUR-SECRET value in the env block. A space inside that
argument breaks on Windows. If the server logs show that npx was not found, replace
"npx" with its full path — run which npx in a terminal to get it. The logs are at
~/Library/Logs/Claude/mcp.log on macOS and %APPDATA%\Claude\logs on Windows.
Connect Codex
Codex talks to HTTP MCP servers directly — no bridge process. The Codex CLI, the IDE
extension and the ChatGPT desktop app's Codex all read the same file: ~/.codex/config.toml
(%USERPROFILE%\.codex\config.toml on Windows).
- Open
~/.codex/config.tomlin an editor. Create the file if it does not exist. - Add the block below. Replace the secret and match the URL from the configuration you copied:
[mcp_servers.phasor]
url = "http://127.0.0.1:27183/mcp"
[mcp_servers.phasor.http_headers]
Authorization = "Bearer YOUR-SECRET"
- Restart the Codex app, or start a new CLI session.
- Verify: run
/mcpinside a Codex session, orcodex mcp listin a terminal. Phasor should be listed with its tools.
Two Codex syntax traps
Current Codex versions reject a plain bearer_token field for HTTP servers — use the
http_headers table as shown, with the full Bearer prefix in the value. There is also a
bearer_token_env_var option, but the desktop app and IDE extension do not see variables
you export in a shell, so the header form is the reliable one. If a long study run gets cut
off, add tool_timeout_sec = 300 under [mcp_servers.phasor] — the default is 60 seconds.
Other clients
Any MCP client that speaks Streamable HTTP works with the copied JSON as-is — it is the shape most of them accept. For Claude Code, one command does it:
claude mcp add --transport http phasor http://127.0.0.1:27183/mcp \
--header "Authorization: Bearer YOUR-SECRET"
A script with an MCP client library uses the URL and the Authorization header directly.
Try it
Open a project in Phasor, then ask the connected client:
- "Which project is open in Phasor, and what is in it?" — a pure read.
- "Run the power flow for the peak scenario and list the violations." — a study run.
- "Raise the tap on transformer T1 by one step, run the power flow again, and compare the two runs." — a model edit, a run, and a comparison.
Each answer comes from real tool calls on your real model. The edit in the third prompt appears in the project history, and you can undo it.
Approvals and access
Out of the box the connection is ready to work: every capability grant starts allowed, and Autonomous mode is on, so an agent works without confirmation prompts. Every action is still recorded in the Recent MCP actions log, and model changes stay undoable from the history. If you prefer tighter control, the same panel offers three levers:
- Autonomous mode off. Significant actions — destructive model edits, file writes, opening or creating projects — then ask for your approval first.
- Capability grants. Each capability (read model, plan changes, commit changes, run studies, read files, write files, commit imports, write equipment library) can be set to Always ask, Allow for session, or Deny.
- Rotate or revoke the secret. Rotating disconnects every session until clients get the new value. Revoking disables the server until a new secret is generated.
The tool surface
The tools are in groups, by what they touch:
| Group | What it does |
|---|---|
| Project | Open a project, save it, and report what is loaded. |
| Model read | List and examine elements, connectivity, ratings and settings. |
| Model write | Create, change and delete elements — through the command gate. |
| Scenarios | Create and select loading scenarios. |
| Studies | Configure, run and cancel a power flow, a short circuit study and the other cases. |
| Results | Read results, violations and study metadata, by run. |
| Topology | Islands, cycles and path traces, as in Graph Space. |
The client discovers all of this itself: the tool list describes itself, including the argument schemas, so there is no separate API document to keep open. Each write goes through the same command gate as a human edit. Because of this:
- You can undo a scripted change.
- Each scripted change appears in the project history.
- A script cannot go around the validation of the model.
Notes
The server is local, and the secret is the key. The server binds to 127.0.0.1 only. There is no remote endpoint, and no way to reach it from another machine. On your own machine, the bearer secret is what stands between a process and your model — treat it like a password. The panel reminds you when the secret is more than 90 days old.
Writes are real. A script that deletes elements deletes them. While you develop an automation, work on a copy of the project. Use the undo history as your protection. Do not depend on the script being careful.
Each result belongs to a run. Phasor keeps each study run with its timestamp. A report can name the exact run that it came from. A regression check can compare two named runs — not "before" and "after".
The same tools, two callers
The assistant and your scripts share one tool surface. If you can get a result from the assistant interactively, you can automate the same steps. The automated version behaves identically.