Contributing Changes
Audience: contributors. This is the one path every change takes — feature or fix, the steps are the same. Consumers only need the guides and reference sections.
Executive Summary
A change lands here by proving itself: a failing test first, the
implementation in the one unit that owns the rule, the local gate
(lwpt install --frozen, lwpt build, lwpt test, lwpt run smoke,
lwpt format --check) green, and a Conventional-Commit-titled PR through CI's
cross-platform and cross-implementation batteries. Features and fixes walk the same
path — a feature starts with a test specifying the behaviour, a fix
with a regression test that reproduces the bug.
Set up once
- FPC 3.2.2 —
apt install fpc/brew install fpc/ the win32+win64 combo installer from freepascal.org. The library targets exactly 3.2.2, with its compiler flags insource/units/MCP.inc(fpc -iVprints yours). CI's Windows leg installs 3.2.2 itself; the Linux and macOS legs take the package manager's FPC and print its version. - lwpt — the canonical build/test/format entry point, at the
release this repository pins: the exact
testingversion inlwpt.toml(bash .github/scripts/lwpt-version.shprints it; a newer lwpt can refuse the committed lockfile). Download that release's tarball for your platform from lwpt's releases, verify the checksum, putlwpton PATH. Do not invokefpcdirectly except asfpc @lwpt.cfg. - lefthook —
lefthook installonce per clone wires the formatting pre-commit hook. - Node 24 — what CI uses; only for the interop harness
(
tools/interop-ts/), the conformance runner (tools/conformance/, at least 22) and the website (website/, whose Next.js needs at least 20.9).
Then:
git clone https://github.com/frostney/pascal-mcp-sdk
cd pascal-mcp-sdk
lwpt install --frozen # verify lwpt.lock and the committed modules
lwpt build # build/mcpdemo + build/mcpsmoke
lwpt test # co-located unit suites
lwpt run smoke # E2E battery: spawns mcpdemo, drives the protocollwpt install --frozen is the CI mode: verify the lockfile and the
committed modules without touching the network — every PR matrix
leg (Linux, macOS, Windows) runs it.
Start from a test
Every change starts with the test that would have caught it:
- Fixing a bug? Write the test that reproduces it — in the
co-located suite of the unit that owns the behaviour
(
source/units/MCP.<Area>.Test.pas), or inmcpsmokeif it only shows up over a real transport. Watch it fail, then fix. - Adding a feature? Write the test that specifies it. Test names
state the rule being proven, spec-style
(
'null id → -32600 (MCP forbids null ids)'), so a failing run reads as a conformance report — see Code Style. - Changing protocol behaviour? The test cites the spec page it proves, and the implementation carries the citation + verification date. Spec facts are verified, never recalled — check the schema anchor and a real client, not prose alone (see Architecture § Spec grounding).
Put the change where it belongs
Layering is strictly bottom-up, and each rule has exactly one home — the ownership table in Architecture § Layering says which unit owns what. The short version:
- Wire shape, id rules, error envelopes →
MCP.JSONRPC. _meta, versioning, result stamping →MCP.Protocol.- Dispatch, registries, sessions, error policy →
MCP.Server. - Schema building/derivation →
MCP.Schema. - Framing and byte movement → the transport units, which move lines only and never re-decide a protocol rule.
If a change seems to need protocol knowledge inside a transport (or I/O inside the core), the design is wrong — re-read the layering before writing code.
Three ground rules bound every change (the full set lives in AGENTS.md; the reasoning behind them is recorded in the ADRs under docs/adr/):
- FreePascal only — FPC 3.2.2, Delphi mode, flags centralised in
MCP.inc; no second compiled language, no per-unit directives. - Zero third-party runtime dependencies — FPC-shipped packages
only: RTL, fpjson, fcl-base (
base64), and fcl-web confined toMCP.Transport.HTTP. - Public API changes update the reference docs —
.github/scripts/check-reference-docs.shfails CI when anMCP*/Register*function or procedure declared in the interface ofMCP.Server.pasis missing fromdocs/reference/. Public API in other units (and types, constants, properties) is not gated — document it by hand.
Run the gate locally
lwpt install --frozen # lockfile and committed modules agree
lwpt build # both apps compile
lwpt test # unit suites
lwpt run smoke # E2E: mcpsmoke drives mcpdemo over pipes
lwpt format --check # formatter drift (pre-commit fixes in place)
lwpt health # complexity within the manifest ceilings
lwpt duplication # token clones within the manifest ceilingWhile iterating, lwpt test takes selectors — a path or glob runs
just the suites you're working on
(lwpt test source/units/MCP.Server.Test.pas), and
lwpt test --inventory prints JSON with each selected test program's
path and its number of suites and cases. It starts every selected
program (compiling it unless a cached executable is current) to count
what it registers, and exits before any test body runs.
Protocol-surface changes should also run the interop battery — the
official MCP TypeScript clients against mcpdemo:
cd tools/interop-ts
npm ci
npm run interopThe official MCP conformance suite runs against mcpdemo --http and
is judged against the committed tools/conformance/baseline.json
(see Tooling § Official conformance suite).
A regression it reports is fixed, not recorded. The baseline changes in
the same PR only when a known failure or skip now passes, or a change
in what the suite can test is deliberate and tracked by an issue:
lwpt build
lwpt run conformanceTest execution touches no external network — pipes, loopback
sockets, and temp files only. The one exception is
lwpt run conformance, whose npx fetches the pinned suite from the
npm registry unless it is cached. Dependency installation is
separate: npm ci for the interop harness may reach the npm
registry.
Open the PR
- Title is a Conventional Commit (
feat: …,fix: …,docs: …). The repo squash-merges, so the title becomes the commit subject and the changelog entry —pr-title.ymlgates it, with allowed types read fromcliff.toml. - CI must be green across the board. What runs (see Tooling § CI):
| Gate | Proves |
|---|---|
| Linux / macOS / Windows legs | checksum-verified lwpt install, install --frozen, build, unit suites, mcpsmoke on every platform |
fpc @lwpt.cfg leg | the zero-install path still works |
interop (required) | the official TypeScript clients still talk to mcpdemo — a red interop job is a real cross-implementation regression |
conformance (non-blocking) | the official conformance suite's 2026-07-28 requirement set still matches tools/conformance/baseline.json |
format / agents --check | formatter and AGENTS.md command block have not drifted |
check-reference-docs.sh | every MCP*/Register* routine in MCP.Server's interface is documented in docs/reference/ |
| health / duplication | complexity and token-clone ceilings in lwpt.toml hold — ratchets set just above the adoption-day baseline, so they shrink but never grow unnoticed |
| markdownlint | docs follow .markdownlint-cli2.jsonc |
pages.yml (on docs//website/ changes) | the website still builds; broken internal doc links fail here |
- Reverting via GitHub's Revert button produces a
Revert "..."title git-cliff cannot parse — retitle itrevert: <original description>.
DEFINITION_OF_READY.md and DEFINITION_OF_DONE.md define what makes work startable and finished here.