Skip to content

LyraShield alongside the Pi coding agent

Connect Pi Coding Agent to LyraShield through built-in MCP and hosted OAuth, with skills and CLI/CI alternatives.

LyraShield MCP integration with Pi
On this page

Pi Coding Agent is fast and deliberately small, with built-in MCP for stdio and Streamable HTTP, OAuth sign-in and Agent Skills support. The recommended LyraShield connection uses hosted OAuth through Pi’s user-level server configuration. A trusted project can also define a server; a project entry replaces a same-named user entry. Some extensions can replace Pi’s built-in MCP implementation, so check which configuration source is active if an extension changes the client.

This guide preserves a clear evidence boundary. Pi’s MCP status command shows configured connections and discovered tools; it does not prove that a LyraShield-authenticated tool call or scan completed. Retain the tool result and scan receipt for that claim. The vibe coding security guide explains why generated code still needs independent checks and the Pi integration guide records the current setup path.

The companion Pi Coding Agent app security checklist covers package, extension, skill, credential and tool review. Use both records when a release needs source-change evidence and a review of the agent environment that produced it.

Reassess after Pi, an extension or a dependency changes the source. Request a scan only when its target and profile are authorized. If the repository revision changes between the scan and release, treat the earlier result as historical and assess the new revision. Keep incomplete coverage visible and never let a successful doctor command stand in for a completed assessment.

1. Prepare the project and authenticate

Use Pi installed from its official instructions and an authorized LyraShield workspace. For hosted access, add the URL with Pi’s built-in MCP command and sign in:

pi mcp add lyrashield --url https://app.lyrashieldai.com/api/mcp
pi mcp list
pi mcp login lyrashield

Pi stores its OAuth tokens in its own user credential store. For a personal setup, Pi writes the server to the user-level configuration. Use the project-level option only for a deliberately shared entry, because Pi reads project configuration only after trust is granted. Use Pi’s native pi mcp add and pi mcp login commands above. The earlier CLI 0.2.13 release printed an obsolete Pi recipe. The current CLI skill installer targets Pi’s documented skill paths; use Pi’s native MCP commands for hosted OAuth.

Review the dry-run output before writing. For a local stdio or CI workflow, authenticate that separate surface with npx -y lyrashield@0.2.14 login --oauth and use npx -y lyrashield@0.2.14 doctor to check local credentials.

Do not put a LyraShield token in Pi prompts, package source, skill files, shell transcripts committed to the repository or a project-shared MCP configuration. Pi’s hosted OAuth flow requires no static bearer token in that file. If a key may have entered any of those surfaces, rotate it. Check Pi’s server status and make a read-only LyraShield call before relying on the connection; setup alone is not an authenticated runtime receipt.

Record the Pi version, enabled packages and extensions, active skills, project revision, LyraShield CLI version and the target you intend to scan. These details make later results reproducible and reveal when an extension upgrade changed the agent’s authority.

2. Request a scan only for the authorized change

Let Pi make the authorized code change and inspect the diff. When a scan is explicitly requested, use the connected LyraShield MCP tool or the CLI against the authorized target and scope; do not let a routine code review trigger paid scan work. Review the returned scan identity and every finding’s recorded evidence state, location and limitation.

A finding marked detected remains a candidate for triage. An inconclusive result remains uncertain. A retest-confirmed outcome requires a fresh applicable retest and a fix requires its own retest. Pi can help edit code in response to reviewed guidance, but its confidence does not change LyraShield’s evidence state.

Use a short project instruction such as:

After changing authentication, input handling, secrets, dependencies or deployment code, report the diff and wait for an explicitly requested, authorized LyraShield scan. Preserve each finding's recorded evidence state. Do not call a detected finding verified and do not claim a fix until a fresh retest completes.

This instruction helps the human remember the check. An authenticated MCP tool call or CLI scan can create the selected recorded evidence; the runner-local CI gate remains a separate diff check.

3. Use Pi’s built-in MCP client

Pi already includes an MCP client. Its user-level server configuration is ~/.pi/agent/mcp.json; project-level .pi/mcp.json is loaded only after the project is trusted, and an entry with the same server name replaces the user-level entry. Use Pi’s OAuth sign-in rather than adding a static credential to a shared file.

Some installed extensions can replace Pi’s built-in MCP support. If one is active, review its source and version, then verify which server file and sign-in flow Pi actually uses. Do not credit an extension path to Pi core. A terminal-only LyraShield scan cannot be relabeled as a Pi MCP runtime receipt.

Use Pi’s own pi mcp add and pi mcp login commands for hosted OAuth. Use pi mcp list to inspect discovery, then call lyrashield_list_workspaces. A local stdio alternative uses @lyrashield/mcp@0.2.12 after separate npx -y lyrashield@0.2.14 login --oauth; it does not share Pi’s hosted credentials.

Pi also discovers Agent Skills from ~/.agents/skills/ and .agents/skills/. Review a skill’s SKILL.md and any scripts before installing it or trusting a project that supplies it. LyraShield’s dedicated Pi package/catalog route remains in preparation, so this documents Pi’s discovery contract rather than claiming a public Pi listing.

