omp packages

pi-mcpls-trusted-workspaces0.1.1

Pi package that starts mcpls on demand for explicitly trusted Git upstreams

GitHub Actions Published 3 days ago MIT ~0 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

pi-mcpls-trusted-workspaces

A Pi package that starts mcpls on demand for explicitly configured Git upstreams. Each session gets a checkout-local MCP server and workspace while sharing one user-managed TOML per upstream.

Install

pi install npm:pi-mcpls-trusted-workspaces

Or try it without changing settings:

pi -e npm:pi-mcpls-trusted-workspaces

Git installs work too: pi install git:github.com/drichardson/pi-mcpls-trusted-workspaces.

A local checkout can be installed by path. Keep the source absolute or ./-prefixed in settings.json: the pi-subagents local agent resolver does not support bare relative paths.

Included resources

  • An on-demand MCP extension with startup warnings
  • The mcpls-config skill for configuring and validating new repositories
  • An optional mcpls-worker subagent for users of pi-subagents
  • A child-only MCP connector required by pi-subagents' SDK sessions

Requirements

  • Pi with MCP support
  • mcpls and git on PATH
  • Language servers and toolchains required by each repository

Configure

Create ~/.pi/agent/mcpls-trusted-workspaces.json:

{
  "repoConfigs": {
    "github.com/example/project": "~/.pi/agent/mcpls/project.toml"
  }
}

Mapping values must be absolute paths (~/... is fine); a relative path, invalid JSON, or an unusable repoConfigs shape produces a warning naming the file rather than a silent skip.

Each exact normalized upstream mapping is both a trust decision and a config selection. SSH and HTTPS origins normalize to host/org/repo without .git.

What the mapping trusts

The key is the checkout's own remote.origin.url, which lives in .git/config. A clone records the URL it came from, but a copied or hand-built working tree can claim any upstream — so a directory that ships a .git naming a repository you trust is treated as that repository. Treat a working tree you did not clone yourself with the same suspicion as the code inside it.

Two smaller consequences of the same design:

  • Ports are dropped when normalizing, so host:8443/org/repo and host/org/repo share one entry.
  • git and mcpls come from the inherited PATH, which a direnv or Nix activation inside a checkout can influence.

No mcpls configuration is read from a checkout: a mapped path must be absolute, and only your config selects it.

The packaged helper writes it for you:

npx pi-mcpls-trust ~/code/project --config ~/.pi/agent/mcpls/project.toml

It normalizes the origin the same way the extension does, preserves other entries, refuses a config path that does not exist, and tells you to /reload. From a checkout, node scripts/trust.mjs takes the same arguments.

Create the referenced TOML:

[workspace]
roots = []

[[lsp_servers]]
name = "example-language-server"
language_id = "language"
command = "example-language-server"
args = ["--stdio"]
file_patterns = ["**/*.ext"]
timeout_seconds = 120
request_timeout_seconds = 120

Use roots = [] so the current checkout is the workspace. Relative roots = ["."] would resolve to the shared TOML's directory.

To check a config before relying on it, npx pi-mcpls-probe <file> --config <toml> drives mcpls for one file, waits out language-server startup, and prints the diagnostics along with any tool no server can answer. From a checkout, use node scripts/probe.mjs.

The mcpls-config skill provides detailed trust, setup, and validation guidance. Language servers that normally run inside a container or Nix environment can be launched through that wrapper so they see the same toolchain.

Use

Start Pi in a configured checkout. A successful registration is silent: the mcp__mcpls__... tools appearing is the signal that it worked. Unmapped directories, upstreams, and a missing mcpls produce a warning at session start.

MCP tools use direct exposure as mcp__mcpls__... and remain callable from codemode. Run /reload after changing extension or JSON/TOML configuration.

With pi-subagents installed, use the advertised mcpls-worker agent. It loads this package's extension and child-only MCP connector using relative paths, so no installation-specific edits are needed.

The extension starts language-server commands taken from the user-approved TOML, so review both files before mapping a repository.

Development

npm install
npm test
npm run typecheck

Tests run on plain Node with no dependencies, using the interpreter's TypeScript type stripping. Keep machine-specific trust mappings, wrapper paths, credentials, and repository TOMLs out of this repository.

Releasing

npm only shows the trusted publisher settings for a package that already exists, so the first version goes out by hand from a clean checkout:

npm publish --access public

Then open the package settings on npmjs.com and add a GitHub Actions trusted publisher for this repository and publish.yml, allowing npm publish. A new trusted publisher configuration expires if it does not complete a publish within two days, so add it when the next release is ready. Restricting token-based publishing afterwards leaves the workflow's OIDC identity as the only way in.

After that, publishing runs from a GitHub release. Bump version in package.json, commit, then publish a release whose tag is v<version>:

gh release create v0.1.1 --generate-notes

The publish workflow tests the tagged commit, checks the tag against package.json, and publishes straight to npm through trusted publishing — the job's OIDC identity replaces any token, and provenance is generated automatically for a public repository. Prerelease versions go to the next dist-tag instead of latest.