Skip to content

Contributing

This page is the source of truth for how MCP/U is organized and how to contribute without publishing the wrong package from the wrong folder.


MCP/U has two public codebases and two publish targets:

AreaRepository / folderPublished asPurpose
Client, docs, demo firmwareThanabordeeN/MCP-Umcpu-client on npmRuns on a computer, connects AI agents to MCUs, hosts docs and examples
Arduino firmware libraryThanabordeeN/MCP-U_ArduinoMCP-U for Arduino IDE / PlatformIORuns on the MCU and exposes GPIO, pins, buffers, and custom tools

The runtime path is:

AI host
-> MCP stdio
-> mcpu-client npm package
-> Serial or TCP
-> MCU firmware using the MCP-U Arduino library

The client and firmware library are released separately. Their versions can move independently when only one side changes.


Use this repository for:

  • TypeScript client changes in client/
  • Documentation site changes in docs-site/
  • Demo firmware project changes in firmware/
  • PlatformIO example projects in examples/
  • Protocol, architecture, and guide documents in docs/

Important folders:

MCP-U/
client/ npm package: mcpu-client
firmware/ demo PlatformIO firmware project
src/main.cpp demo firmware entrypoint
lib/MCP-U/ local library copy used by the demo project
examples/ standalone PlatformIO examples
docs-site/ Astro/Starlight documentation site
docs/ markdown reference docs

Use this repository for the firmware library that users install through Arduino IDE or PlatformIO.

Important folders:

MCP-U_Arduino/
src/MCP-U.h public firmware API
src/MCP-U.cpp firmware implementation
examples/ Arduino IDE examples
library.properties Arduino Library Manager metadata
library.json PlatformIO registry metadata

For firmware library work, prefer changing MCP-U_Arduino first. If the same change is needed by the monorepo demo firmware, sync the matching files into MCP-U/firmware/lib/MCP-U/.


Change typeEdit hereVerify withPublish from
npm client behaviorMCP-U/client/src/npm run build, npm test from MCP-U/clientMCP-U/client
npm package metadataMCP-U/client/package.json and lockfilenpm pack --dry-run from MCP-U/clientMCP-U/client
Documentation siteMCP-U/docs-site/src/content/docs/npm run build from MCP-U/docs-sitedocs hosting workflow
Demo firmwareMCP-U/firmware/src/pio run from MCP-U/firmwarenot published as a library
Arduino library API/implementationMCP-U_Arduino/src/pio pkg pack from MCP-U_ArduinoMCP-U_Arduino
Arduino IDE examplesMCP-U_Arduino/examples/compile example in Arduino IDE or PlatformIOMCP-U_Arduino
PlatformIO examplesMCP-U/examples/pio run from each examplenot published as a package

Do not run pio pkg publish from MCP-U/client. That folder contains an npm package.json, not a PlatformIO library.json.

Do not publish the demo firmware project as the canonical library. MCP-U/firmware is a consumer/demo project. The canonical firmware library package is MCP-U_Arduino.


Terminal window
cd MCP-U/client
npm install
npm run build
npm test
Terminal window
cd MCP-U/docs-site
npm install
npm run dev
Terminal window
cd MCP-U/firmware
pio run
Terminal window
cd MCP-U_Arduino
pio pkg pack

If pio is not on PATH on Windows, call the installed executable directly:

Terminal window
C:\Users\origi\AppData\Roaming\Python\Python313\Scripts\pio.exe pkg pack

The firmware library exists in two places:

LocationRole
MCP-U_Arduino/src/MCP-U.h and MCP-U_Arduino/src/MCP-U.cppcanonical public library
MCP-U/firmware/lib/MCP-U/MCP-U.h and MCP-U/firmware/lib/MCP-U/MCP-U.cpplocal copy used by the monorepo demo firmware

When changing firmware library behavior:

  1. Change MCP-U_Arduino/src/ first.
  2. Copy the same MCP-U.h and MCP-U.cpp changes into MCP-U/firmware/lib/MCP-U/.
  3. Keep library.properties and library.json versions aligned when the change is released.
  4. Verify the files match before release:
Terminal window
cd D:\Dev\Prototype\MCP-U\firmware\lib\MCP-U
git diff --no-index -- MCP-U.h ..\..\..\..\MCP-U_Arduino\src\MCP-U.h
git diff --no-index -- MCP-U.cpp ..\..\..\..\MCP-U_Arduino\src\MCP-U.cpp

No output from those commands means the core firmware files match.


Use this section before publishing anything.

Run from MCP-U/client only:

Terminal window
cd MCP-U/client
npm run build
npm test
npm pack --dry-run
npm publish

Before publishing, check:

  • package.json version is the intended npm version.
  • package-lock.json has the same package version.
  • Runtime metadata in src/index.ts matches the published version.
  • dist/ is rebuilt by npm run build.

After publishing:

Terminal window
npm view mcpu-client version

Run from MCP-U_Arduino only:

Terminal window
cd MCP-U_Arduino
pio pkg pack
pio pkg publish

Before publishing, check:

  • library.properties has the intended Arduino library version.
  • library.json has the same PlatformIO library version.
  • library.json.repository.url points to https://github.com/ThanabordeeN/MCP-U_Arduino.
  • src/MCP-U.h and src/MCP-U.cpp contain the intended firmware API/implementation.
  • The matching monorepo local copy is synced if the demo firmware depends on the same behavior.

After publishing, tag the Arduino library repo:

Terminal window
git tag -a vX.Y.Z -m "MCP-U Arduino X.Y.Z"
git push origin main
git push origin vX.Y.Z

The demo firmware in MCP-U/firmware is not a registry package. Verify it with:

Terminal window
cd MCP-U/firmware
pio run

Publish the actual library from MCP-U_Arduino, not from the demo firmware folder.


Running PlatformIO publish from the npm client folder

Section titled “Running PlatformIO publish from the npm client folder”

Wrong:

Terminal window
cd MCP-U/client
pio pkg publish

Why it fails: PlatformIO reads client/package.json, sees npm-only fields like scripts.build, and reports manifest errors.

Correct:

Terminal window
cd MCP-U_Arduino
pio pkg publish

MCP-U/firmware is a PlatformIO project, not the canonical published library. Use it for pio run, uploads, and demo firmware development.

For library publishing, use:

Terminal window
cd MCP-U_Arduino
pio pkg publish

Forgetting that npm and Arduino versions are separate

Section titled “Forgetting that npm and Arduino versions are separate”

mcpu-client and the Arduino library are different packages. A client-only fix may publish mcpu-client@1.2.1 while the Arduino library remains MCP-U@1.2.0.


Before opening a PR:

  • Build or test the component you changed.
  • Update docs when behavior, public APIs, install steps, or release flow changes.
  • Mention which package is affected: npm client, Arduino library, docs, examples, or demo firmware.
  • Include exact verification commands and results in the PR description.
  • Avoid unrelated generated files such as local databases, .pio/, temp folders, and package tarballs.

Include the details that match the failing area:

FieldDescription
BoardESP32, ESP8266, Uno, Mega, Nano, etc.
Firmware library versionArduino/PlatformIO MCP-U version or git commit
Client versionnpm list mcpu-client or npm view mcpu-client version
TransportSerial, TCP, mock
Steps to reproduceNumbered steps from a clean start
Expected behaviorWhat should happen
Actual behaviorWhat happened instead
Error outputExact terminal, serial monitor, or MCP client output

By contributing to MCP/U, you agree that your contributions will be licensed under LGPL-3.0, the same license used by this project.