Skip to content

Cursor MCP Security Workflow for AI Built Apps

Set up LyraShield MCP in Cursor to scan AI built code for injection secrets and supply chain risks with findings with recorded evidence states and GitHub gate

LyraShield MCP integration with Cursor
On this page

Current setup: follow the Cursor integration guide with pinned @lyrashield/mcp@0.2.12 and authenticate local stdio separately using npx -y lyrashield@0.2.14 login --oauth. The Agent Plugin package 0.1.31 is published; its public listing and authenticated client runtime acceptance remain pending. Use pinned CLI commands for documented config or skill installs; marketplace plugins remain separately gated. Confirm client discovery, then make an authenticated read-only workspace call.

To secure Cursor built apps with LyraShield, add the LyraShield MCP server via stdio using npx -y @lyrashield/mcp@0.2.12 with the local CLI credential store and optionally remote endpoint with Bearer lsk_ key, verify the connection in Cursor Settings, then run targeted scans for injection, auth flaws, secrets and supply chain issues inline while coding.

Vibe coding in Cursor ships features quickly, but speed can recreate classic OWASP Top 10 risks like injection, broken auth and hardcoded secrets. This workflow applies the vibe coding security guide method to daily Cursor use. LyraShield AI is agent native AppSec at LyraShield site, designed around Target to Scan to Evidence State to Fix Proposal to Retest to Assurance Report. You get inline evidence review while agent edits. See Cursor integration guide and checklist Cursor security checklist. Transport uses Model Context Protocol and GitHub Actions plus NIST SSDF. Findings retain their recorded evidence states. Current LyraShield tools record fix proposals and queue retests but do not edit code, create branches or open pull requests.

1. Prerequisites and api key setup

Create LyraShield API key starting with lsk_ and store as LYRASHIELD_API_KEY. Never commit key to source control or chat logs. For local work, export it in shell profile. For teams, keep it in secret manager and add to GitHub repository secrets for CI parity. Naming consistency between shell, IDE config and CI reduces misconfig.

You need Node 24 or newer for the LyraShield package, a current Cursor release and a testable target such as http://localhost:3000 or a repo root. LyraShield MCP supports stdio via npx -y @lyrashield/mcp@0.2.12 and remote HTTP at remote MCP endpoint using Bearer lsk_ key. Stdio keeps traffic local, remote enables central policy.

Review CWE Top 25 and OWASP Top 10 to map checks to weaknesses your team tracks and NIST SSDF for secure build. LyraShield v1 is designed to cover agentic pentest plus SCA and secrets with SARIF output. Fix proposals record intended remediation for human review, not hands off merges, after Sprints 0 to 2 shipped MCP contract. See Cursor integration guide.

2. Configure MCP server in cursor config file

cursor reads MCP from .cursor/mcp.json. Top level key is mcpServers. Include stdio and remote to switch without code edits. Use pinned npx -y @lyrashield/mcp@0.2.12 for stdio.

{
  "mcpServers": {
    "lyrashield": {
      "command": "npx",
      "args": ["-y", "@lyrashield/mcp@0.2.12"],
      "env": {
        "LYRASHIELD_API_KEY": "${env:LYRASHIELD_API_KEY}"
      }
    },
    "lyrashield-remote": {
      "url": "https://app.lyrashieldai.com/api/mcp",
      "headers": {
        "Authorization": "Bearer ${env:LYRASHIELD_API_KEY}"
      }
    }
  }
}

Placeholder ${env:LYRASHIELD_API_KEY} is resolved securely without writing secret to disk. Remote validates Bearer lsk_ at remote MCP endpoint. Do not commit real values, commit placeholder only and document setup in Cursor integration guide onboarding. For multiple projects, keep personal keys in global config and team policy in project file. See Model Context Protocol and GitHub Actions for parity.

3. Verify the connection inside cursor

Restart cursor after saving config and open MCP servers view to confirm lyrashield shows connected with tools. In chat ask to list MCP tools to see scan tool. This confirms handshake completed.

If disconnected, open log panel. For 401 from remote MCP endpoint reissue key. For npx not found or EACCES fix Node PATH or install via nvm user space. Inspect Cursor’s MCP logs for process and connection errors. The stdio package expects an MCP client; a standalone launch does not print handshake proof. For local access failures, repeat pinned CLI OAuth login and reload Cursor, then verify an authenticated read.

Verification prevents silent failure where agent assumes scan succeeded but server was unreachable. That leaves OWASP Top 10 risks undetected and breaks verification loop. Allow egress to remote MCP endpoint if org blocks external.

4. Run a security check inline while you code

With MCP connected, prompt agent to scan current target before committing. Example prompt is scan target http://localhost:3000 for injection and secrets using LyraShield and return findings with recorded evidence states only with file paths and CWE.

