Skip to main content

MCP server for parsing and analyzing Primavera P6 XER files using PyP6Xer

Project description

PyP6Xer MCP Server

Primavera P6 schedule analysis for AI assistants. Load an XER file, ask questions about critical path, float, schedule quality, earned value — get answers in seconds.

Works with Claude Desktop, ChatGPT, Claude.ai, or self-hosted with the included web UI.

Live server: https://pyp6xer-mcp.fly.dev/mcp (open, no key needed) PyPI: pip install pyp6xer-mcp Loading your own files | Authentication | Development


Try it now

The server has five sample projects pre-loaded. Connect and start asking questions — no upload needed.

Cache Key Sector Activities
cairo-alex-road Roads 57
hilal-oil-gas Oil & Gas 31
terminal-building-airport Infrastructure 66
pharma-pack Industrial 289
expressway-project Roads/Bridges 823

Example prompts:

  • "List projects in cache key expressway-project"
  • "Run a schedule health check on pharma-pack"
  • "Show the critical path for cairo-alex-road"
  • "Analyze float distribution for terminal-building-airport"

Setup

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "pyp6xer": {
      "command": "uvx",
      "args": ["pyp6xer-mcp"]
    }
  }
}

Runs locally via stdio. Load your own XER files by path: "Load /path/to/project.xer and analyze the critical path"

ChatGPT or Claude.ai

Add the remote server in your MCP settings:

https://pyp6xer-mcp.fly.dev/mcp

No API key needed. The sample projects above are ready to query. To analyze your own file, say "I need to upload a P6 schedule" — the AI will generate an upload link you can open in your browser.

Self-hosted (full stack with web UI)

git clone https://gitlab.com/articat1066/pyp6xer-mcp.git
cd pyp6xer-mcp
echo "OPENAI_API_KEY=sk-xxx" > .env
docker compose up

Open http://localhost:3000 — upload an XER file and start asking questions. The MCP server runs at http://localhost:5000 with sample projects auto-loaded.

Uses gpt-4o-mini by default. To change model or to use Claude, set ANTHROPIC_API_KEY and AI_MODEL=claude-sonnet-xxx in your .env.

MCP server only (no UI)

docker compose up pyp6xer-mcp

MCP endpoint at http://localhost:5000/mcp.


Loading your own XER files

Local file (Claude Desktop — file stays on your machine):

"Load /Users/me/Desktop/project.xer and show the critical path"

URL (any client):

"Load the XER file at https://example.com/project.xer"

Upload link (ChatGPT, Claude.ai — when you can't give a file path):

Ask the AI "I need to upload a schedule file." It calls the pyp6xer_get_upload_url tool, which returns a one-time upload link (valid 15 minutes). Open the link in your browser, upload your XER file, then come back to the chat. The file goes from your browser to the MCP server endpoint, not through the AI. It's held in memory for the session and lost on restart.

Direct HTTP upload (scripts, CI/CD):

curl -X POST -F "file=@project.xer" https://pyp6xer-mcp.fly.dev/upload
# Returns: {"cache_key": "upload_abc123", "activity_count": 250, ...}
# Use the cache_key with any analysis tool.

What it does

23 tools, 5 prompts, 3 resources. All tools are prefixed pyp6xer_.

Category Tools
File Operations (5) load_file, write_file, clear_cache, export_csv, get_upload_url
Project/Activity (5) list_projects, list_activities, get_activity, search_activities, update_activity
Schedule Analysis (6) critical_path, float_analysis, schedule_quality, relationship_analysis, slipping_activities, schedule_health_check
Resource Management (2) list_resources, resource_utilization
Progress/Performance (4) progress_summary, earned_value, work_package_summary, wbs_analysis
Structure (1) list_calendars

See TOOLS.md for full parameter documentation.


Authentication

The hosted server at pyp6xer-mcp.fly.dev is open — no API key needed.

For self-hosted deployments, set API_KEY to enable authentication:

API_KEY=your_secret_key docker compose up

Clients then pass the key via query param, Bearer header, or x-api-key header:

{
  "mcpServers": {
    "pyp6xer": {
      "url": "https://your-server.com/mcp?api_key=YOUR_KEY"
    }
  }
}

Development

git clone https://gitlab.com/articat1066/pyp6xer-mcp.git
cd pyp6xer_mcp
uv pip install -e ".[dev]"

pytest                                      # 27 tests
python -m pyp6xer_mcp.cli                   # Run stdio (Claude Desktop)
python -m pyp6xer_mcp.cli streamable-http   # Run HTTP server on port 5000

black --line-length 100 .                   # Format
ruff check .                                # Lint

Architecture

pyp6xer_mcp/          # Python MCP server
├── server.py          # FastMCP instance
├── cli.py             # Entry point + sample auto-load
├── core/parser.py     # Shared XER parsing
├── tools/             # 23 MCP tools
├── prompts/           # 5 workflow prompts
├── resources/         # 3 MCP resources
└── http/              # Auth, upload, landing page

frontend/              # Next.js web UI (for self-hosted)
├── app/               # Pages + API routes (chat, tools)
├── components/        # Canvas, P6 upload, AI chat elements
└── Dockerfile

samples/               # Pre-loaded XER files (auto-load on startup)

Built on PyP6XER by Hassan Emam.


Built by

Paul Boucherat — portfolio · LinkedIn · GitLab · Buy me a coffee

If you're using this or have questions about P6 tooling, I'd like to hear from you.

License

MIT — free for commercial and personal use.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyp6xer_mcp-1.1.0.tar.gz (513.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyp6xer_mcp-1.1.0-py3-none-any.whl (61.8 kB view details)

Uploaded Python 3

File details

Details for the file pyp6xer_mcp-1.1.0.tar.gz.

File metadata

  • Download URL: pyp6xer_mcp-1.1.0.tar.gz
  • Upload date:
  • Size: 513.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for pyp6xer_mcp-1.1.0.tar.gz
Algorithm Hash digest
SHA256 fc5247f2d8f531ea424f446784a5a984576abec1a9ffd8001ed478beedf071e4
MD5 7b0a9ca17249425db982ee3efe6e0d60
BLAKE2b-256 1071a1944f209a506cb5e13fc1897f281aca05bab99cad5d71b0a5ca24cf240c

See more details on using hashes here.

File details

Details for the file pyp6xer_mcp-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pyp6xer_mcp-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6bfae49bc38489fa7b24314a0bbed2f0e52bcdc26fa3bc7cfe030d7b6b997689
MD5 f0b443ba3d16536f6d90b5e4c6026ac9
BLAKE2b-256 ad92b75b6919f61014918a43701a8400b5d66a4c012933fb6a01936091441f2a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page