Investigations MCP by BuildWorks.AI ā forensic investigations and root cause analysis server for MCP-compatible IDEs.
npm install investigationsInvestigations is a production-grade Model Context Protocol (MCP) server providing forensic investigations, root cause analysis, and systematic evidence-based problem solving. Works with Cursor, Windsurf, and Claude via stdio. Distributed via npm and Docker. Built and maintained by BuildWorks.AI.
IMPORTANT SECURITY NOTICE: This software is designed for forensic investigations and root cause analysis. Users must understand and accept the following security implications:
./.investigations/ directory.investigations/ folder.investigations/ to their .gitignore file to prevent committing sensitive dataBy using this software, you acknowledge and accept these security implications and limitations.
./.investigations/ directory with the following structure:
.investigations/
āāā investigations/
ā āāā {investigation_id}.json
ā āāā index.json
āāā evidence/
ā āāā {investigation_id}/
ā ā āāā {evidence_id}.json
ā āāā index.json
āāā analysis/
ā āāā {investigation_id}/
ā ā āāā {analysis_id}.json
ā āāā index.json
āāā reports/
āāā {investigation_id}/
ā āāā {report_id}.json
āāā index.json
`$3
- Directory Management: Users are responsible for creating, managing, and cleaning up the .investigations/ folder
- Git Ignore: CRITICAL: Add .investigations/ to your .gitignore file to prevent committing sensitive investigation data
- File Permissions: Ensure proper file permissions on the storage directory
- Data Cleanup: Manually delete the folder when no longer needed
- Backup: Create backups of investigation data if needed for long-term storage$3
`gitignore
Investigations MCP storage directory
.investigations/
`Installation
$3
- Node.js: Version 18.0.0 or higher (LTS recommended)
- npm: Version 8.0.0 or higher
- Operating System: macOS, Linux, or Windows$3
- Memory: Minimum 512MB RAM
- Disk Space: 100MB for installation
- Network: Internet connection for initial installation$3
`bash
npm install -g investigations@latest
`Important Notes:
- Always use
@latest to ensure you get the most recent version and avoid npx resolution conflicts with global installations
- If you encounter "failed to initialize server" errors, see the Troubleshooting section belowOr clone the repository:
`bash
git clone https://github.com/buildworksai/investigations-mcp.git
cd investigations-mcp
`2. Install dependencies:
`bash
npm install
`3. Build the project:
`bash
npm run build
`4. Run the server:
`bash
npm start
`Quick Start
$3
1. Start an Investigation
`bash
investigation_start \
--title "API Performance Issue" \
--description "Response times increased significantly" \
--severity high \
--category performance \
--reported-by "monitoring-system"
`2. Collect Evidence
`bash
investigation_collect_evidence \
--investigation-id "inv_001" \
--sources '[
{
"type": "logs",
"path": "/var/log/app.log",
"time_range": {
"start": "2024-01-15T14:00:00Z",
"end": "2024-01-15T16:00:00Z"
}
},
{
"type": "metrics",
"parameters": {
"metrics": ["cpu", "memory", "disk"]
}
}
]'
`3. Analyze Evidence
`bash
investigation_analyze_evidence \
--investigation-id "inv_001" \
--analysis-type timeline \
--hypothesis "Database connection pool exhaustion"
`4. Generate Report
`bash
investigation_generate_report \
--investigation-id "inv_001" \
--format markdown \
--include-evidence true
`Available Tools
| Tool | Description |
|------|-------------|
|
investigation_start | Initialize a new investigation case |
| investigation_collect_evidence | Collect evidence from specified sources |
| investigation_analyze_evidence | Perform systematic analysis of evidence |
| investigation_trace_causality | Trace causal relationships between events |
| investigation_validate_hypothesis | Validate hypothesis against evidence |
| investigation_document_findings | Document investigation findings |
| investigation_generate_report | Generate comprehensive report |
| investigation_list_cases | List investigation cases with filtering |
| investigation_get_case | Get detailed case information |
| investigation_search_evidence | Search through collected evidence |MCP Client Configuration
$3
Add to your Cursor settings:`json
{
"mcp": {
"servers": {
"investigations": {
"command": "npx",
"args": ["investigations"],
"env": {
"INVESTIGATIONS_STORAGE_PATH": "/absolute/path/to/.investigations"
}
}
}
}
}
`$3
To ensure consistent initialization across different launch contexts, configure an absolute storage path for JSON storage. You can do this via either an environment variable or a CLI flag. Replace the placeholder with a valid absolute directory on your system.- Environment variable (recommended):
`bash
Use an absolute path
export INVESTIGATIONS_STORAGE_PATH="/absolute/path/to/.investigations"
`- CLI flag:
`bash
investigations --storage-path "/absolute/path/to/.investigations"
`- Example MCP server config (env var):
`json
{
"mcp": {
"servers": {
"investigations": {
"command": "npx",
"args": ["investigations"],
"env": {
"INVESTIGATIONS_STORAGE_PATH": "/absolute/path/to/.investigations"
}
}
}
}
}
`- Example MCP server config (CLI flag):
`json
{
"mcp": {
"servers": {
"investigations": {
"command": "npx",
"args": [
"investigations",
"--storage-path",
"/absolute/path/to/.investigations"
],
"env": {}
}
}
}
}
`Notes:
- Always use an absolute directory path; the server will create it if it does not exist and the parent is writable.
- Prefer the environment variable for editor-agnostic setups; use the CLI flag if your client does not support injecting environment variables.
$3
Add to your Windsurf configuration:`json
{
"mcp": {
"servers": {
"investigations": {
"command": "npx",
"args": ["investigations"],
"env": {
"INVESTIGATIONS_STORAGE_PATH": "/absolute/path/to/.investigations"
}
}
}
}
}
`Docker Support
$3
`bash
Build the Docker image
npm run docker:buildRun the container
npm run docker:run
`$3
`bash
Run in development mode
npm run docker:dev
`Examples
See the examples/ directory for detailed usage scenarios:
- Performance Investigation
- Security Investigation
- Configuration Investigation
Development
$3
`bash
npm test
`$3
`bash
npm run lint
npm run lint:fix
`$3
`bash
npm run dev
`Contributing
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests for new functionality
5. Ensure all tests pass
6. Submit a pull request
License
MIT License - see LICENSE file for details.
Troubleshooting
$3
#### Package Installation Failures
If you encounter installation errors, try these steps in order:
`bash
1. Clear npm and npx caches
npm cache clean --force
rm -rf ~/.npm/_npx2. Verify Node.js version (requires 18+)
node --version3. Try alternative installation methods
npm install -g investigations@latest
OR
npx investigations@latest --version
`#### ENOTEMPTY Error with npx
This is a common npm cache corruption issue. The package includes automatic detection and guidance:
`bash
Clear npm and npx cache
npm cache clean --force
rm -rf ~/.npm/_npx
`#### Storage System
The application uses JSON-based file storage for maximum compatibility. All data is stored in the
./.investigations/ directory with automatic FIFO management.#### Crypto Deprecation Warnings
If you see warnings about deprecated
crypto@1.0.1 package, ensure you're using version 2.2.5 or later, which uses Node.js built-in crypto module instead.#### MCP Server Connection Issues
If you encounter "failed to initialize server" or "transport error: server terminated" errors:
1. Check version: Ensure you're using version 2.2.5 or later
2. Clear corrupted cache (MOST COMMON FIX):
`bash
npm cache clean --force
rm -rf ~/.npm/_npx
npx investigations@latest --version
`
3. Verify Node.js version: Ensure you're using Node.js 18 or higher
`bash
node --version # Should show v18.x.x or higher
`
4. Check NODE_MODULE_VERSION compatibility:
`bash
node -p "process.versions.modules" # Should match your Node.js version
`
5. Fresh installation:
`bash
npm uninstall -g investigations
npm cache clean --force
rm -rf ~/.npm/_npx
npm install -g investigations@latest
`#### Native Module Issues (Resolved)
The application now uses JSON-based file storage, eliminating all native module compatibility issues. No more NODE_MODULE_VERSION or better-sqlite3 errors!
#### "No tools" in MCP Client
If your MCP client shows "No tools, prompts, or resources":
1. Verify server startup: Check that the server starts without errors
2. Check MCP configuration: Ensure correct command and args in your MCP config
3. Test manually: Run
echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {}}' | npx investigations@latest
4. Restart client: Restart your MCP client after configuration changes$3
- GitHub Issues: Report bugs or request features
- Documentation: Full documentation
- BuildWorks.AI Support: contact@buildworks.ai
Support
For questions, issues, or contributions:
- Create an issue in the GitHub repository
- Review the SETUP.md for detailed setup instructions
- Check the examples for usage patterns
- Contact BuildWorks.AI support
Roadmap
$3
- [x] Basic investigation case management
- [x] Evidence collection from common sources
- [x] Simple analysis and reporting
- [x] JSON-based file storage setup
- [x] MCP server implementation
- [x] npm and GitHub Packages publishing
- [x] Docker containerization$3
- [x] Sophisticated causal analysis
- [x] Hypothesis validation with confidence scoring
- [x] Enhanced timeline reconstruction
- [x] Multi-source evidence correlation$3
- [x] Security forensics capabilities
- [x] Performance analysis tools
- [x] Infrastructure inspection tools
- [x] Custom evidence collectors$3
- [x] Advanced reporting formats
- [x] Visualization tools
- [x] API integrations
- [x] Comprehensive documentationChangelog
$3
- Strict argument validation for all MCP tools with Joi schemas
- Type-safe handler inputs in src/index.ts to satisfy CI tsc checks
- Build hardening: resolves MCP request arguments undefined cases
- Docs: clarified absolute storage path configuration for MCP clients
- No behavioral changes to existing tools; validation errors are clearer$3
- Complete JSON Storage System: Full migration from SQLite to JSON-based file storage with FIFO management.
- Enhanced Storage Architecture: Organized file structure with automatic cleanup and indexing.
- Improved Performance: Eliminated native module dependencies for better compatibility.
- Comprehensive Testing: Updated test suite with FIFO enforcement and date handling.
- Migration Utility: Added migration script for existing SQLite users.
- Updated Documentation: Complete documentation overhaul reflecting new storage system.
- Docker Integration: Updated Docker configurations for JSON storage.
- Simplified Setup: Removed complex setup scripts and native module requirements.
- Better Error Handling: Enhanced error messages and troubleshooting guides.
- Production Ready: Fully tested and verified storage system with automatic cleanup.$3
- Complete Rebranding: Package renamed from buildworks-ai-investigations-mcp to investigations` for simplicity