abac-validation-mcp-server

abac-validation-mcp-server

Enables AI-assisted Attribute-Based Access Control code validation and review, with batch processing and progress notifications for long-running operations.

Category
访问服务器

README

ABAC Validation MCP Server

An MCP (Model Context Protocol) server that provides AI-assisted ABAC (Attribute-Based Access Control) code validation and review tools. This server integrates with Claude CLI or GitHub Copilot CLI to perform long-running validation operations with progress notifications.

Features

  • Business Logic Validation: Validate code against business requirements using AI
  • AI-Assisted Code Review: Comprehensive code review covering quality, security, and performance
  • Batch Processing: Validate multiple files with progress updates
  • Progress Notifications: Long-running operations report progress to the client
  • CLI Integration: Calls Claude/Copilot CLI for AI analysis (ready for integration)

Installation

npm install
npm run build

Usage

Running Standalone

npm run dev

VS Code Configuration

Add to your VS Code settings.json (.vscode/settings.json or user settings):

{
  "mcp.servers": {
    "abac-validation": {
      "type": "stdio",
      "command": "node",
      "args": [
        "/absolute/path/to/abac-validation-mcp-server/dist/index.js"
      ]
    }
  }
}

Or use npx for easier distribution:

{
  "mcp.servers": {
    "abac-validation": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "abac-validation-mcp-server"
      ]
    }
  }
}

Claude Desktop Configuration

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "abac-validation": {
      "command": "node",
      "args": [
        "/absolute/path/to/abac-validation-mcp-server/dist/index.js"
      ]
    }
  }
}

Available Tools

1. validate_business_logic

Validate code against business requirements using AI.

Parameters:

  • code (string, required): The code to validate
  • requirements (string, required): Business requirements to validate against

Example:

{
  "code": "function calculateDiscount(price, customerType) { ... }",
  "requirements": "Premium customers get 20% discount, regular customers get 10%"
}

2. ai_code_review

Perform comprehensive AI-assisted code review.

Parameters:

  • code (string, required): The code to review
  • context (string, optional): Additional context about the code
  • review_type (string, optional): Type of review - "comprehensive", "security", "performance", or "style"

Example:

{
  "code": "async function fetchUserData(userId) { ... }",
  "context": "This is part of a user authentication system",
  "review_type": "security"
}

3. batch_validate

Validate multiple files in batch with progress updates.

Parameters:

  • files (array, required): Array of file objects with path and optional requirements

Example:

{
  "files": [
    { "path": "src/auth.ts", "requirements": "Must use OAuth 2.0" },
    { "path": "src/payment.ts", "requirements": "PCI DSS compliant" }
  ]
}

Integration with Claude/Copilot CLI

Current Status

The server skeleton is ready with placeholder implementations. To integrate with actual CLIs:

Option 1: Claude CLI

Replace the TODO sections in src/index.ts with:

// Install: npm install -g @anthropic-ai/claude-cli
const result = await executeWithProgress('claude', [
  'analyze',
  '--prompt', prompt
], (msg) => {
  if (progressToken) {
    // Send progress notification
  }
});

Option 2: GitHub Copilot CLI

// Requires GitHub Copilot CLI access
const result = await executeWithProgress('gh', [
  'copilot',
  'explain',
  code
], (msg) => {
  if (progressToken) {
    // Send progress notification
  }
});

Option 3: API Calls

For more control, use the Anthropic API directly:

npm install @anthropic-ai/sdk
import Anthropic from '@anthropic-ai/sdk';

const client = new Anthropic({
  apiKey: process.env.ANTHROPIC_API_KEY
});

// Use streaming for progress
const stream = await client.messages.create({
  model: 'claude-sonnet-4-5-20250929',
  messages: [{ role: 'user', content: prompt }],
  stream: true,
  max_tokens: 4096
});

for await (const event of stream) {
  // Send progress updates
}

Development

Build

npm run build

Watch Mode

npm run watch

Testing

Test the server with MCP Inspector:

npx @modelcontextprotocol/inspector node dist/index.js

Next Steps

  1. Integrate CLI: Choose your preferred AI CLI (Claude/Copilot) and implement in the TODO sections
  2. Add Progress Notifications: Use MCP progress notification protocol for real-time updates
  3. File System Access: Add file reading capabilities for batch validation
  4. Configuration: Add config file for API keys, CLI paths, etc.
  5. Error Handling: Improve error handling and retry logic
  6. Caching: Add caching for repeated validations
  7. Custom Validators: Add domain-specific validation rules

Architecture

User (VS Code/Copilot/Claude)
    ↓
MCP Client
    ↓ (stdio)
Validation MCP Server
    ↓
Claude CLI / Copilot CLI / API
    ↓
AI Model (validation/review)
    ↓
Results with Progress

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选