MCP Server for Code Protection with Agent Tools and Third-party API Integration
npm install codeprot-mcp-serverMCP Server provides secure API interfaces for IDEs that support the MCP protocol (such as Cursor), allowing you to view and resolve code issues directly in your IDE.
- Go to the user settings page: Click the Settings button near your user avatar in the lower right corner
- Find the 'MCP Server' option in the left navigation bar and click on it
- First-time use requires creating an MCP application to obtain access credentials
- After creating the application, you will receive an AppID and Secret for API authentication
- Create Application: Click the 'Create New Application' button
- Application Information: Fill in the application name and description (we recommend using meaningful names such as 'Cursor IDE Integration')
- Obtain Credentials: After successful creation, the system will display AppID and Secret
- Save Credentials: Please immediately copy and securely save these credentials. The Secret will only be displayed once.
- Application Status: You can enable or disable the application at any time
- Permission Management: You can set the access permission scope for the application
#### Cursor IDE Configuration
1. Open Cursor settings and select Tools & Integrations
2. Find the MCP Server configuration section
3. Configure the following parameters:
``json``
{
"mcpServers": {
"codeprot-mcp-server": {
"command": "npx",
"args": [
"-y",
"codeprot-mcp-server"
],
"env": {
"CODE_PROT_APP_ID": "YOUR_APP_ID",
"CODE_PROT_APP_SECRET": "YOUR_APP_SECRET"
}
}
}
}
Note: Replace YOUR_APP_ID and YOUR_APP_SECRET with your actual application credentials.
#### Other IDEs
Configure according to the specific IDE's MCP support documentation.
---
The current server exports four tools (see src/tools/agentTools.ts):
1) review_diff_changes
- Purpose: IDE-integrated pre-commit review for the current Git branch. Collects diffs and runs Code-Prot analysis to detect issues before committing.
- Auto params: workspace_path is auto-injected.
- Inputs (all optional unless noted):
- workspace_path: string (path)
- projects_path: string[]
- project_path: string (path)
- file_paths: string[] (limit analysis to these files)
- exclude_globs: string[] (e.g. ["/.test.", "/__tests__/", "/.spec."])
- direct_run_mode: 'plan' | 'run' (internal; use 'run' with project_path for immediate analysis)
- Typical prompts in Cursor:
- "Review current branch diffs"
- "Review only these files: src/a.ts, src/b.ts"
- "Review this project now (force run)"
- Behavior: When called without parameters, it returns a planning flow to first discover original project paths and then run analysis. When called with { project_path, direct_run_mode: 'run' } it executes immediately.
2) get_open_pr_issues
- Purpose: Find open PR review issues for a repository or specific files.
- Inputs:
- repo_name?: string (required for direct fetch; if omitted, returns instructions to obtain it)
- branch_name?: string
- file_paths?: string | string[]
- Typical prompts in Cursor:
- "Find open PR review issues for repo my-project"
- "Find open issues for these files: src/a.ts, src/b.ts"
- "List open issues on branch feature/login for repo my-project"
- Notes: If repo_name is omitted, the tool returns a plan instructing how to detect repo_name (via git remote.origin.url or fallback to repo root directory name).
3) resolve_open_pr_issues
- Purpose: Resolve/mark/update issue status in batch.
- Inputs:
- issue_ids: string[] (required)
- status: 'pending' | 'accepted' | 'completed' | 'rejected' (required)
- Typical prompts in Cursor:
- "Mark these issues as accepted:
- "Set status completed for issue
4) health_check
- Purpose: Ping Code-Prot API health/connectivity and verify credentials.
- Inputs: none
- Typical prompt: "Health Check"
Credentials required for API-backed tools: set environment variables CODE_PROT_APP_ID and CODE_PROT_APP_SECRET.
---
- Health Check
- Prompt: "Health Check"
- What it does: Verifies service health and connectivity.
- Get Current Code File Issue List (via get_open_pr_issues)
- Open a file, then prompt examples:
- "Find open PR review issues for these files:
- "Find open PR review issues for repo
- Update Issue Status (via resolve_open_pr_issues)
- Prompt: "Update Issue Status: mark
- Pre-commit Diff Review (via review_diff_changes)
- Prompt: "Review current branch diffs"
- Optional: "Review only these files: src/tools/agentTools.ts, src/utils/logger.ts"
- Optional: "Exclude test files when reviewing"
---
In Cursor AI Chat:
User: "Review current branch diffs"
System: "Generated instructions to discover original project paths and run analysis. Then executes review and returns issues and guidance."
User: "Find open PR review issues for repo codeprot-mcp-server"
System: "✅ Successfully retrieved 15 issues from repository codeprot-mcp-server"
---
Connection Issues
- Verify that your AppID and Secret are correct
- Check that the MCP server is properly configured in your IDE
- Run Health Check to verify service connectivity
Issue Detection Problems
- Ensure you're in a Git repository
- Verify that the repository name matches your CodeProt project
- Check that you have proper permissions for the application
Status Update Failures
- Confirm that issue IDs are valid
- Verify that you have write permissions
- Check the application status is active
---
For issues, questions, or feature requests, please contact our support team at support@codeprot.com or visit our documentation portal.
MIT License