jscpd
Officialjscpd
Copy/paste detector for programming source code. Supports 224+ formats. AI-ready with MCP server and token-efficient reporter. Now with a Rust-powered engine — 24-37x faster.
jscpd implements the Rabin-Karp algorithm to find duplicated code blocks across files.
Quick Start
# Install (all platforms — installs the jscpd command)
curl -fsSL https://jscpd.dev/install.sh | bash
# TypeScript engine (Node.js, v4.x)
npm install -g jscpd@4
jscpd /path/to/code
# or use without installing
npx jscpd@4 /path/to/code
# Rust engine (v5.x, 24-37x faster) — installs the jscpd command
npm install -g jscpd@5
jscpd /path/to/code
# Rust engine — cpd command only
npm install -g cpd
cpd /path/to/code
# Rust-native install (exposes both jscpd and cpd)
cargo install jscpd
# Nix (installs both jscpd and cpd)
nix run github:kucherenko/jscpd -- /path/to/code
# or install permanently
nix profile install github:kucherenko/jscpd
# Homebrew (macOS/Linux)
brew install jscpdRelated MCP server: tree-sitter-analyzer
Documentation
Document | Description |
Node.js engine — CLI, reporters, config, detection modes | |
Rust engine — installation, CLI, reporters, blame, Rust API | |
AI reporter, agent skills, MCP server | |
TypeScript and Rust programmatic APIs | |
GitHub Action, pre-commit hooks | |
Monorepo package and crate overview |
Two Engines
TypeScript (v4) | Rust (v5) | |
npm package | ||
CLI command |
|
|
Speed | Baseline | 24-37x faster |
Formats | 224 | 223 |
Node.js required | Yes | No (self-contained binary) |
Programming API | TypeScript ( | Rust ( |
LevelDB store | Yes | No |
Reporters | 13 | 13 |
jscpd@5 installs the jscpd command. The cpd npm package installs the cpd command. Both contain the same Rust binary. For both command names from a single install, use crates.io: cargo install jscpd.
What's New
v5.0.x — Rust Engine
jscpd v5 is a ground-up Rust rewrite that ships as jscpd@5 (installs the jscpd command) or cpd (installs the cpd command). Self-contained binary — no Node.js runtime required.
Same interface, 24-37x faster:
All CLI options from v4 are preserved — drop-in replacement:
jscpd→jscpd@5Same
.jscpd.jsonconfig file, same detection algorithm, same reporters223 language formats with cross-format detection (Vue SFC, Svelte, Astro, Markdown)
New in v5:
24-37x faster detection on real projects (see benchmark)
Small codebases (548 files): 34x faster
Medium codebases (9K files): 37x faster
Large codebases (17K files, 900 MB): 24x faster
Git blame with side-by-side author comparison (
--blame --reporters console-full)--workers— control parallelism for file tokenization and detection (default: auto, uses all CPU cores; not available in v4)13 reporters:
console,console-full,json,xml,csv,html,markdown,badge,sarif,ai,xcode,threshold,silentAI reporter — token-efficient output for LLM pipelines (~79% fewer tokens than console)
--mcp— built-in MCP server over stdio: point your AI assistant at the binary and it can check snippets for duplication against your codebase (see docs)--summary— codebase summary: top files and folders by tokens, lines, size, and a complexity estimate — refactoring hotspots straight from the scan (see docs)Self-contained binary — prebuilt for 7 platforms (macOS arm64/x64, Linux arm64/x64, Windows arm64/x64)
Not yet in v5 (use v4 for these):
LevelDB/Redis stores (
--store leveldb)Node.js programming API (
jscpd(),detectClones())
See Rust docs for the full CLI reference and differences from v4.
v4.2.x — TypeScript Engine
Custom tokenizer backend — replaced
prismjswith own backend built on reprism. ~11.5% faster tokenization on real projectsCross-format detection — Vue SFC, Svelte, Astro, and Markdown tokenized per-block, enabling detection across file types
New formats: Apex, CFML/ColdFusion, GDScript, and 70+ additional formats (224 total, up from 152)
Shebang detection — auto-detect language for extensionless scripts
--store-path— configure LevelDB cache directory for parallel runs--skipComments— shorthand for--mode weak--formats-names— map filenames (e.g.Makefile,Dockerfile) to formats--noTips— suppress tip output in CIBug fixes: entire-file duplicates silently dropped (#728), ReDoS on Lisp/Elisp files (#737), process crash on malformed
package.json(#739), Vue SFC cross-file detection (#737), Vue SFC column numbers (#737), 50 dependency security vulnerabilities
See TypeScript docs for the full CLI reference.
Packages
Package | Description |
CLI and Node.js API (v4.x) | |
REST API + MCP server | |
Core detection algorithm | |
File detection, reporters | |
Source code tokenization | |
HTML report | |
SVG badge | |
SARIF (GitHub Code Scanning) | |
LevelDB persistent store | |
Redis distributed store | |
cpd (Rust engine) | Rust-powered engine (v5.x) — also available as |
Who Uses jscpd
The jscpd npm package is downloaded 10M+ times per month, and ~5,000 repositories declare it on GitHub's dependents graph.
Bundled by analysis platforms:
GitHub Super Linter — official GitHub linter aggregator, bundles jscpd as its copy/paste detector
MegaLinter — open-source linter aggregator for CI, ships jscpd in every flavor including
ci_lightCodacy — automated code analysis platform, jscpd powers the duplication engine
Used in notable projects:
OpenClaw — personal AI assistant, runs jscpd as a duplication gate in its check scripts
DeepSeek Harness — DeepSeek's plugin harness, jscpd config in CI
degit — Rich Harris's project scaffolder
MEGA webclient — the MEGA.nz web client
Alibaba AppWorks — embeds jscpd as a library
OVHcloud manager — OVHcloud's customer control panel
KiroCrew — self-improving persistent development workspace
Performance
Benchmarked on macOS (Apple Silicon), 10 runs per target (3 for CopilotKit). v4 ran with --no-gitignore -i "node_modules" to ensure comparable file scanning.
Target | Files | Size | jscpd v4 | jscpd v5 | Speedup |
fixtures | 548 | 1.5 MB | 1.03s | 0.03s | 34.3x |
svelte | 9K | 38 MB | 15.80s | 0.43s | 36.9x |
CopilotKit | 17K | 159 MB | 82.89s | 3.44s | 24.1x |
See performance-comparison.md for full methodology and raw data.
AI-Ready Features
jscpd integrates into AI-powered workflows through three mechanisms:
AI Reporter
Token-efficient output for LLM pipelines (~79% fewer tokens than the default console reporter):
jscpd --reporters ai /path/to/source # v4
cpd --reporters ai /path/to/source # v5
cpd --reporters ai --summary /path/to/source # v5: + compact codebase summaryAgent Skills
Two installable skills that teach AI coding assistants how to use jscpd and refactor detected duplications:
Skill | Purpose | Install |
| Tool reference — CLI options, AI reporter format, config syntax |
|
| Guided refactoring workflow — read clones, choose strategy, apply, verify |
|
After installation, ask your agent to "find and fix code duplication" and it will invoke jscpd with the right options and act on the results.
See AI-Ready docs for full details.
Contributing
See CONTRIBUTING.md for the development setup (Rust and TypeScript), the test policy, and the requirements for acceptable pull requests. Security issues go through the security policy, not public issues.
Fork the repo kucherenko/jscpd
Clone forked version (
git clone https://github.com/{your-id}/jscpd)Install dependencies (
pnpm install)Run in dev mode:
pnpm devAdd your changes
Add tests and check:
pnpm testBuild:
pnpm buildCreate PR
Backers
Thank you to all our backers! 🙏 [Become a backer]
Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]
License
MIT © Andrey Kucherenko
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityAmaintenanceFramework-aware code intelligence MCP server that builds a cross-language dependency graph from source code. 53 integrations (Laravel, Django, Rails, Spring, NestJS, Next.js, and more) across 68 languages. 100+ tools for navigation, impact analysis, refactoring, security scanning, session memory, and CI/PR reports — up to 97% token reduction.285,033102MIT
- AlicenseAqualityAmaintenanceAn MCP code-intelligence server for AI agents with pre-indexed AST cache, 62 MCP tools, and TOON-compressed output, enabling token-efficient code analysis and project health grading entirely locally.947MIT
- AlicenseNot gradedqualityBmaintenanceA local MCP server that indexes TypeScript/JavaScript projects and returns budget-aware, dependency-optimized context packs for AI coding assistants.1MIT
- AlicenseNot gradedqualityCmaintenanceToken-efficient MCP server for multi-language project analysis (Java, TypeScript, JavaScript, Markdown, Python) with plugins, semantic search, and static analysis.MIT
Related MCP Connectors
Zero-config MCP security scanner for AI-generated apps. 25K+ vulnerability patterns.
Security scanner for MCP servers. Detect vulnerabilities, prompt injection, and tool poisoning.
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/kucherenko/jscpd'
If you have feedback or need assistance with the MCP directory API, please join our Discord server