Agent calls MCP tool and returns file, line, evidence snippet or reproduction notes and remediation pointers that reference OWASP Top 10. For injection it shows untrusted input flowing into query without validation. For secrets it shows detected key pattern in source. For supply chain it maps lock entries against OSV database.

Use lyrashield_record_fix_proposal to record the intended remediation. After a developer applies the change, call lyrashield_verify_fix to queue a retest, then poll lyrashield_get_scan_status. A clean deterministic retest may be retest-confirmed.

Check type What to scan How to fix
Injection API routes concatenating user input into queries Parameterize queries, validate with schema, enforce allow lists at boundary
Secrets Env example containing real keys, tokens in source Remove secret, rotate credential, add precommit scan, use secret manager
Auth Missing role check on sensitive routes, permissive CORS Add auth middleware, test unauthenticated request, set secure cookie flags
Supply chain Vulnerable npm packages with CVE in lockfile Update lockfile, pin safe version, check OSV database advisory, limit scripts

Use table as prompt template for consistent scans. Reference Cursor security checklist for deeper checklist.

5. Wire the GitHub Action diff aware gate

Local checks improve speed, but team assurance needs CI gate scanning changed files on pull requests and publishing SARIF for triage. LyraShield provides GitHub Action that runs diff aware scan and uploads SARIF. Uses GitHub Actions and aligns with OWASP Top 10 pipeline guidance.

name: LyraShield Security Gate
on:
  pull_request:
    branches: [main]
jobs:
  security:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      security-events: write
      pull-requests: write
    steps:
      - name: Run LyraShield diff scan
        uses: ecryptoguru/lyrashield-ai@v2
        with:
          fail_on_severity: HIGH

The runner-local Action needs no LyraShield API key. It emits and uploads SARIF, but it does not edit code, record a fix proposal or create a branch.

6. Add agent rules for continuous guardrails

cursor supports project rules that agent reads each task, baking security into definition of done without relying on memory. Add rule forcing LyraShield scan before marking feature complete, covering user input, auth, file upload, secrets or external fetch and include retest.

Location varies. Cursor uses .cursor/rules/security.mdc with globs, Claude Code uses CLAUDE.md, Windsurf uses .windsurf/rules/security.md, VS Code uses .github/copilot-instructions.md, JetBrains uses .jetbrains/ai-assistant/rules/security.md. Choose location traveling with repo so new clones get same expectation.

# Security guardrail

For any task involving user input, auth, file upload or secrets:

1. Call LyraShield MCP scan on target .
2. List findings with their recorded evidence states, file and CWE
3. Propose remediation with code edit
4. Ensure .env.example has placeholders only
5. Retest via LyraShield after fix

Test rule by scaffolding endpoint accepting query param and confirming scan triggers without reminder. If agent skips, make rule more directive and place file where agent reads on startup. Keep rule short and committed. Pair with Cursor security checklist and CWE Top 25 for taxonomy.

Why pair cursor with LyraShield

Cursor speeds AI development but can repeat patterns OWASP Top 10 warns about such as trusting generated SQL or leaving debug endpoints enabled. LyraShield adds verification without changing UX, exposing scan and findings as native tools agent knows how to call.

The current product ships MCP, bounded scans, findings and evidence, approval-gated fix proposals, retests, reports, SCA, secrets and the runner-local SARIF gate. The local Action is advisory and does not create hosted evidence states; use a recorded scan and retest when assurance evidence is required. Advisory dependency matches use OSV data and still require resolved-version review.

Local feedback plus CI gate creates defense in depth matching how AI apps evolve, many small edits per hour. For policy framing revisit vibe coding security guide and NIST SSDF.

Close loop by tracking findings as tasks, rerunning scans after fixes to confirm resolution and ensuring SARIF appears in GitHub code scanning with file and line mapping. Run AI app security checklist before launch to cover injection, auth, secrets, headers and supply chain in one pass.

When ready to centralize results across cursor sessions and pull requests with dashboards and retention, create an account at LyraShield AI to centralize findings with dashboards and retention. LyraShield is designed to grow with your cursor workflow, bringing findings with recorded evidence states, proposals requiring review and retest evidence into existing loop without claiming hands off merges.

Frequently asked

How does LyraShield MCP work with Cursor?

It exposes scan targets findings with recorded evidence states and fix guidance via MCP tools so the agent can request a security check inline without leaving the IDE.

Does this replace the GitHub Action gate?

No. IDE checks give fast feedback while the GitHub Action provides a diff aware merge gate with SARIF output for team review.

What API key does remote MCP use?

A Bearer key starting with lsk_ issued from LyraShield. Set it as LYRASHIELD_API_KEY for remote https://app.lyrashieldai.com/api/mcp.

Where does Cursor read MCP config from?

Cursor reads MCP servers from .cursor/mcp.json at the project root. The top level key is mcpServers. Use the project file for the LyraShield entry so the team shares one server definition and keep real keys in environment variables referenced by the env block.

Stay in the loop.

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