Skip to main content
Glama
io.github.S-CurveLabs/longpath

io.github.S-CurveLabs/longpath

Official
by S-CurveLabs

longpath

An MCP server that lets an assistant (Claude Code, GitHub Copilot agent mode, any MCP client) read and analyze construction / project schedules the way a scheduler would: its own CPM engine, float, critical and driving paths, the DCMA 14-point assessment, logic-quality checks, update-to-update comparison, baseline variance and S-curve data.

Format

How

Primavera P6 .xer

native parser (multi-project files, Windows-1252 or UTF-8, optional tables)

MS Project XML (MSPDI)

native parser

MS Project .mpp / .mpt / .mpx

MPXJ converts to MSPDI (optional: longpath[mpp] + Java 11+)

Primavera P6 XML

MPXJ converts to XER (optional: longpath[mpp] + Java 11+)

Schedule files are only ever read. .xer and MS Project XML need nothing but Python; without the optional extra and Java, a .mpp fails with a message saying exactly what to install.

Tools

Area

Tools

Setup

check_setup — version, config file, whether Java + MPXJ were found

Overview

schedule_summary (start here) · list_calendars · wbs_tree · list_resources

Activities & logic

list_activities (WBS / code / status / type / text / float filters) · activity_detail · list_relationships

CPM

run_cpm (engine vs the float stored in the file) · critical_path (longest path or total float) · driving_path

Quality

dcma_assessment (14 points, thresholds, offenders) · logic_check (17 checks)

Change

compare_schedules (update vs previous update) · baseline_variance · s_curve (cost / units / activity counts)

Export

export_csv — any list above, in full, to a new .csv (the only write; see safety)

Every tool takes the schedule's absolute path. Every list returns count plus the top limit rows (default 25) and says when it truncated. Durations and float are working days on each activity's own calendar unless a field ends in _h.

Related MCP server: OmniPlan MCP Server

Install

pip install longpath          # or run it without installing: uvx longpath

Needs Python 3.11+. That is all .xer and MS Project XML files need.

MS Project .mpp and P6 XML (optional). These go through MPXJ, a Java library:

  1. Install the extra, which pulls in the mpxj package for its bundled jars: pip install "longpath[mpp]" (with uvx: uvx --from "longpath[mpp]" longpath).

  2. Install any Java 11+ runtime (JDK or JRE, e.g. Eclipse Temurin). longpath looks for it in java_home in longpath.toml, then JAVA_HOME, then java on PATH.

Run check_setup to see what was found. The MPXJ jars can also come from a folder of your own (mpxj_classpath). Without Java, MS Project's File > Save As > XML produces a file longpath reads natively.

Claude Code

claude mcp add --scope user longpath -- uvx longpath
# with .mpp support:
claude mcp add --scope user longpath -e JAVA_HOME=/path/to/jdk -- uvx --from "longpath[mpp]" longpath

VS Code / Copilot. Add to the user-level mcp.json (MCP: Open User Configuration), so it works in every window:

"longpath": {
  "type": "stdio",
  "command": "uvx",
  "args": ["--from", "longpath[mpp]", "longpath"],
  "env": { "JAVA_HOME": "C:\\path\\to\\jdk-21" }
}

(Drop --from longpath[mpp] and the env block if you only read .xer / XML: "args": ["longpath"].)

Configuration (optional)

Every setting is optional. Copy longpath.example.toml to one of these (first match wins):

  1. the file named by LONGPATH_CONFIG

  2. longpath.toml in the server's working folder

  3. longpath.toml in LONGPATH_HOME, default %LOCALAPPDATA%\longpath\ on Windows, ~/.local/share/longpath/ elsewhere

Key

Default

Meaning

java_home

JAVA_HOME, then java on PATH

Folder containing bin/java (Java 11+), for .mpp / P6 XML

mpxj_classpath

jars bundled in the mpxj package

Folder of MPXJ jars (or one jar) to use instead

java_timeout_seconds

180

Limit per MPXJ conversion

max_rows

25

Default top-N for list outputs

allow_writes

false

Let export_csv write files (it only previews otherwise)

Unknown keys are rejected with the list of allowed ones. No secrets are involved and nothing is sent anywhere: the server makes no network calls.

Safety model

  • Read-only by design. Every tool opens the schedule for reading only; MPXJ conversions write to a private temp folder that is deleted afterwards. All tools except export_csv carry readOnlyHint.

  • export_csv is the only write. It creates a new .csv file (UTF-8 with BOM for Excel) and refuses existing files, non-.csv paths and relative paths. It is a dry run by default (row count, columns, first rows) and writes only with dry_run=false and allow_writes = true in the config. Undo = delete the file.

