MCP Security Server
# MCP Security Server
This is a Model Context Protocol (MCP) server that provides file operations, npm package management, and configuration checking capabilities.
## Available Tools
### File Operations
1. **count_lines_in_file** - Count lines in a text file and return metadata
2. **write_to_file** - Write content to a file with append/overwrite modes
3. **read_file_content** - Read file content with encoding options
### NPM Package Management
4. **check_outdated_packages** - Check for outdated npm packages
5. **analyze_package_security** - Run npm security audit
6. **check_npm_version** - Check npm installation and version
### Configuration Management
7. **check_npmrc_config** - Check local and global .npmrc files
8. **check_npm_global_config** - Check global npm configuration
9. **verify_registry_config** - Verify npm registry configuration
10. **check_npm_cache** - Check npm cache information
## Installation
1. Clone or create the project
2. Install dependencies: `npm install`
3. Build the project: `npm run build`
4. Run the server: `npm start` or `npm run dev`
## Usage
The server communicates via the Model Context Protocol (MCP) over stdio. It can be integrated with MCP-compatible clients.
## Example Tool Usage
### Count lines in a file
```json
{
"name": "count_lines_in_file",
"arguments": {
"file_path": "/path/to/file.txt"
}
}
```
### Check outdated packages
```json
{
"name": "check_outdated_packages",
"arguments": {
"include_dev": true
}
}
```
### Write to file
```json
{
"name": "write_to_file",
"arguments": {
"file_path": "/path/to/output.txt",
"content": "Hello, World!",
"mode": "overwrite"
}
}
```
## Security Features
- Path traversal protection
- File size limits
- Input validation
- Error handling
- Safe npm command execution
## Development
- `npm run dev` - Run in development mode with tsx
- `npm run build` - Build TypeScript to JavaScript
- `npm start` - Run the built server
## License
ISCTDQS
Scored across 10 tools
Most npm tools are distinguishable by target (audit, cache, registry, outdated, version), but check_npmrc_config and check_npm_global_config clearly overlap, and the three generic file tools don't fit the security theme. An agent could easily pick the wrong config-checking tool.
All tool names follow a consistent verb_noun snake_case pattern (check_*, verify_*, analyze_*, read_*, write_*, count_*). Minor semantic overlap aside, the naming convention is predictable and readable.
Ten tools is a reasonable count and not padded to excess. However, count_lines_in_file, write_to_file, and read_file_content appear unrelated to the security purpose, so not every tool clearly earns its place.
The core npm security surface is decently covered: audit, outdated packages, config, registry, cache, and version. But there are no remediation or deeper analysis actions such as npm audit fix, vulnerability details, or dependency graph inspection, and the file tools don't fill that gap.