Elffuss BraidHub

kikocis/continue public

docs: add Snyk MCP + Continue Hub cookbook (#7843)

* docs: add Snyk + Continue Hub Agent cookbook and wire into nav\n\nGenerated with [Continue](https://continue.dev)\n\nCo-Authored-By: Continue <noreply@continue.dev>

* docs: fix code fences for prompts in guide cards\n\nGenerated with [Continue](https://continue.dev)\n\nCo-Authored-By: Continue <noreply@continue.dev>

* docs: add icon to IaC Compliance card\n\nGenerated with [Continue](https://continue.dev)\n\nCo-Authored-By: Continue <noreply@continue.dev>

* docs: link Rules deep dive from Security Guardrails section\n\nGenerated with [Continue](https://continue.dev)\n\nCo-Authored-By: Continue <noreply@continue.dev>

* docs: link Plan Mode guide in tip\n\nGenerated with [Continue](https://continue.dev)\n\nCo-Authored-By: Continue <noreply@continue.dev>

* docs: format Connection Problems verification steps as a list\n\nGenerated with [Continue](https://continue.dev)\n\nCo-Authored-By: Continue <noreply@continue.dev>

* docs: convert Connection Problems verification steps to markdown list\n\nGenerated with [Continue](https://continue.dev)\n\nCo-Authored-By: Continue <noreply@continue.dev>

* docs: make What You’ve Built section a list\n\nGenerated with [Continue](https://continue.dev)\n\nCo-Authored-By: Continue <noreply@continue.dev>

* docs: revert What You’ve Built bullets to inline checks\n\nGenerated with [Continue](https://continue.dev)\n\nCo-Authored-By: Continue <noreply@continue.dev>

* docs: change What You’ve Built to a bulleted list (per review)\n\nGenerated with [Continue](https://continue.dev)\n\nCo-Authored-By: Continue <noreply@continue.dev>

* docs: add Understanding Agents (Hub) as a prerequisite\n\nGenerated with [Continue](https://continue.dev)\n\nCo-Authored-By: Continue <noreply@continue.dev>

* fix: update list

* fix(docs): improve security guardrails card layout in Snyk cookbook

- Remove CardGroup cols={2} to prevent text truncation
- Display security guardrail cards in single column layout
- Fix malformed code block syntax in Dependency Safety card
- Ensure full visibility of 'When adding/updating dependency' text

Generated with [Continue](https://continue.dev)

Co-Authored-By: Continue <noreply@continue.dev>

---------

Co-authored-by: Continue <noreply@continue.dev>
Changeset0e7d07cb2a2884e6d321d29dc5d51c0943e4e11ee526843399a6026764cb7583
AuthorBrian Douglas <bdougie@users.noreply.github.com> · 2025-09-23 15:03 -07:00
CommitterGitHub <noreply@github.com> · 2025-09-23 15:03 -07:00
Parents073c4a0e1867

Browse the files at this changeset

3 files changed

modified docs/docs.json +1 −0
@@ -233,6 +233,7 @@
233233 "guides/codebase-documentation-awareness",
234234 "guides/cli",
235235 "guides/continuous-ai",
236+ "guides/snyk-mcp-continue-cookbook",
236237 "guides/continuous-ai-readiness-assessment",
237238 "guides/plan-mode-guide",
238239 "guides/ollama-guide",
modified docs/guides/overview.mdx +1 −0
@@ -21,6 +21,7 @@
2121
2222 - [PostHog Session Analysis Cookbook](/guides/posthog-github-continuous-ai) - Analyze user behavior data to optimize your codebase with automatic issue creation
2323 - [Netlify Performance Optimization Cookbook](/guides/netlify-mcp-continuous-deployment) - Optimize web performance with A/B testing and automated monitoring using Netlify MCP
24+- [Snyk + Continue Hub Agent Cookbook (MCP)](/guides/snyk-mcp-continue-cookbook) - Integrate Snyk MCP via Continue Hub to scan code, deps, IaC, and containers
2425
2526 ## What Advanced Tutorials Are Available
2627
added docs/guides/snyk-mcp-continue-cookbook.mdx +404 −0
@@ -0,0 +1,404 @@
1+---
2+title: "Automated Security Scanning with Snyk MCP and Continue"
3+description: "Set up an AI-powered security workflow that automatically scans your code, dependencies, infrastructure, and containers using natural language commands."
4+sidebarTitle: "Snyk Security Scanning with Continue"
5+---
6+
7+<Card title="What You'll Build" icon="shield-halved">
8+ An automated security scanning system that uses Continue's AI agent with Snyk
9+ MCP to identify vulnerabilities in code, dependencies, infrastructure, and
10+ containers - all through simple natural language prompts
11+</Card>
12+
13+## Prerequisites
14+
15+Before starting, ensure you have:
16+
17+- Continue account with **Hub access**
18+- Read: [Understanding Agents — How to get started with Hub agents](/guides/understanding-agents#how-to-get-started-with-hub-agents)
19+- Node.js 18+ installed locally
20+- [Snyk account](https://snyk.io/) (free tier works)
21+- A local project to scan for vulnerabilities
22+
23+<Steps>
24+ <Step title="Connect Snyk MCP via Continue Hub">
25+ Visit the [Snyk MCP on Continue Hub](https://hub.continue.dev/snyk/snyk-mcp) and click **Install** to add it to your Continue account.
26+
27+ This will add Snyk MCP to your agent's available tools. The Hub listing automatically configures the MCP command:
28+ ```bash
29+ npx -y snyk@latest mcp -t stdio
30+ ```
31+
32+ <Tip>
33+ **Alternative installation methods:**
34+ 1. **Quick CLI install**: `cn -p --mcp snyk/snyk-mcp`
35+ 2. **Manual configuration**: Add the MCP to your `~/.continue/config.json` under the `mcpServers` section
36+
37+ Once installed, Snyk MCP tools become available to your Continue agent for all prompts.
38+ </Tip>
39+
40+ <Info>
41+ The MCP will request authentication and folder trust permissions when first used.
42+ This is handled automatically by the Continue agent.
43+ </Info>
44+
45+ </Step>
46+
47+ <Step title="Add Secure-at-Inception Rules">
48+ Install the [Snyk Secure-at-Inception rules](https://hub.continue.dev/snyk/secure-at-inception) from the Hub to enable automatic security scanning.
49+
50+ **How to add rules to your agent:**
51+ 1. Visit the rules link above and click **Install**
52+ 2. The rules will be added to your agent configuration automatically
53+ 3. Rules apply globally to all your Continue sessions
54+
55+ These rules configure your agent to:
56+ - **Run [SAST](https://snyk.io/learn/application-security/sast/) scans** on newly generated or modified code
57+ - **Check dependencies** when adding or updating packages
58+ - **Auto-fix issues** using Snyk's recommendations, then rescan
59+
60+ </Step>
61+
62+ <Step title="Authenticate with Snyk">
63+ Use this prompt with your Continue agent to set up authentication:
64+
65+ ```
66+ Check Snyk auth status. If not authenticated, authenticate me and confirm my org context.
67+ ```
68+
69+ Or use the Continue CLI:
70+ ```bash
71+ cn -p "Check Snyk auth status. If not authenticated, authenticate me and confirm my org context."
72+ ```
73+
74+ <Tip>
75+ A browser window will open for Snyk login. After authenticating, approve
76+ the request to trust your project folder when prompted.
77+ </Tip>
78+
79+ </Step>
80+</Steps>
81+
82+## Security Scanning Recipes
83+
84+Now you can use natural language prompts to run comprehensive security scans. The Continue agent automatically calls the appropriate Snyk MCP tools.
85+
86+<Info>
87+ **Where to run these workflows:**
88+ - **IDE Extensions**: Use Continue in VS Code, JetBrains, or other supported IDEs
89+ - **Terminal (TUI mode)**: Run `cn` to enter interactive mode, then type your prompts
90+ - **CLI (headless mode)**: Use `cn -p "your prompt"` for one-off commands
91+
92+ **Test in Plan Mode First**: Before running security scans that might make
93+ changes, test your prompts in plan mode (see the [Plan Mode
94+ Guide](/guides/plan-mode-guide); press **Shift+Tab** to switch modes in TUI/IDE). This
95+ shows you what the agent will do without executing it. For example: `"Run a
96+ Snyk Code scan and fix the top 3 issues"`
97+</Info>
98+
99+### Code Vulnerability Scanning ([SAST](https://snyk.io/learn/application-security/sast/))
100+
101+<Card title="Static Application Security Testing" icon="code">
102+ Scan your source code for security vulnerabilities and code quality issues.
103+
104+**Example prompt:**
105+```
106+Run a Snyk Code scan on this repo with severity threshold medium.
107+Summarize issues with file:line. Propose minimal diffs for the top 3
108+and rerun to verify.
109+```
110+
111+**Using Continue CLI:**
112+```bash
113+cn -p "Run a Snyk Code scan on this repo with severity threshold medium. Summarize issues with file:line. Propose minimal diffs for the top 3 and rerun to verify."
114+```
115+
116+</Card>
117+
118+### Dependency Scanning ([SCA](https://snyk.io/learn/software-composition-analysis-sca/))
119+
120+<Card title="Software Composition Analysis" icon="cube">
121+ Check open source dependencies for known vulnerabilities.
122+
123+**Example prompt:**
124+```
125+Run Snyk Open Source on this repo (include dev deps).
126+Summarize vulnerable paths and propose a minimal-risk upgrade plan.
127+Re-test after the plan (dry run).
128+```
129+
130+**Using Continue CLI:**
131+```bash
132+cn -p "Run Snyk Open Source on this repo (include dev deps). Summarize vulnerable paths and propose a minimal-risk upgrade plan. Re-test after the plan (dry run)."
133+```
134+
135+</Card>
136+
137+### Infrastructure as Code ([IaC](https://snyk.io/learn/infrastructure-as-code-iac/))
138+
139+<Card title="IaC Security" icon="cloud">
140+ Scan Terraform, CloudFormation, and Kubernetes configs for misconfigurations.
141+
142+**Example prompt:**
143+```
144+Scan ./infra with Snyk IaC. Report high/critical misconfigs
145+with exact files/lines. Provide code changes and re-scan to confirm.
146+```
147+
148+**Using Continue CLI:**
149+```bash
150+cn -p "Scan ./infra with Snyk IaC. Report high/critical misconfigs with exact files/lines. Provide code changes and re-scan to confirm."
151+```
152+
153+</Card>
154+
155+### Container Scanning
156+
157+<Card title="Container Security" icon="docker">
158+ Analyze Docker images for vulnerabilities in base images and packages.
159+
160+**Example prompt:**
161+```
162+Scan image my-api:latest. Exclude base image vulns.
163+Print dependency tree. Recommend a safer base image or upgrades.
164+Re-test after the change (dry run).
165+```
166+
167+**Using Continue CLI:**
168+```bash
169+cn -p "Scan image my-api:latest. Exclude base image vulns. Print dependency tree. Recommend a safer base image or upgrades. Re-test after the change (dry run)."
170+```
171+
172+</Card>
173+
174+### Pull Request Scanning
175+
176+<Card title="Changed Files Only" icon="code-branch">
177+ Focus scanning on modified files to catch issues before merging.
178+
179+**Example prompt:**
180+```
181+Scan only files changed since origin/main with Snyk Code.
182+Block if new high issues would be introduced. Show deltas.
183+```
184+
185+**Using Continue CLI:**
186+```bash
187+cn -p "Scan only files changed since origin/main with Snyk Code. Block if new high issues would be introduced. Show deltas."
188+```
189+
190+</Card>
191+
192+### Security Learning
193+
194+<Card title="Snyk Learn Integration" icon="graduation-cap">
195+ Access security education resources based on identified vulnerabilities ([CWE](https://cwe.mitre.org/)).
196+
197+**Example prompt:**
198+```
199+Open Snyk Learn lessons related to the top CWE(s) from this scan.
200+```
201+
202+**Using Continue CLI:**
203+```bash
204+cn -p "Open Snyk Learn lessons related to the top CWE(s) from this scan."
205+```
206+
207+</Card>
208+
209+## Continuous Security with GitHub Actions
210+
211+This example demonstrates a **Continuous AI workflow** where security scanning runs automatically in your CI/CD pipeline using Continue CLI in headless mode (`cn -p`) with Snyk MCP.
212+
213+### Add GitHub Secrets
214+
215+Navigate to **Repository Settings → Secrets and variables → Actions** and add:
216+
217+- `CONTINUE_API_KEY`: Your Continue API key from [hub.continue.dev/settings/api-keys](https://hub.continue.dev/settings/api-keys)
218+
219+### Create Workflow File
220+
221+Create `.github/workflows/snyk-security.yml` in your repository:
222+
223+```yaml
224+name: Security Scanning with Snyk MCP
225+
226+on:
227+ pull_request:
228+ branches: [main]
229+ push:
230+ branches: [main]
231+ schedule:
232+ - cron: "0 8 * * *" # Daily at 8 AM UTC
233+
234+jobs:
235+ security-scan:
236+ runs-on: ubuntu-latest
237+
238+ steps:
239+ - uses: actions/checkout@v4
240+
241+ - name: Set up Node.js
242+ uses: actions/setup-node@v4
243+ with:
244+ node-version: "18"
245+
246+ - name: Install Continue CLI
247+ run: |
248+ npm install -g @continuedev/cli
249+ echo "✅ Continue CLI installed"
250+
251+ - name: Authenticate Continue CLI
252+ run: |
253+ cn auth login --api-key "${{ secrets.CONTINUE_API_KEY }}"
254+ echo "✅ Continue CLI authenticated"
255+
256+ - name: Run Security Scans
257+ run: |
258+ echo "🔍 Running code vulnerability scan..."
259+ cn -p "Run Snyk Code scan with severity high on this repo.
260+ Fail if any high issues are present."
261+
262+ echo "📦 Checking dependencies..."
263+ cn -p "Run Snyk Open Source on this repo.
264+ Fail on fixable high issues."
265+
266+ - name: Generate Security Report
267+ if: always()
268+ run: |
269+ cn -p "Generate a markdown security report summarizing:
270+ - Total vulnerabilities by severity
271+ - Top 3 critical issues (if any)
272+ - Recommended next steps
273+ Save to security-report.md"
274+
275+ - name: Upload Security Report
276+ uses: actions/upload-artifact@v4
277+ if: always()
278+ with:
279+ name: security-report-${{ github.run_number }}
280+ path: security-report.md
281+ retention-days: 30
282+```
283+
284+<Info>
285+ The Snyk MCP authentication is handled through Continue Hub. No need to manage
286+ Snyk tokens directly in CI - the agent manages authentication.
287+</Info>
288+
289+## Security Guardrails
290+
291+Implement automated security policies using Continue's rule system. See the [Rules deep dive](/customize/deep-dives/rules) for authoring tips.
292+
293+<Note>
294+ **Coming Soon**: These security guardrail prompts will be available as pre-configured rules on the Continue Hub for easy installation.
295+</Note>
296+
297+<Card title="Pre-commit Scanning" icon="lock">
298+ ```bash
299+ "Always run Snyk Code before committing newly
300+ generated code; refuse to proceed if high
301+ issues remain."
302+ ```
303+</Card>
304+
305+<Card title="Dependency Safety" icon="shield-check">
306+ ```bash
307+ "When adding/updating a dependency, run Snyk Open Source, choose the
308+ lowest-risk upgrade, and re-test."
309+ ```
310+</Card>
311+
312+<Card title="Container Hardening" icon="box">
313+ ```bash
314+ "Before building containers, scan base images and recommend
315+ security-hardened alternatives."
316+ ```
317+</Card>
318+
319+<Card title="IaC Compliance" icon="clipboard-list">
320+ ```bash
321+ "Scan all Terraform changes for compliance
322+ violations before applying infrastructure."
323+ ```
324+</Card>
325+
326+<Tip>
327+ Enable the **Secure-at-Inception** rules from the Hub to automatically apply
328+ these guardrails to all code generation and modifications.
329+</Tip>
330+
331+## Troubleshooting
332+
333+### Authentication Issues
334+
335+```bash
336+"Check Snyk auth status and current org. If not authenticated,
337+help me authenticate. Then run a quick Code scan on ./
338+with severity medium and print one example issue."
339+```
340+
341+### Fix Validation
342+
343+```bash
344+"Propose minimal diffs only in affected files,
345+then rerun the same Snyk scan to confirm resolution."
346+```
347+
348+### Connection Problems
349+
350+<Check>
351+ **Verification Steps:** - Snyk MCP is installed via [Continue
352+ Hub](https://hub.continue.dev/snyk/snyk-mcp) - Secure-at-Inception rules are
353+ [enabled](https://hub.continue.dev/snyk/secure-at-inception) - Authentication
354+ completed successfully - Project folder has been trusted
355+</Check>
356+
357+## What You've Built
358+
359+After completing this guide, you have a complete **AI-powered security system** that:
360+
361+✅ Uses natural language — Simple prompts instead of complex CLI commands
362+✅ Fixes automatically — AI suggests and validates security fixes
363+✅ Runs continuously — Automated scanning in CI/CD pipelines
364+✅ Enforces guardrails — Security rules prevent vulnerable code from shipping
365+
366+<Card title="Continuous AI" icon="rocket">
367+ Your security workflow now operates at **[Level 2 Continuous
368+ AI](https://blog.continue.dev/what-is-continuous-ai-a-developers-guide/)** -
369+ AI handles routine security scanning and remediation with human oversight
370+ through review and approval of fixes.
371+</Card>
372+
373+## Next Steps
374+
375+1. **Run your first scan** - Try the [SAST](https://snyk.io/learn/application-security/sast/) prompt on your current project
376+2. **Review findings** - Analyze the security report and implement fixes
377+3. **Set up CI pipeline** - Add the GitHub Actions workflow to your repo
378+4. **Customize rules** - Add project-specific security policies
379+5. **Monitor trends** - Track [vulnerability](https://snyk.io/learn/security-vulnerability/) reduction over time
380+
381+## Additional Resources
382+
383+<CardGroup cols={2}>
384+ <Card title="Snyk Documentation" icon="book" href="https://docs.snyk.io">
385+ Complete Snyk platform documentation
386+ </Card>
387+ <Card title="Continue Hub" icon="plug" href="https://hub.continue.dev">
388+ Explore more MCP integrations and agents
389+ </Card>
390+ <Card
391+ title="Security Best Practices"
392+ icon="shield"
393+ href="https://snyk.io/learn"
394+ >
395+ Learn about secure coding practices
396+ </Card>
397+ <Card
398+ title="MCP Concepts"
399+ icon="puzzle-piece"
400+ href="https://docs.snyk.io/integrations/developer-guardrails-for-agentic-workflows"
401+ >
402+ Understanding MCP architecture
403+ </Card>
404+</CardGroup>