Skip to content

Add MCP Shield security scan#37

Open
thuggeelya wants to merge 6 commits into
hustcc:mainfrom
thuggeelya:add-mcp-shield-ci
Open

Add MCP Shield security scan#37
thuggeelya wants to merge 6 commits into
hustcc:mainfrom
thuggeelya:add-mcp-shield-ci

Conversation

@thuggeelya

@thuggeelya thuggeelya commented Mar 4, 2026

Copy link
Copy Markdown

Summary

Adds MCP Shield CI workflow for automated security scanning and security badge to README.
On every PR, the workflow posts a detailed comment with findings, affected tools, and recommendations.

Scan results

Score: 96/100 (Grade: A+)
22 checks | 19 passed | 0 failed | 2 warnings

Findings

⚠️ COMP-009 WARN — 2 field(s) missing constraints

  • generate_mermaid_diagram.mermaid: string without maxLength
  • generate_mermaid_diagram.backgroundColor: string without maxLength

⚠️ SEC-006 WARN — Found 1 non-idempotent operation(s) (CWE-352)

  • [medium] Non-idempotent operation: generate_mermaid_diagram

Recommendations

🟡 Add idempotency keys (1 found) — Add idempotency_key parameter to non-idempotent tools

Affected: generate_mermaid_diagram
🔵 Improve schemas (2 fields) — Add descriptions, maxLength, and pattern constraints to inputSchema fields
Affected: generate_mermaid_diagram.mermaid, generate_mermaid_diagram.backgroundColor


MCP Shield · Check reference

Comment thread .github/workflows/mcp-shield.yml Outdated
- run: npm ci
- run: npm run build
- uses: thuggeelya/mcp-shield-action@v1
with:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add to build.yml

- name: Build
run: npm run build

- name: MCP Shield scan

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only add this step, reduce the diff

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds MCP Shield security scanning to CI and exposes the scan grade in the README to make security posture more visible in the repo’s standard build pipeline.

Changes:

  • Adds MCP Shield scan step to the existing GitHub Actions build workflow.
  • Grants the workflow token permissions intended to allow posting scan findings back to PRs.
  • Adds an MCP Shield badge to the README header.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
README.md Adds an MCP Shield grade badge to the project header badges.
.github/workflows/build.yml Extends the build workflow to run MCP Shield and adds GITHUB_TOKEN permissions for PR commenting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/build.yml Outdated
Comment on lines +31 to +35
- name: MCP Shield scan
uses: thuggeelya/mcp-shield-action@v1
with:
server: 'node build/index.js'
sarif: 'false'

Copilot AI Mar 27, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow runs on both push and pull_request, but the MCP Shield step appears intended to post PR comments. Consider guarding this step with an if: github.event_name == 'pull_request' (or moving it to a PR-only workflow) to avoid failing or doing unnecessary work on push runs where no PR context exists.

Copilot uses AI. Check for mistakes.
npx vitest --watch=false

- name: MCP Shield scan
uses: thuggeelya/mcp-shield-action@v1

Copilot AI Mar 27, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uses: thuggeelya/mcp-shield-action@v1 pulls a moving tag from a third-party repository. For supply-chain hardening (especially with pull-requests: write), pin the action to an immutable commit SHA (optionally with a comment noting the corresponding release).

Suggested change
uses: thuggeelya/mcp-shield-action@v1
uses: thuggeelya/mcp-shield-action@c0ffee0000000000000000000000000000000000 # v1

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is my own action and I control the tag. SHA pinning would reduce readability

Comment on lines +12 to +14
permissions:
contents: read
pull-requests: write

Copilot AI Mar 27, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The job-level pull-requests: write permission applies to all steps in this job. If only the MCP Shield step needs write access, consider splitting it into a separate job (or separate workflow) so the build/test steps run with read-only permissions.

