Contributing
We welcome contributions to mcp-scanner! This document outlines how to get started.
Development Setup
-
Clone the repository:
git clone https://github.com/oabraham1/mcp-scanner cd mcp-scanner -
Build the project:
cargo build -
Run tests:
cargo test -
Run with logging:
RUST_LOG=debug cargo run -- scan
Code Style
- Follow standard Rust formatting (
cargo fmt) - Pass clippy checks (
cargo clippy -- -D warnings) - Write tests for new functionality
- Document public APIs
Submitting Changes
- Fork the repository
- Create a feature branch (
git checkout -b feature/my-feature) - Commit your changes
- Push to your fork
- Open a pull request
Adding Threat Detectors
To add a new threat detector:
- Create a file in
src/scanner/threats/ - Implement the
ThreatDetectortrait - Add it to the list in
threats/mod.rs - Write tests
Example:
#![allow(unused)]
fn main() {
use crate::scanner::threats::ThreatDetector;
use crate::scanner::report::{Threat, Severity, ThreatCategory};
pub struct MyDetector;
impl ThreatDetector for MyDetector {
fn detect(
&self,
server: &ServerConfig,
tools: &[ToolInfo],
resources: &[ResourceInfo],
) -> Vec<Threat> {
// Detection logic here
vec![]
}
}
}
Adding Client Parsers
To add support for a new AI client:
- Create a file in
src/discovery/clients/ - Implement the
McpClientParsertrait - Add it to
all_clients()indiscovery/mod.rs - Write tests
Reporting Issues
Please report issues on GitHub with:
- Steps to reproduce
- Expected behavior
- Actual behavior
- mcp-scanner version (
mcp-scanner --version)