# Contributing to mcprism Thanks for your interest in improving mcprism! It is a community project and good contributions are very welcome. ## Getting started You need Go **1.25+**. ```sh git clone https://github.com/HUA503/mcprism.git cd mcprism go build ./... # build all packages go run ./cmd/mcprism scan examples/vulnerable.mcp.json go vet ./... # static checks gofmt -l . # formatting (should print nothing) go test ./... # unit tests ``` ## Project layout ``` cmd/mcprism/ CLI entry point (cobra) internal/config/ MCP config model, JSON/JSONC/TOML/YAML parsing, auto-discovery internal/protocol/ MCP client: JSON-RPC, stdio / Streamable HTTP / SSE internal/rules/ Config, capability, metadata and prompt-injection rules internal/sast/ Language-specific source analysis and taint tracking internal/policy/ Profiles, overrides, suppressions and CI gates internal/report/ table / json / sarif / markdown / html / junit / csv / cyclonedx internal/tui/ Interactive terminal interface (bubbletea) internal/registry/ MCP Registry client and package audit internal/inventory/ MCP capability inventory locks and drift checks internal/baseline/ Finding baseline comparison editors/ VS Code and JetBrains integrations npm/ Optional npm launcher for release binaries examples/ Demo configs and a simulated malicious server docs/ Architecture, rules, SAST, policy and integration guides ``` When changing config support, update the matching example and the English and Chinese README sections. Keep the localized client-support sections under `docs/i18n/` in sync when a feature changes what those clients can scan. ## Improving detection Good checks are **deterministic, high-signal and low false-positive**. They do not require an LLM or network access. First identify whether the behavior is a configuration/metadata check or a source-code data-flow check: - Configuration, capability and tool/prompt metadata checks belong under `internal/rules/`; cover them in `internal/rules` tests. - Handler-to-sink source checks belong under `internal/sast/`; cover both vulnerable and safe code in `internal/sast` tests. Keep language-specific support claims and limits accurate in `docs/SAST.md`. For either type, give the finding a stable `MCP###` id, map it to an OWASP MCP risk where possible (see `docs/RULES.md`), and provide clear `Evidence`, `Description`, `Advice` and, where available, `References`. Add a regression case for the reported behavior and a safe negative case where relevant. Avoid rules that claim broader language or semantic coverage than they implement. Document user-visible checks in `docs/RULES.md` and update the relevant English and Chinese README sections. ## Commit & PR guidelines - Use [Conventional Commits](https://www.conventionalcommits.org/), e.g. `feat: detect X`, `fix: avoid Y false positive`, `docs: clarify Z`. - Keep PRs focused and small; one logical change per PR. - Run `gofmt`, `go vet ./...` and `go test ./...` before submitting. For a focused change, also run the package tests you touched, such as `go test ./internal/sast`. - Describe *what* and *why*, and link related issues. ## Reporting bugs & security issues - Bugs and feature requests: open a GitHub issue using the templates. Before posting, remove credentials, private server URLs, usernames and sensitive local paths from commands, configs, reports and screenshots; use placeholders in a minimal example. You can write issues and questions in English or Chinese. - Security vulnerabilities: **do not open a public issue** — follow [`SECURITY.md`](SECURITY.md). Chinese contribution instructions are available in [`CONTRIBUTING.zh-CN.md`](CONTRIBUTING.zh-CN.md). By contributing, you agree your contributions are licensed under the project's [MIT license](LICENSE).