Copilot uses AI. Check for mistakes.
Comment thread README.md
@@ -1,4 +1,4 @@
# <img src="https://mermaid.js.org/favicon.svg" height="24"/> MCP Mermaid ![](https://badge.mcpx.dev?type=server 'MCP Server') [![build](https://github.com/hustcc/mcp-mermaid/actions/workflows/build.yml/badge.svg)](https://github.com/hustcc/mcp-mermaid/actions/workflows/build.yml) [![npm Version](https://img.shields.io/npm/v/mcp-mermaid.svg)](https://www.npmjs.com/package/mcp-mermaid) [![smithery badge](https://smithery.ai/badge/@hustcc/mcp-mermaid)](https://smithery.ai/server/@hustcc/mcp-mermaid) [![npm License](https://img.shields.io/npm/l/mcp-mermaid.svg)](https://www.npmjs.com/package/mcp-mermaid) [![Trust Score](https://archestra.ai/mcp-catalog/api/badge/quality/hustcc/mcp-mermaid)](https://archestra.ai/mcp-catalog/hustcc__mcp-mermaid)
# <img src="https://mermaid.js.org/favicon.svg" height="24"/> MCP Mermaid ![](https://badge.mcpx.dev?type=server 'MCP Server') [![build](https://github.com/hustcc/mcp-mermaid/actions/workflows/build.yml/badge.svg)](https://github.com/hustcc/mcp-mermaid/actions/workflows/build.yml) [![npm Version](https://img.shields.io/npm/v/mcp-mermaid.svg)](https://www.npmjs.com/package/mcp-mermaid) [![smithery badge](https://smithery.ai/badge/@hustcc/mcp-mermaid)](https://smithery.ai/server/@hustcc/mcp-mermaid) [![npm License](https://img.shields.io/npm/l/mcp-mermaid.svg)](https://www.npmjs.com/package/mcp-mermaid) [![Trust Score](https://archestra.ai/mcp-catalog/api/badge/quality/hustcc/mcp-mermaid)](https://archestra.ai/mcp-catalog/hustcc__mcp-mermaid) [![MCP Shield](https://img.shields.io/badge/MCP_Shield-A%2B_(96)-brightgreen)](https://github.com/thuggeelya/mcp-shield)

Copilot AI Mar 27, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MCP Shield badge encodes a specific grade/score ("A+ (96)") in the URL. This can become inaccurate as scan results change over time; consider using a badge source that reflects the latest workflow/scan status (or a non-scored badge) to avoid the README showing stale security information.

Suggested change
# <img src="https://mermaid.js.org/favicon.svg" height="24"/> MCP Mermaid ![](https://badge.mcpx.dev?type=server 'MCP Server') [![build](https://github.com/hustcc/mcp-mermaid/actions/workflows/build.yml/badge.svg)](https://github.com/hustcc/mcp-mermaid/actions/workflows/build.yml) [![npm Version](https://img.shields.io/npm/v/mcp-mermaid.svg)](https://www.npmjs.com/package/mcp-mermaid) [![smithery badge](https://smithery.ai/badge/@hustcc/mcp-mermaid)](https://smithery.ai/server/@hustcc/mcp-mermaid) [![npm License](https://img.shields.io/npm/l/mcp-mermaid.svg)](https://www.npmjs.com/package/mcp-mermaid) [![Trust Score](https://archestra.ai/mcp-catalog/api/badge/quality/hustcc/mcp-mermaid)](https://archestra.ai/mcp-catalog/hustcc__mcp-mermaid) [![MCP Shield](https://img.shields.io/badge/MCP_Shield-A%2B_(96)-brightgreen)](https://github.com/thuggeelya/mcp-shield)
# <img src="https://mermaid.js.org/favicon.svg" height="24"/> MCP Mermaid ![](https://badge.mcpx.dev?type=server 'MCP Server') [![build](https://github.com/hustcc/mcp-mermaid/actions/workflows/build.yml/badge.svg)](https://github.com/hustcc/mcp-mermaid/actions/workflows/build.yml) [![npm Version](https://img.shields.io/npm/v/mcp-mermaid.svg)](https://www.npmjs.com/package/mcp-mermaid) [![smithery badge](https://smithery.ai/badge/@hustcc/mcp-mermaid)](https://smithery.ai/server/@hustcc/mcp-mermaid) [![npm License](https://img.shields.io/npm/l/mcp-mermaid.svg)](https://www.npmjs.com/package/mcp-mermaid) [![Trust Score](https://archestra.ai/mcp-catalog/api/badge/quality/hustcc/mcp-mermaid)](https://archestra.ai/mcp-catalog/hustcc__mcp-mermaid) [![MCP Shield](https://img.shields.io/badge/MCP_Shield-status-brightgreen)](https://github.com/thuggeelya/mcp-shield)

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A badge with a specific score is the feature and one of the main motivators for maintainers. Status can say nothing

@hustcc

hustcc commented Mar 27, 2026

Copy link
Copy Markdown
Owner

@thuggeelya can help to fix the ci error?

@thuggeelya

thuggeelya commented Mar 27, 2026

Copy link
Copy Markdown
Author

@hustcc the build failed because GitHub has some limitations for fork-based PRs, such as mine. I've just fixed the action and the pipeline won't fail. And after the PR is merged, comments with reports will work on all future PRs since the workflow will run from your base repo ok?

@thuggeelya

Copy link
Copy Markdown
Author

@thuggeelya can help to fix the ci error?

@hustcc you can run ci

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants