Skip to content

VS Code MCP Security Workflow with Copilot

Add LyraShield MCP to VS Code for Copilot aware security checks findings with evidence states and diff aware GitHub Action gates

LyraShield MCP integration with VS Code
On this page

Follow the current vscode integration guide and manually merge the server entry, preserving existing settings. Authenticate local stdio separately with npx -y lyrashield@0.2.14 login --oauth and use @lyrashield/mcp@0.2.12. Use pinned CLI commands for documented config or skill installs; marketplace plugins remain separately gated. Restart the client, confirm discovery, then call lyrashield_list_workspaces for authenticated read-only access. CLI doctor does not establish client authentication or scan completion.

To add LyraShield security to VS Code, configure .vscode/mcp.json using servers key and inputs promptString for your lsk_ key, add stdio npx -y @lyrashield/mcp@0.2.12 and remote entries, verify in Copilot chat, then scan for OWASP risks inline and enforce a diff aware gate.

VS Code with Copilot generates code rapidly but inherits OWASP Top 10 risks such as injection and secrets. This workflow aligns VS Code with vibe coding security guide methodology, adding security check via MCP. LyraShield AI is agent native AppSec at LyraShield site, designed as Target to Scan to Evidence State to Fix Proposal to Retest to Report. See VS Code integration guide and Codex security workflow. Transport uses Model Context Protocol and GitHub Actions.

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.

You need Node 24 or newer for the LyraShield package, a current VS Code release with MCP support 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 are proposals requiring review, not hands off merges, after Sprints 0 to 2 shipped MCP contract. See VS Code integration guide.

2. Configure MCP server in vscode config file

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

{
  "servers": {
    "lyrashield": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@lyrashield/mcp@0.2.12"],
      "env": {
        "LYRASHIELD_API_KEY": "${input:lyrashield-key}"
      }
    },
    "lyrashield-remote": {
      "type": "http",
      "url": "https://app.lyrashieldai.com/api/mcp",
      "headers": {
        "Authorization": "Bearer ${input:lyrashield-key}"
      }
    }
  },
  "inputs": [
    {
      "id": "lyrashield-key",
      "type": "promptString",
      "description": "LyraShield API key starting with lsk_",
      "password": true
    }
  ]
}

Placeholder ${input:lyrashield-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 VS Code 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 vscode

Restart vscode 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. Run npx -y @lyrashield/mcp@0.2.12 manually in terminal with LYRASHIELD_API_KEY set to confirm handshake JSON prints. This isolates IDE versus Node issues.

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 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.

LyraShield preserves each finding’s evidence state and supports a server-owned retest after the developer applies a fix. The MCP workflow can generate and record a fix proposal, but it does not create a branch or pull request. Poll the retest to a terminal state and include its outcome and scan reference in the PR. See NIST SSDF for verifiable remediation and CWE Top 25 for classification.

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 Codex security workflow 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 does not comment or propose a branch. Use VS Code integration guide for authenticated MCP setup and NIST SSDF for build-integrity context.

6. Add agent rules for continuous guardrails

vscode 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 evidence states with 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 Codex security workflow and CWE Top 25 for taxonomy.

Why pair vscode with LyraShield

Vscode 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. 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. 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 vscode 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 vscode workflow, bringing findings with evidence states, proposals requiring review and retest evidence into existing loop without claiming hands off merges.

Frequently asked

How does LyraShield MCP work with Vscode?

It exposes scan targets findings with 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 VS Code read MCP config from?

VS Code reads workspace MCP servers from .vscode/mcp.json under the top-level servers key. Open the user MCP configuration from the command palette for profile-local servers.

Stay in the loop.

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