Skip to content
LyraShield AIOpen beta

Connect Codebuff to LyraShield via MCP

A step by step workflow to configure LyraShield MCP in the Codebuff terminal agent using the CLI, verify the connection, run a scan, and gate pull requests.

LyraShield MCP integration with Codebuff
On this page

To connect Codebuff to LyraShield, run npx lyrashield install codebuff so the CLI writes the MCP server entry to .agents/mcp.json, then run npx lyrashield doctor to verify the connection and credentials. Codebuff is an open source terminal agent with a published agent store, and only stdio transport is documented for its MCP config. This workflow covers the install, manual fallback, verification, an inline check, a CI gate, and a rules snippet.

The vibe coding security guide separates generated code from the controls that enforce what it may do. Wiring LyraShield into Codebuff puts release assurance inside the terminal session, so a scan runs before a change reaches a pull request rather than only after. The steps below assume you have Node installed and an active LyraShield account.

Step Command or file Purpose
Prerequisites Node 20 plus, git, LyraShield account Prepare the environment
Install npx lyrashield install codebuff Write the MCP server entry
Manual path .agents/mcp.json Fallback if CLI is unavailable
Verify npx lyrashield doctor Check config and credentials
Inline check npx lyrashield scan Run a scan from the session
CI gate .github/workflows/lyrashield.yml Diff aware gate on pull requests

1. Meet the prerequisites

Install Node 20 or later, which the Node.js release guide covers. Confirm git is configured for your repository. Create a LyraShield account at lyrashieldai.com if you do not have one, because the MCP server needs credentials to authenticate. Run npx lyrashield login to store your credentials in ~/.lyrashield/credentials.json, which is not committed to version control.

Codebuff supports an agent store where published agents can be added to a project, and the CLI offers /init and /publish commands. Review any agent store entry before adding it, because a published agent can expose a write action or network call under an innocent name. Keep your credentials file outside the working tree, and never paste a token directly into a config file the agent can read.

2. Add the LyraShield MCP server

Run npx lyrashield install codebuff. The CLI writes the server entry to .agents/mcp.json with a root mcpServers key. Each entry holds command, args, and env, and only stdio transport is documented in the official guide. The Model Context Protocol specification defines the transport and tool exposure contract.

If the CLI is unavailable, add the entry manually. This is the manual path, and it is exactly what the CLI writes:

{
  "mcpServers": {
    "lyrashield": {
      "command": "npx",
      "args": ["-y", "@lyrashield/mcp", "stdio"],
      "env": { "LYRASHIELD_TOKEN": "lsk_YOUR_TOKEN" }
    }
  }
}

Keep the token in the env field as a reference to an environment variable when possible, not as a literal string. Commit .agents/mcp.json so the team shares the same server set, but keep any embedded secrets in environment variables referenced by env.

3. Verify the connection

Run npx lyrashield doctor. It checks that .agents/mcp.json is valid, the server entry is present, and your credentials resolve. If any check fails, the doctor reports the gap and the fix, so you can correct it before running a scan. A green doctor result means Codebuff can reach the LyraShield server and authenticate.

Restart your Codebuff session after editing the config file so the agent loads the new server entry. Confirm the LyraShield tools appear in the session. If the tools are missing, check the command and args spelling, the token, and whether the config file is in the project root. The doctor does not run a scan; it only confirms the wiring. If a check fails, the doctor names the file, the field, and the expected value, so you can fix the gap without reading the full config. Run the doctor again after each fix until every check is green, because a partial fix can leave the server reachable but unable to authenticate.

4. Run an inline security check

With the connection verified, run npx lyrashield scan from your project root. The scan targets the repository, reviews the code for candidate issues, and records evidence in an immutable assurance record. Detected issues stay in a detected state until independent verification confirms the behavior, so a finding is a prompt to investigate, not a verdict. Read each finding in the session, note the file and line, and decide whether the candidate reflects a real weakness or a false positive that deserves a recorded dismissal. The assurance record holds both the confirmed issues and the dismissed ones, so a reviewer can see the full set of decisions, not just the open items.

Review the scan output in the session. If a candidate issue is real, a fix proposal is generated for review. Approval gated fix proposals require a human review before a patch reaches a pull request, so a fix is never automatic. As of August 2026, LyraShield v1 covers agentic pentest, software composition analysis, secrets scanning, a GitHub Action, and SARIF output. Run the free AI app security checklist to see the full release review.

5. Gate pull requests with the GitHub Action

Add the LyraShield GitHub Action to your CI so every pull request is scanned. The action runs a diff aware gate, which means only changed code is scanned on each pull request, keeping the check fast enough to run on every push. Output is SARIF, which GitHub renders in the security tab. The GitHub Actions documentation covers workflow syntax and the GitHub SARIF integration explains how findings appear. Store the LyraShield token as a repository secret rather than a variable, so it stays encrypted and masked in logs. Set the diff aware flag to true so the action scans only the lines a pull request changes, which keeps the gate fast on large repositories and avoids re-scanning untouched code on every run.

Add a workflow file named lyrashield.yml under the .github/workflows directory:

name: LyraShield
on:
  pull_request:
    branches: [main]
jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: ecryptoguru/lyrashield-ai@v2
        with:
          fail_on_severity: HIGH

6. Add a rules snippet to AGENTS.md

Tell Codebuff to use LyraShield before proposing a fix. Add a line to AGENTS.md in your project root:

Run the LyraShield scan tool before proposing a fix. Do not apply a patch until a human reviews the fix proposal. Keep detected issues in a detected state until independent verification confirms the behavior.

A rules file states intent. The approval gate enforces it. A prompt can be changed in a pull request or ignored under pressure, but a server side gate that blocks a patch until a human binds it to an approval cannot be talked past. That is the difference between stating a policy and holding one. Require a security owner for changes to agent configuration, and include AGENTS.md in normal code review and branch protection. The Claude Code security workflow covers a related approach if your team uses multiple agents.

Why pair Codebuff with LyraShield

Codebuff accelerates implementation as an open source terminal agent. LyraShield AI provides release assurance through a loop of target, review, evidence, fix, retest, and report. The platform separates detection from proof: it flags candidate issues and keeps them in a detected state until independent verification confirms the behavior. An immutable assurance record captures what was checked, when, and with what result. Approval gated fix proposals require review before a patch reaches a pull request, so a fix is never automatic.

As of August 2026, LyraShield v1 covers agentic pentest, software composition analysis, secrets scanning, a GitHub Action with a diff aware gate, and SARIF output. Approval gated fix proposals are approval-gated fix proposals, not unattended fixes. The GitHub Action runs a diff aware gate so only changed code is scanned on each pull request. Create an account to start, or run the free AI app security checklist first. The Cursor app security checklist covers a related editor if your team uses multiple tools.

Frequently asked

How do I add the LyraShield MCP server to Codebuff

Run npx lyrashield install codebuff and the CLI writes the server entry to .agents/mcp.json with command, args, and env fields. Only stdio transport is documented for Codebuff.

Does Codebuff support remote MCP servers

Only stdio transport is documented in the official Codebuff guide. Use the local stdio package for the LyraShield server rather than a remote endpoint.

How do I verify the LyraShield connection works

Run npx lyrashield doctor after install. It checks that .agents/mcp.json is valid, the server entry is present, and your credentials resolve, then reports any gaps.

Can I gate pull requests with LyraShield in CI

Yes. Add the LyraShield GitHub Action to your workflow with the diff aware gate so only changed code is scanned on each pull request. Output is SARIF, which GitHub renders in the security tab.

Stay in the loop.

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