@darient/code-analyzer-mcp
v0.0.3
Published
The Code Analyzer MCP Server is a Model Context Protocol (MCP) server that analyzes code vulnerabilities in directories using OpenAI models, enhancing software security for developers and AI.
Downloads
33
Readme
Code Analyzer MCP
A sophisticated code analysis tool for the Model Context Protocol ecosystem, providing cost estimation, token counting, and vulnerability scanning capabilities.
📦 Project Structure
src/
├── config/
│ └── constant.ts # Configuration constants and defaults
├── tools/
│ ├── cost-estimator.ts # Cost calculation utilities
│ ├── list-model-pricing.ts # Model pricing definitions
│ ├── token-counter.ts # Token counting implementation
│ └── vulnerability-scanner.ts # Security analysis tools
├── index.ts # Server initialization
└── server.ts # MCP server construction⚙️ Configuration (constants.ts)
Key configuration parameters:
DEFAULT_IGNORE: Ignored directories/filesDEFAULT_EXTENSIONS: Supported file extensionsDEFAULT_ENCODINGS: Supported text encodingsMODEL_CONTEXT_WINDOWS: Model context window sizesMODEL_PRICING: Model pricing per 1M tokensCHECK_VULNERABILITY_SYSTEM_MESSAGE: Security analysis promptOUTPUT_MAX_TOKENS: Max tokens per analysis
🚀 Installation
Prerequisites
- Node.js v22.16.0 (nvm recommended)
- Yarn 4.9.1:
corepack enable corepack prepare [email protected] --activate
Steps
Clone repository:
git clone https://github.com/darient/code-analyzer-mcp cd code-analyzer-mcpInstall dependencies:
yarn install
🛠 Build
Important: You must build the project before use, as both the inspector and client configurations point to the
dist/directory.
- Build project:
yarn build
🔍 Usage
Note: The following configurations are for local development. Production deployment will be available soon.
MCP Inspector (Local)
npx -y @modelcontextprotocol/inspector -e OPENAI_API_KEY="your-key" npx -y tsx ./dist/index.jsClient Configuration (Local)
{
"mcpServers": {
"code-analyzer-mcp": {
"command": "npx",
"args": ["-y", "tsx", "/path/to/dist/index.js"],
"env": {
"OPENAI_API_KEY": "your-key"
}
}
}
}🌐 Environment Variables
| Variable | Required | Description |
| ---------------- | -------- | ------------------------------- |
| OPENAI_API_KEY | Yes | OpenAI API key for model access |
📄 License
This is a private project. All rights reserved.
Note: Ensure proper file permissions and API key security when deploying in production environments.