4. Review the result and complete the fix loop

Group findings by authorization, injection, secrets and dependency handling. Compare code weaknesses with OWASP Top 10 and CWE Top 25 and dependency advisories with OSV. Keep each result tied to the scan, target, source revision and coverage receipt.

Use lyrashield_generate_fix_plan only where that authenticated interface is available; it provides read-only remediation guidance. A developer or coding agent applies the reviewed change. Record the proposal through an approved surface, queue a new retest and wait for the resulting receipt before calling the issue remediated. Neither a Pi edit nor disappearance from an incomplete scan proves resolution.

If the CLI cannot establish target identity, coverage or fresh evidence, preserve the insufficient state. Do not convert an unavailable or incomplete result into a clean gate simply because the source diff looks safe.

5. Wire a diff aware GitHub Action gate

Local Pi checks are fast, but you need PR enforcement that survives skipped local steps. Add the official LyraShield GitHub Action in diff aware mode and upload SARIF for native annotations.

name: lyrashield security gate
on:
  pull_request:
    paths:
      - "src/**"
      - "app/**"
      - "packages/**"
  push:
    branches: [main]

jobs:
  security:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      security-events: write
    steps:
      - name: LyraShield diff scan
        uses: ecryptoguru/lyrashield-ai@v2
        with:
          fail_on_severity: HIGH

Require the security job in branch protection. The runner-local Action uploads advisory SARIF annotations for changed files; it does not reproduce Pi’s hosted finding IDs or evidence states. Use a separate recorded scan when you need retained evidence and retest semantics. For workflow reuse, see GitHub Actions docs and for protocol context see Model Context Protocol.

6. Add project guidance for consistent secure coding

Add reviewed project guidance through the Pi mechanism your team already uses. Do not invent a canonical rules path when the project has not chosen one.

# Pi security rules

- Before finishing a feature, report the diff and wait for an explicitly requested, authorized LyraShield scan through Pi MCP or the CLI.
- Surface findings with their evidence states, CWE, file evidence and limitations.
- For high severity findings, have a developer review remediation guidance, apply the change, record the proposal through an approved surface and queue a retest.
- On PRs, ensure lyrashield security gate passed and SARIF uploaded.
- Reference OWASP Top 10 and internal vibe coding security guide in PR body when relevant.
- Never log or commit raw secrets. Keep LyraShield credentials in the CLI credential store.

This guidance encodes Target to Scan to Evidence State to Fix Proposal to Retest to Report as daily behavior. Store it through your chosen project guidance mechanism so new Pi sessions receive consistent guardrails. Teams that commit this file see identical verification across fresh clones, which reduces drift between what the local agent checks and what CI enforces later in the pull request.

Stage Pi agent behavior LyraShield contribution Proof artifact
Local generation Scaffolds API and UI from terminal prompts N/A Prompt plus diff
Local check Uses configured Pi MCP or waits for an explicit CLI check Findings with evidence states plus SCA plus secrets with file evidence Scan and finding identifiers
PR gate Pushes diff to GitHub Diff aware scan plus SARIF plus fail on high GitHub check and annotations
Fix loop Developer applies a reviewed remediation Recorded proposal plus server-owned retest Retest outcome and scan ref

Why pair Pi with LyraShield

Pi gives you terminal speed and tight control, but speed without verification raises risk. LyraShield adds findings with evidence states with evidence rather than speculative warnings, maps issues to OWASP Top 10 and CWE Top 25, gives dependency context via OSV database and keeps a repeatable CLI and CI loop beside the agent. The v1 scope stays honest: agentic pentest plus SCA plus secrets plus GitHub Action plus SARIF, with broader automation on the roadmap but not billed as live today. For Pi teams that ship often, this means fast local feedback plus mandatory PR protection, which is the simplest combination that preserves velocity while adding a clear evidence trail that reviewers trust.

Close by running AI app security checklist on the candidate build and confirming your workflow matches the Pi integration guide. When ready to evaluate managed scans, create an account at LyraShield AI and keep the required security check as your source of truth.

Frequently asked

Does Pi Coding Agent include native MCP support?

Yes. Pi includes built-in MCP over stdio and Streamable HTTP, with OAuth for hosted servers. Pi documents a user-level server file, a trusted project file and built-in OAuth sign-in.

How do I run LyraShield after Pi edits?

Use pi mcp add lyrashield --url https://app.lyrashieldai.com/api/mcp, then pi mcp login lyrashield. Confirm tools with pi mcp list and make a read-only call before any scan. CLI and CI remain optional alternatives.

Does this support PR gating?

Yes. Add the LyraShield GitHub Action, upload SARIF and require the security job in branch protection. The runner-local action remains distinct from a recorded hosted assessment.

Will LyraShield create Pi MCP configuration?

Follow /docs/integrations/pi for manual setup. Use pinned CLI commands for documented config or skill installs; marketplace plugins remain separately gated. Use CLI 0.2.14 and MCP 0.2.12 for local stdio, then verify discovery and a read-only client call.

Stay in the loop.

We store your email for product updates and scorecard notifications. No sharing, no marketing blasts.