CodeGuard MCP Server
Delivers centralized security rules and instructions to GitHub Copilot, allowing for consistent security policy enforcement across repositories without manual file maintenance.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@CodeGuard MCP Serverget security rules for password hashing in Python"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
CodeGuard MCP Server
Security rules for AI code generation via Model Context Protocol.
Built upon Project CodeGuard: This MCP server integrates the comprehensive security instruction rules from Project CodeGuard, solving scaling and central governance challenges by delivering them via Model Context Protocol instead of per-repository file duplication.
What is this?
GitHub Copilot can use .github/instructions/ files for security rules, but this sucks for orgs:
22+ files duplicated in every repo
No central control
Pain to update
This MCP server centralizes all security rules in one place.
Related MCP server: RulesetMCP
Quick Start
1. Install Package
npm install -g @isagasi/codeguard-mcp-server2. Configure VS Code
Windows:
# Get the global npm modules path
$npmPath = npm root -g
$serverPath = Join-Path $npmPath "@isagasi\codeguard-mcp-server\dist\index.js"
# Create configuration using node with args for reliable stdio
$config = @"
{
"servers": {
"codeguard": {
"type": "stdio",
"command": "node",
"args": ["$($serverPath -replace '\\', '\\\\')"],
"autoStart": true
}
}
}
"@
[System.IO.File]::WriteAllText("$env:APPDATA\Code\User\mcp.json", $config, (New-Object System.Text.UTF8Encoding $false))
Write-Host "✓ mcp.json created at: $env:APPDATA\Code\User\mcp.json"macOS/Linux:
# Get the global npm modules path
NPM_PATH=$(npm root -g)
SERVER_PATH="$NPM_PATH/@isagasi/codeguard-mcp-server/dist/index.js"
# Create configuration using node with args for reliable stdio
cat > ~/Library/Application\ Support/Code/User/mcp.json << EOF
{
"servers": {
"codeguard": {
"type": "stdio",
"command": "node",
"args": ["$SERVER_PATH"],
"autoStart": true
}
}
}
EOF
echo "✓ mcp.json created"3. Install Auto-Starter
code --install-extension alankyshum.vscode-mcp-autostarter4. Reload VS Code
Press Ctrl+Shift+P → "Developer: Reload Window"
5. Verify Setup
Ctrl+Shift+P → "MCP: List Servers" → Should show codeguard running ✅
Done! Server is now active and will auto-start with VS Code.
6. Sanity Test (Recommended)
Verify the MCP server is actually being invoked by Copilot:
Test 1: Password Hashing
@workspace Generate a Python function to hash a passwordExpected: Copilot should generate code using bcrypt or Argon2 (not MD5 or SHA1)
Test 2: Database Query
@workspace Create a PostgreSQL query function in Node.jsExpected: Code should use parameterized queries, not string concatenation
Test 3: API Key Storage
@workspace Show how to store an API key in a Python appExpected: Should suggest environment variables (os.getenv), not hardcoded strings
If Copilot generates insecure code (MD5 passwords, SQL injection, hardcoded keys), the MCP server may not be loaded. Retry steps 4-5.
How it Works
The server provides 23 default security instruction files + 3 custom org rules:
Crypto rules (no MD5, use Argon2/bcrypt)
Auth/authz best practices
Input validation, SQL injection prevention
API security, logging, container hardening
Custom rules can override defaults
Copilot Chat can query these via MCP tools when generating code.
Custom Rules
Add org-specific rules in rules/custom/:
---
applyTo: '**/*.ts'
description: Company API Standards
---
# API Standards
All REST endpoints must:
- Use company error format
- Log to ELK stack
- Rate limit: 100 req/minCustom rules get +25 priority and override defaults.
Maintenance
Update to latest version:
npm update -g @isagasi/codeguard-mcp-server
# Then reload VS CodePublishing new versions (Maintainers):
Update version:
npm version patch(1.0.8 → 1.0.9)Push tags:
git push --follow-tagsWorkflow auto-publishes to npm ✅
Troubleshooting
Server not running:
Check:
Ctrl+Shift+P→ "MCP: List Servers"Should see
codeguardwith status "running"If not listed, verify mcp.json path and reload VS Code
Error: spawn ENOENT or spawn EINVAL:
This means the command path is incorrect or the binary wrapper isn't compatible
Use the
nodewithargsconfiguration shown in Step 2 (notcodeguard-mcpcommand)The MCP protocol requires clean stdio - using
nodedirectly ensures compatibility
View server logs:
Open VS Code: View → Output
Select "MCP Auto-Starter" from dropdown
Check for startup errors or protocol violations
Reinstall package:
npm uninstall -g @isagasi/codeguard-mcp-server
npm install -g @isagasi/codeguard-mcp-server
# Reload VS CodeAcknowledgments
This project integrates the security instruction rules from Project CodeGuard, a comprehensive collection of security best practices for AI-assisted code generation.
The MCP server architecture solves the scaling and central governance challenges inherent in per-repository instruction files, enabling organizations to maintain a single source of truth for security standards across all projects.
License
MIT
Available Tools
2 toolsget_security_instructionsA
Get security instructions for code generation. Returns applicable security rules based on language, context, or file path.
| Name | Required | Description | Default |
|---|---|---|---|
| language | No | Programming language (python, javascript, typescript, java, c, etc.) | |
| context | No | Context keywords (auth, crypto, database, api, password, hash, etc.) | |
| filepath | No | File path for pattern matching (e.g., src/auth/login.ts) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description should fully disclose behavioral traits. It indicates the tool returns applicable security rules but does not mention side effects, data source, rate limits, or that it is a read-only operation. Basic transparency is lacking.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise with two sentences, front-loading the core action and purpose. No redundant or extraneous information is present.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no output schema, the description hints at 'applicable security rules' but does not specify the return format or structure. For a simple lookup tool, this is adequate but could be more informative about the output.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
All three parameters have descriptions in the input schema (100% coverage), so the baseline is 3. The description only lists parameter names without adding new meaning beyond what the schema already provides.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'Get', the resource 'security instructions', and context 'for code generation'. It further specifies the criteria (language, context, file path), making the tool's purpose unambiguous and distinct from the sibling tool.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies the tool provides instructions based on inputs, but does not explicitly differentiate from the sibling 'validate_code_security' or state when to use this tool versus alternatives. No when-not or alternative guidance is provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
validate_code_securityB
Validate code snippet against security rules and return applicable instructions
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Code snippet to validate | |
| language | Yes | Programming language of the code |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, and the description does not disclose any behavioral traits beyond the basic function. It fails to mention side effects, authorization needs, or what happens on validation failure.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence, front-loaded with the primary action. It is concise and direct, with no unnecessary words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Despite having no output schema, the description does not explain the return format of the instructions (e.g., string, list). It also lacks information on error handling or prerequisites, making it incomplete for a tool with only this description.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% with clear parameter descriptions. The description adds the context 'against security rules', which provides additional meaning beyond the schema, but the added value is modest.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'validate' and the resource 'code snippet', and specifies the outcome 'return applicable instructions'. It distinguishes from sibling 'get_security_instructions' which likely only retrieves instructions without validation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is given on when to use this tool versus the sibling 'get_security_instructions'. There are no explicit conditions, exclusions, or alternatives mentioned.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
The two tools have distinct purposes: one retrieves security instructions based on context, the other validates code against rules. However, both involve security instructions, which could cause minor confusion without careful reading.
Both tool names follow a consistent verb_noun pattern in snake_case, 'get_security_instructions' and 'validate_code_security', making them predictable and clear.
With only two tools, the server feels thin for a security-focused service. While the core operations are present, the scope appears limited, and additional tools for rule management would be expected.
The server lacks tools for managing or listing security rules, and the validation tool does not provide detailed violation reports. This leaves notable gaps in a typical security workflow.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Zero-install security baseline for AI coding agents — OWASP/CWE-cited rules over MCP.
Threat modeling, code/cloud/pipeline scanning, shadow-AI discovery, compliance checks and fixes.
Zero-config MCP security scanner for AI-generated apps. 25K+ vulnerability patterns.
Governance copilot for AI-assisted coding. 72 packs, 532 rules, proof bundles.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides real-time OWASP ASVS security guidance and vulnerability scanning for AI coding agents. Enables proactive security during code generation by checking security requirements, scanning code for vulnerabilities, and suggesting secure code fixes.3MIT
- AlicenseNot gradedqualityDmaintenanceProvides AI agents with queryable, version-controlled project rules and coding standards. Enables validation, rule-based guidance, and task summaries to keep AI work aligned with your project's conventions without repeating context.2MIT
- AlicenseNot gradedqualityCmaintenanceCentralizes AI behavior rules and applies them across tools like Codex, Claude Code, and Cursor, enabling agents to fetch up-to-date rules before responding.1MIT
- FlicenseNot gradedqualityDmaintenanceSecurely feeds summarized expert security rules into your coding assistance Claude Code, Cursor, etc — zero config, no API key.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/isagasi/codeguard-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server