pyphi.mcp.install#

Registration of the PyPhi MCP server with a client, and of the PyPhi facts an assistant needs before it acts.

pyphi-mcp install writes two things: the server’s entry in the client’s Model Context Protocol configuration, and a short block of PyPhi facts in the project’s agent instruction file. A client may or may not show a server’s instructions to the assistant, and an assistant driving PyPhi from a shell never reads them, while a project’s instruction file is in context before the first tool call.

Nothing here imports the optional mcp dependency.

Module attributes

INSTRUCTIONS_FILE

The instruction file the block is written to.

CLAUDE_FILE

The file Claude Code reads, and the line that points it at the block.

BLOCK_BODY

The facts that go wrong unaided, and a pointer to the rest of the reference.

Functions

block()

The instruction block, delimiters included.

build_parser()

The pyphi-mcp command line.

config_path(directory, scope, client)

Where client keeps its Model Context Protocol server configuration.

ensure_claude_import(path)

Make sure Claude Code loads the instruction file.

install(directory, *[, scope, client, spec, ...])

Register the server and write the instruction block.

needs_claude_import(path)

Whether ensure_claude_import() would write to path.

registration([spec])

The client configuration entry that launches the server.

remove_block(path)

Remove the instruction block from path.

remove_claude_import(path)

Drop the @AGENTS.md import, and the file if that was all it held.

remove_registration(path)

Drop the pyphi server from the config at path.

run(args)

Carry out an install or uninstall and report what happened.

uninstall(directory, *[, scope, client])

Undo install(), leaving everything it did not write untouched.

write_block(path)

Write the instruction block to path, replacing an earlier one.

write_registration(path, entry[, force])

Add the pyphi server to the config at path, keeping any others.