MCP Interface Validator
Validates Express-based backend API implementations against OpenAPI specifications to ensure consistency with frontend requirements.
Integrates with GitHub Copilot to provide real-time checking of interface consistency between frontend and backend code based on OpenAPI 3.0 specifications.
Supports validating AI-generated React frontend code to ensure API calls and data structures match backend specifications.
Utilizes Swagger/OpenAPI 3.0 specifications to perform deep validation and consistency checking of AI-generated code interfaces.
Click on "Deploy 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., "@MCP Interface Validatorvalidate consistency for my new login system .use interface"
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.
MCP Interface Validator - Intelligent Interface Constraints & Validation
❌ Without MCP Interface Validator
AI-generated frontend and backend code may have interface inconsistency issues:
❌ Frontend API calls don't match backend implementations
❌ Inconsistent data structure definitions causing runtime errors
❌ Lack of unified interface specifications
❌ Manual interface consistency checking is inefficient
Related MCP server: Mockloop MCP
✅ With MCP Interface Validator
MCP Interface Validator automatically validates interface consistency between AI-generated frontend and backend code using OpenAPI 3.0 specifications.
Add .use interface to your prompts in Cursor:
Develop a user login system with frontend form and backend API. .use interfaceCreate a product management module with CRUD operations. .use interfaceMCP Interface Validator will:
🔍 Smart Constraint Injection - Automatically add interface validation constraints to AI prompts
📋 OpenAPI Specification Validation - Ensure generated code follows API specifications
🔄 Real-time Interface Checking - Validate frontend-backend interface consistency
🛠️ Multi-tool Support - Support Cursor, Windsurf, Trae, Augment and other AI tools
🚀 Core Features
Intelligent Constraint System
.use interfaceCommand - One-click activation of interface validation constraintsAutomatic Prompt Injection - Smart recognition and injection of OpenAPI constraint prompts
Multi-language Support - Support for Chinese and English commands
Fuzzy Instruction Processing - Handle imprecise user instructions
Interface Validation Engine
OpenAPI 3.0 Support - Complete Swagger specification validation
Real-time Validation - Real-time interface checking during code generation
Error Reporting - Detailed interface inconsistency reports
Auto-fix Suggestions - Provide interface repair suggestions
Multi-tool Integration
Cursor - Full support for Cursor AI programming assistant
Windsurf - Integration with Windsurf development environment
Trae - Support for Trae AI tools
Augment - Compatible with Augment code assistant
Claude Desktop - Support for Claude desktop application
🛠️ Quick Start
Requirements
Node.js >= v18.0.0
AI tools supporting MCP protocol (Cursor, Windsurf, Claude Desktop, etc.)
Global Installation
npm install -g mcp-interface-validatorInstall from GitHub
npm install -g https://github.com/xiaoxiaofeiya/mcp-interface-validator.git📦 Configuration Setup
Augment Code
在Augment配置中添加:
{
"mcpServers": {
"interface-validator": {
"command": "mcp-interface-validator",
"transport": "stdio",
"env": {
"NODE_ENV": "production"
}
}
}
}Claude Desktop
打开Claude Desktop配置文件:
Windows:
%APPDATA%\Claude\claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
添加MCP服务器配置:
{
"mcpServers": {
"mcp-interface-validator": {
"command": "npx",
"args": ["mcp-interface-validator"],
"env": {
"NODE_ENV": "production"
}
}
}
}Cline (Claude in VSCode)
在VSCode的Cline扩展设置中添加:
{
"cline.mcpServers": {
"mcp-interface-validator": {
"command": "npx",
"args": ["mcp-interface-validator"],
"env": {
"NODE_ENV": "production"
}
}
}
}Codex (GitHub Copilot)
在GitHub Copilot配置中添加:
{
"github.copilot.advanced": {
"mcpServers": {
"interface-validator": {
"command": "mcp-interface-validator",
"args": ["--stdio"],
"enabled": true
}
}
}
}Cursor AI
在Cursor设置中添加:
{
"mcp": {
"servers": {
"interface-validator": {
"command": "mcp-interface-validator",
"args": ["--stdio"],
"env": {
"NODE_ENV": "production"
}
}
}
}
}Roo (Roo.dev)
在Roo配置文件中添加:
{
"tools": {
"mcp-interface-validator": {
"type": "mcp",
"command": "mcp-interface-validator",
"args": ["--stdio"],
"description": "API interface validation for generated code"
}
}
}Trae AI
在Trae配置中添加:
{
"integrations": {
"mcp": {
"servers": {
"interface-validator": {
"command": "mcp-interface-validator",
"transport": "stdio",
"autoStart": true
}
}
}
}
}VSCode (with MCP extension)
在VSCode的settings.json中添加:
{
"mcp.servers": {
"interface-validator": {
"command": "mcp-interface-validator",
"args": ["--stdio"],
"env": {
"NODE_ENV": "production"
}
}
}
}Windsurf
在Windsurf配置中添加:
{
"extensions": {
"mcp-interface-validator": {
"enabled": true,
"command": "mcp-interface-validator",
"args": ["--stdio"],
"config": "./config/mcp-validator.json"
}
}
}📋 配置文件设置
创建配置文件
在项目根目录创建 mcp-validator.json:
{
"server": {
"name": "mcp-interface-validator",
"version": "1.0.0",
"description": "MCP Interface Validation Component"
},
"validation": {
"strictMode": true,
"allowAdditionalProperties": false,
"validateExamples": true,
"customRules": [
"require-response-schemas",
"validate-parameter-types",
"check-security-definitions"
]
},
"integrations": {
"cursor": { "enabled": true },
"windsurf": { "enabled": true },
"augment": { "enabled": true },
"trae": { "enabled": true }
},
"monitoring": {
"watchPatterns": [
"**/*.ts", "**/*.js", "**/*.json", "**/*.yaml"
],
"ignorePatterns": [
"node_modules/**", "build/**", "dist/**"
],
"debounceMs": 500
}
}🧪 验证安装
测试MCP服务器
# 检查版本
mcp-interface-validator --version
# 测试STDIO通信
echo '{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2024-11-05", "capabilities": {"tools": {}}, "clientInfo": {"name": "test", "version": "1.0.0"}}}' | mcp-interface-validator测试工具功能
# 列出可用工具
echo '{"jsonrpc": "2.0", "id": 2, "method": "tools/list", "params": {}}' | mcp-interface-validator🔍 使用示例
基本验证
# 验证API接口
mcp-interface-validator validate --spec ./api-spec.yaml --code ./src/api.ts实时监控
# 启动文件监控
mcp-interface-validator monitor --watch ./src --spec ./api-spec.yaml🛠️ 故障排除
常见问题
命令未找到
# 确保全局安装 npm install -g mcp-interface-validator # 或使用npx npx mcp-interface-validator --version权限错误
# Windows (以管理员身份运行) npm install -g mcp-interface-validator # macOS/Linux sudo npm install -g mcp-interface-validator配置文件未找到
# 创建默认配置 mcp-interface-validator init
调试模式
# 启用详细日志
DEBUG=mcp-interface-validator* mcp-interface-validator
# 或设置环境变量
export NODE_ENV=development
mcp-interface-validator --verbose📊 性能优化
大型项目配置
{
"monitoring": {
"maxFileSize": 1048576,
"debounceMs": 1000,
"ignorePatterns": [
"node_modules/**",
"**/*.test.*",
"**/*.spec.*",
"coverage/**"
]
},
"validation": {
"cacheEnabled": true,
"parallelProcessing": true,
"maxConcurrency": 4
}
}🔐 安全配置
生产环境
{
"security": {
"enableSandbox": true,
"allowedPaths": ["./src", "./api"],
"maxFileSize": 1048576,
"timeoutMs": 30000
},
"logging": {
"level": "warn",
"sanitizeOutput": true
}
}📈 监控和日志
日志配置
{
"logging": {
"level": "info",
"format": "structured",
"output": "./logs/mcp-validator.log",
"rotation": {
"enabled": true,
"maxSize": "10MB",
"maxFiles": 5
}
}
}🚀 生产部署
Docker部署
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
EXPOSE 3000
CMD ["mcp-interface-validator", "--port", "3000"]系统服务
# 创建systemd服务
sudo tee /etc/systemd/system/mcp-validator.service > /dev/null <<EOF
[Unit]
Description=MCP Interface Validator
After=network.target
[Service]
Type=simple
User=node
WorkingDirectory=/opt/mcp-validator
ExecStart=/usr/bin/node /opt/mcp-validator/build/index.js
Restart=always
[Install]
WantedBy=multi-user.target
EOF
# 启动服务
sudo systemctl enable mcp-validator
sudo systemctl start mcp-validator🎯 Usage
Basic Usage
Activate Smart Constraints: Add
.use interfaceto your AI promptsDescribe Requirements: Normally describe your development needs
Automatic Validation: System automatically injects interface validation constraints
Get Results: Receive code that complies with OpenAPI specifications
Example Scenarios
User Management System:
Develop user registration and login functionality with frontend form validation and backend API. .use interfaceProduct Management Module:
Create product CRUD operations, frontend using React, backend using Express. .use interfaceOrder Processing System:
Implement order creation, query, and update functions, ensuring frontend-backend data structure consistency. .use interface🔧 Advanced Configuration
Custom Constraint Rules
Create constraint-config.json file:
{
"openapi": {
"version": "3.0.0",
"strictMode": true,
"validateResponses": true
},
"validation": {
"realTime": true,
"autoFix": true
}
}Multi-language Support
Supported command formats:
Chinese:
.use interface,.使用接口English:
.use interface,.apply constraints
📚 Documentation Links
🌟 Key Advantages
Zero Configuration Startup - Ready to use after installation, no complex configuration needed
Smart Recognition - Automatically recognize interface validation requirements
Real-time Feedback - Instant interface consistency checking
Cross-platform Support - Full support for Windows, macOS, Linux
Open Source & Free - MIT license, completely open source
🤝 Contributing
Issues and Pull Requests are welcome!
📄 License
MIT License - See LICENSE file for details
Related MCP Connectors
The OpenZeppelin Solidity Contracts MCP server integrates OpenZeppelin's security and style rules into AI-driven development workflows, enabling AI assistants to generate safe, correct, and production-ready smart contracts. It automatically validates generated code against OpenZeppelin standards (including imports, modifiers, naming conventions, and security checks) and supports various contract types including ERC-20, ERC-721, ERC-1155, Stablecoins, RWA, Governor, and Account contracts through prompt-driven workflows.
MCP server for AI access to Swagger by SmartBear.
Deterministic validation for AI-generated artifacts: JSON Schema, OpenAPI response, SQL syntax.
Build, validate, deploy — HTTP APIs, cron jobs, webhooks and MCP tools — from your AI client.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceThis server facilitates scalable discovery and execution of OpenAPI endpoints using semantic search and high-performance processing, overcoming limitations of large spec handling for streamlined API interactions.82MIT
- AlicenseNot gradedqualityNot gradedmaintenanceAn Intelligent Model Context Protocol server that generates mock servers from OpenAPI specifications, featuring advanced logging, performance analytics, and server discovery for AI-assisted API development.MIT
- FlicenseNot gradedqualityDmaintenanceConverts any Swagger/OpenAPI specification into an MCP server, enabling AI assistants to intelligently query API endpoints, schemas, and generate code examples.18-
- AlicenseAqualityFmaintenanceAI-powered backend diagnostics MCP server that statically analyzes frontend and backend code to catch cross-boundary bugs, contract drift, missing validation, security gaps, and performance anti-patterns before deployment.413MIT