MCP Server
Overview
jscpd-server implements the Model Context Protocol (MCP), allowing AI assistants like Claude Desktop, Cursor, and Copilot to detect code duplication directly from the editor — no CLI invocation needed.
Starting the Server
# Install and start
npm install -g jscpd-server
jscpd-server /path/to/project
# With custom port
jscpd-server /path/to/project --port 3000
Note: The jscpd-server is still Node.js based. The CLI detection engine (
jscpdcommand) is Rust-based in v5, but the server uses the v4 engine.
Configuration
Add to your MCP client config (e.g. Claude Desktop):
{
"mcpServers": {
"jscpd": {
"type": "streamable-http",
"url": "http://localhost:3000/mcp"
}
}
}
Available MCP Tools
check_duplication
Checks a provided code snippet for duplications against the codebase currently being served by jscpd-server.
Arguments:
code(string, required): The source code snippet to analyzeformat(string, required): The format of the code (e.g. "javascript", "typescript")recheck(boolean, optional): Iftrue, triggers a re-scan of the current directory before checking the snippet
get_statistics
Retrieves the overall project duplication statistics.
Arguments: None
Returns total lines, sources, clones, and duplication percentage broken down by format.
check_current_directory
Triggers a re-scan of the current working directory for duplications and returns the updated statistics.
Arguments: None
Resources
The server exposes the following resource:
jscpd://statistics: Returns the current duplication statistics in JSON format
How It Works
- Start
jscpd-serveragainst your project directory — it scans and indexes the codebase - Your AI assistant connects to the MCP endpoint
- When you ask your assistant to check for duplications, it calls
check_duplicationorget_statistics - Results are returned directly in the assistant's context — no manual CLI needed
Tips
- Check
/api/healthto verify the server has finished its initial scan - The server accepts request bodies up to 10MB