# phpgraph MCP server

> Provides a deterministic knowledge graph of PHP codebases via static analysis to help AI agents understand calls, routes, and architecture.

- Repository: https://github.com/hbenabdallah/phpgraph
- Page: https://hostedmcp.org/servers/hbenabdallah/phpgraph
- Transport: stdio
- Stars: 3
- License: MIT
- Latest version: 2.1.0

## Install

### Claude Code

```sh
claude mcp add phpgraph -- docker run -i --rm ghcr.io/hbenabdallah/phpgraph:2.1.0
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "phpgraph": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/hbenabdallah/phpgraph:2.1.0"
      ]
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "phpgraph": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/hbenabdallah/phpgraph:2.1.0"
      ]
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"phpgraph","type":"stdio","command":"docker","args":["run","-i","--rm","ghcr.io/hbenabdallah/phpgraph:2.1.0"]}'
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "phpgraph": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/hbenabdallah/phpgraph:2.1.0"
      ]
    }
  }
}
```

### Codex

```sh
codex mcp add phpgraph -- docker run -i --rm ghcr.io/hbenabdallah/phpgraph:2.1.0
```

### Codex config.toml (`~/.codex/config.toml`)

```toml
[mcp_servers.phpgraph]
command = "docker"
args = ["run", "-i", "--rm", "ghcr.io/hbenabdallah/phpgraph:2.1.0"]
```

### Gemini CLI

```sh
gemini mcp add -s user phpgraph docker -- run -i --rm ghcr.io/hbenabdallah/phpgraph:2.1.0
```

### Gemini settings.json (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "phpgraph": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/hbenabdallah/phpgraph:2.1.0"
      ]
    }
  }
}
```

## Tools (8)

- `overview`
- `query_graph`
- `outline`
- `get_node`
- `get_neighbors`
- `impact_of`
- `shortest_path`
- `god_nodes`

## FAQ

### Does phpgraph use an LLM or embeddings?

No, it uses deterministic facts from static analysis without an LLM, network, or embeddings.

### Is my code private when using phpgraph?

Yes, your code never leaves your machine and the tool only parses the code without executing it.

### How fast is the graph rebuilt when code changes?

It is rebuilt incrementally, taking approximately 3 seconds per edit on a project with 8,400 files.