The CPM engine

P6 rules, computed from the logic in the file (not copied from its stored dates):

  • FS / SS / FF / SF with positive and negative lags; lag calendar per the P6 option (predecessor, successor, 24-hour, project default).

  • Each activity on its own calendar at minute resolution: work weeks with split shifts, holidays, changed-hours days, 24-hour and 6/7-day calendars. Starts land on the first working minute (Mon 08:00), finishes at the end of the last working interval (Fri 17:00).

  • Constraints: Start/Finish On or After/Before, Start On / Finish On, Mandatory Start/Finish (breaks logic, as in P6), As Late As Possible, P6 external early/late dates, MS Project deadlines (as finish-on-or-before), project must-finish date.

  • Progress: data date floor, actual dates, in-progress remaining work under Retained Logic or Progress Override (from the file's schedule options). Completed activities are fixed and have no float.

  • Total float per the file's setting (finish, start, or smaller of the two), free float, relationship float, driving flags, longest path, critical by the project's float threshold. Level-of-effort and WBS-summary activities are left out of the network. Logic loops are detected and listed instead of producing garbage.

Validation

  • Known-answer tests on hand-built XERs: every relationship type, leads, lags, holidays, mixed calendars, SNET / FNLT / Mandatory Start, must-finish, retained logic vs progress override, open ends, LOE, loops.

  • MPXJ's public sample files (131 MS Project schedules), read two ways (.mpp → MS Project XML, and the XER MPXJ writes): all load and every tool runs on every file. Computed total float matched the slack MS Project stored for about 96% of activities (3,910 of 4,065 via XER; 3,880 of 4,047 via .mpp). Every remaining difference traced so far is an MS Project vs P6 rule difference (see limits); the same file read both ways gives identical floats.

  • 20,000 activities / 40,000 relationships (scripts/make_big_xer.py): open + CPM about 0.8 s, DCMA about 1 s.

  • scripts/sweep_samples.py <folder> re-runs the stored-float comparison over any folder of schedules.

Known limits

  • Not yet validated against a broad set of P6-calculated XERs. The P6 rules are verified by hand-worked answers, and the large sample sweep came from MS Project files. If run_cpm disagrees with the float P6 stored in your file, an issue with the comparison_with_file output is very welcome.

  • Resource-dependent activities use the activity calendar (resource calendars and leveling are not modelled).

  • ALAP is approximated (the activity is pushed late by its free float). P6 "expected finish", suspend/resume and multi-project scheduling across files are not modelled; relationships to other projects count as external.

  • MS Project differs from P6 on slack for SS/SF-linked predecessors, summary-task logic (dropped here, with a warning), manually scheduled tasks and resource-calendar-driven tasks, so stored MS Project slack will not always match.

  • S-curves spread quantities linearly over working time (no resource curves or timephased data). MS Project "cost" is cost at completion; its Baseline (0) is the planned curve when present.

  • DCMA thresholds are the standard ones and fixed; "high duration" uses original duration; missed tasks, BEI and CPLI need a baseline (a baseline file, MS Project Baseline 0, or P6 planned dates, labelled as such).

  • Percentage lags (MS Project) are converted to hours of the predecessor's duration; elapsed lags are treated as working time.

  • Password-protected .mpp files cannot be read.

Layout

src/longpath/ — xer.py / mspdi.py / mpxj_bridge.py → model.py (one normalized model) → calendars.py (work-time timeline) → cpm.py → checks.py (DCMA + logic) / compare.py (updates, baseline) / curves.py (S-curve) → analysis.py (shared row shaping) → server.py (the tools). tests/xerbuild.py builds known-answer XERs.

Development

git clone https://github.com/S-CurveLabs/longpath; cd longpath
python -m venv .venv
.venv\Scripts\pip install -e .[mpp,dev]
.venv\Scripts\pytest

The tests that go through MPXJ run only when Java is found (JAVA_HOME or PATH) and skip otherwise. The fixtures in tests/fixtures/ are synthetic; scripts/make_fixtures.py rebuilds them (see tests/fixtures/README.md).

License

MIT. The optional mpxj package is a separate LGPL library that longpath runs as a converter; it is not bundled.

Available Tools

17 tools
activity_detailA
Read-onlyIdempotent

Everything about one activity (by activity ID, or exact name): type, status, calendar, durations, actual / early / late dates from the CPM engine next to the dates stored in the file, total and free float (computed and stored), constraints, activity codes, user fields, resource and cost assignments, and its predecessors and successors with relationship type, lag, relationship float and a driving flag.

Inputs: path (required), activity (required), project.

baseline_varianceA
Read-onlyIdempotent

Start / finish / duration variance of every activity against a baseline, in working days (positive = later than baseline), worst finish variance first, plus the project finish variance. Baseline source, in order: baseline_path (a baseline schedule file, matched on activity ID), the baseline stored in the file (MS Project Baseline 0), or P6 Planned Start/Finish (labelled as such, since it is not a true baseline).

Inputs: path (required), limit, project, baseline_path, +1 more.

check_setupA
Read-onlyIdempotent

Show the server version, which config file is in use, and whether .mpp support is available (Java + MPXJ jars, where they were found). Run this first if a .mpp file fails to open. .xer and XML files never need Java.

Inputs: no named parameters.

compare_schedulesA
Read-onlyIdempotent

Update-to-update comparison of two versions of a schedule (previous vs current update). Summary: both data dates and finishes, finish slip (working and calendar days), longest-path turnover; then counts and top rows for added/deleted activities and relationships, lag changes, duration changes, date changes (largest finish movement first), float changes (biggest loss first), started / finished this period, activities that were forecast to start this period but did not, actual dates edited after the fact, constraint, calendar and name changes, activities that joined or left the longest path. Pass section= for one section's full list. Activities match on P6 Activity ID (MS Project: Unique ID).

Inputs: current_path (required), previous_path (required), limit, section, +2 more.

critical_pathA
Read-onlyIdempotent

The critical path, in start order. method='longest_path' (default) traces driving relationships back from the latest finish, as P6's Longest Path does; method='total_float' lists activities whose total float is at or below the project's critical threshold (or float_threshold_days). Each row carries total float and whether it is driven by a relationship or by the data date / a constraint.

Inputs: path (required), limit, method, project, +1 more.

dcma_assessmentA
Read-onlyIdempotent

DCMA 14-point schedule assessment with the standard thresholds: logic, leads, lags, relationship types, hard constraints, high float (>44 d), negative float, high duration (>44 d), invalid dates, resources, missed tasks, critical path test (adds 600 days to a longest-path activity and checks the finish moves), CPLI and BEI. Each check reports metric, threshold, pass/fail and example offenders. Missed tasks / BEI / CPLI need a baseline: baseline_path = a baseline schedule file, else the baseline stored in the file, else P6 planned dates (labelled). float_source = computed (this server's CPM) or stored (the file's own float). Pass check='6_high_float' (or its number, '6') for that check's full offender list.

Inputs: path (required), check, limit, project, +3 more.

driving_pathA
Read-onlyIdempotent

Everything that drives one activity: its driving predecessors, their driving predecessors and so on, back to the activities driven only by the data date or a constraint. Use it to answer 'why is this activity (or milestone) forecast on that date?'.

Inputs: path (required), activity (required), limit, project.

export_csvA

Write the FULL list behind one of the list tools to a new .csv file (Excel-friendly UTF-8). tool is one of list_activities, list_relationships, wbs_tree, critical_path, driving_path, dcma_assessment (with check=...), logic_check (with check=...), compare_schedules (with section=...), baseline_variance, s_curve, list_resources; arguments are that tool's arguments (path, filters...). Never overwrites an existing file and never touches the schedule. dry_run=true (default) returns the row count, columns and first rows without writing; writing needs dry_run=false and allow_writes = true in longpath.toml.

Inputs: tool (required), csv_path (required), dry_run, arguments.

list_activitiesA
Read-onlyIdempotent

List activities with filters; returns the match count and the top limit rows (id, name, WBS, type, status, durations, start/finish, computed total float in working days, constraint). Filters: wbs = WBS code or name fragment (includes everything below it); code = 'Code Type=Value' or a bare value (activity codes and user fields); status = not_started / in_progress / complete / incomplete; activity_type = task, milestone, level_of_effort, wbs_summary, resource_dependent; text = fragment of the ID or name; min/max_float_days on the CPM total float; critical_only (float <= the project's critical threshold); longest_path_only. include_stored_float adds the float saved in the file next to the computed one. sort = start, finish, float, id, duration. For all rows use export_csv(tool='list_activities', ...).

Inputs: path (required), wbs, code, sort, +10 more.

list_calendarsA
Read-onlyIdempotent

List the work calendars in a schedule file: work week (hours per weekday), hours per day, number of holiday and changed-hours exceptions, and how many activities use each. Pass calendar (name or id) for one calendar with its exception dates (up to exceptions of them).

Inputs: path (required), calendar, exceptions.

list_relationshipsA
Read-onlyIdempotent

List relationships (predecessor -> successor, type, lag in working days of the predecessor, driving flag and relationship float from the CPM engine). Filter by an activity (either end), rel_type (FS/SS/FF/SF), lag range, or driving_only.

Inputs: path (required), limit, project, activity, +4 more.

list_resourcesC
Read-onlyIdempotent

Resources assigned in the project with totals: activities, budget / actual / remaining units and cost, resource type. Expenses and fixed costs are summed on their own line. Largest budget cost first.

Inputs: path (required), limit, project.

logic_checkB
Read-onlyIdempotent

Logic-quality sweep: loops, open starts/finishes, dangling starts/finishes, leads, excessive lags (> max_lag_days), SF links, SS/FF-only activities, hard and soft constraints, long durations, out-of-sequence progress, dates on the wrong side of the data date, zero-duration tasks, duplicate and redundant links, summary-task and external links. Returns every check's count with a few examples; pass check= for that check's full list.

Inputs: path (required), check, limit, project, +2 more.

run_cpmA
Read-onlyIdempotent

Run the server's own CPM engine (forward/backward pass: FS/SS/FF/SF, lags, each activity's calendar with holidays, constraints, data date, retained logic or progress override per the file's settings) and report the computed finish, critical and longest-path counts, and a check against the float and early dates the scheduling tool saved in the file: how many total floats match, and the largest differences. Differences point at settings, calendars or stale files (a schedule not recalculated after edits) worth investigating.

Inputs: path (required), limit, project.

schedule_summaryA
Read-onlyIdempotent

Open a schedule file (.xer, .mpp, MS Project .xml, P6 .xml) and summarize it: projects in the file, data date, activity/relationship/WBS/calendar/resource counts by type and status, planned start, finish (stored and as computed by the CPM engine), critical and longest-path counts, float spread, scheduling options, and warnings from reading the file. Use this first on any new file. project = short name or id, needed only when the file holds several projects (the error lists them).

Inputs: path (required), project.

s_curveA
Read-onlyIdempotent

S-curve / loading data by period: planned (baseline) vs actual vs forecast, per period and cumulative, for measure = cost, units (resource hours/quantities) or activities (count of finishes). period = week, month or quarter. resource = one resource's code or name for its histogram. Planned values come from baseline_path, the file's stored baseline, or P6 planned dates, spread linearly over working time. Also returns planned vs actual to the data date.

Inputs: path (required), limit, period, measure, +4 more.

wbs_treeB
Read-onlyIdempotent

The WBS hierarchy down to max_depth levels, each node with its activity count (including everything below it), how many are incomplete, the earliest start, latest finish and lowest total float (working days) under it.

Inputs: path (required), limit, project, max_depth.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 17 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: listing activities, relationships, resources, calendars, detailed views, CPM analysis, critical path, DCMA, logic checks, comparisons, variance, and S-curve. Even similar tools like critical_path vs driving_path are differentiated by scope (project-wide vs specific activity).

    Naming Consistency5/5

    All tool names follow a consistent snake_case verb_noun pattern (list_*, run_cpm, compare_schedules, baseline_variance). Nouns like wbs_tree and s_curve are still in the same style, and there is no mixing of camelCase or inconsistent verbs.

    Tool Count4/5

    17 tools is slightly above the ideal 3-15 range, but given the specialized domain of schedule analysis, each tool serves a distinct analytical function (DCMA, logic, comparison, variance, S-curve) and earns its place. It feels well-scoped rather than bloated.

    Completeness5/5

    The tool surface covers the full lifecycle of schedule analysis: reading/summarizing files, listing all resource types, detailed activity/relationship info, CPM engine, critical path, DCMA assessment, logic checks, update-to-update comparison, baseline variance, and S-curve. No obvious gaps for a read-only analysis tool.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Enables AI assistants to analyze Primavera P6 XER files for insights into critical paths, schedule health, and project performance. It provides 23 specialized tools for managing schedule data, resources, and earned value through local or remote interfaces.
      29
      21 PyPI
      16
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables Claude to read and analyze project schedule files in OmniPlan (.oplx) and Microsoft Project (.mpp) formats, answering questions about tasks, milestones, resources, and progress.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      MCP server that enables LLMs to read and analyze Microsoft Project schedules, including critical path, resources, and advanced construction planning layers (AWP and LPS) for work packages and Lean planning.
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables construction teams to create local projects, record sourced field evidence, run deterministic quantity calculations, and draft daily logs, estimates, and change orders with visible assumptions and human approval gates. Keeps all data local and portable with no external side effects.
      10
      Apache 2.0