com.codescene/codescene-mcp-server

An MCP server that provides CodeScene Code Health analysis tools.

32NOASSERTIONother

Install

Config snippet generator goes here (5 client tabs)

README

# CodeScene MCP Server

[![CodeScene Hotspot Code Health](https://codescene.io/projects/72556/status-badges/hotspot-code-health)](https://codescene.io/projects/72556)
[![CodeScene Average Code Health](https://codescene.io/projects/72556/status-badges/average-code-health)](https://codescene.io/projects/72556)
[![CodeScene System Mastery](https://codescene.io/projects/72556/status-badges/system-mastery)](https://codescene.io/projects/72556)

The **CodeScene MCP Server** exposes CodeScene's [Code Health](https://codescene.com/product/code-health) analysis as local AI-friendly tools.

This server is designed to run in your local environment and lets AI assistants (like GitHub Copilot, Cursor, Claude code, etc.) request meaningful Code Health insights directly from your codebase. 
The Code Health insights augment the AI prompts with rich content around code quality issues, maintainability problems, and technical debt in general.

## Getting Started with CodeScene MCP

1. Get an Access Token for the MCP Server — see [Getting a Personal Access Token](docs/getting-a-personal-access-token.md).
2. Install the MCP Server using one of the [installation options](#installation) below.
3. Add the MCP Server to your AI assistant. See the detailed instructions for your environment in the installation guide.
4. Copy the file [AGENTS.md](AGENTS.md) to your repository. This file guides AI agents on how to use the MCP, e.g. rules to safeguard AI coding.
   * If you use Amazon Q, then you want to copy our [.amazonq/rules](.amazonq/rules) to your repository instead.

## Installation

Choose the installation method that works best for your platform.

<details>
<summary><b>NPM / npx (macOS, Linux, Windows)</b></summary>

Run the MCP server directly with npx (no install needed):

```bash
npx @codescene/codehealth-mcp
```

Or install globally:

```bash
npm install -g @codescene/codehealth-mcp
```

The first run automatically downloads the correct platform-specific binary for your system and caches it for future use. Requires [Node.js](https://nodejs.org/) 18 or later.

📖 **[Full installation & integration guide](docs/npm-installation.md)**

</details>

<details>
<summary><b>Homebrew (macOS / Linux)</b></summary>

```bash
brew tap codescene-oss/codescene-mcp-server https://github.com/codescene-oss/codescene-mcp-server
brew install cs-mcp
```

📖 **[Full installation & integration guide](docs/homebrew-installation.md)**

</details>

<details>
<summary><b>Windows</b></summary>

Run this in PowerShell:

```powershell
irm https://raw.githubusercontent.com/codescene-oss/codescene-mcp-server/main/install.ps1 | iex
```

📖 **[Full installation & integration guide](docs/windows-installation.md)**

</details>

<details>
<summary><b>Manual Download</b></summary>

Download the latest binary for your platform from the [GitHub Releases page](https://github.com/codescene-oss/codescene-mcp-server/releases):

- **macOS:** `cs-mcp-macos-aarch64.zip` (Apple Silicon) or `cs-mcp-macos-amd64` (Intel)
- **Linux:** `cs-mcp-linux-aarch64.zip` or `cs-mcp-linux-amd64`
- **Windows:** `cs-mcp-windows-amd64.exe`

After downloading, make it executable and optionally add it to your PATH:

```bash
chmod +x cs-mcp-*
mv cs-mcp-* /usr/local/bin/cs-mcp
```

You can also [build a static executable from source](docs/building-executable-locally.md).

</details>

<details>
<summary><b>Docker</b></summary>

```bash
docker pull codescene/codescene-mcp
```

📖 **[Full installation & integration guide](docs/docker-installation.md)** | [Build the Docker image locally](docs/building-docker-locally.md)

</details>

---

## Use Cases

> [!TIP]
> Watch the [demo video of the CodeScene MCP](https://www.youtube.com/watch?v=AycLVxKmVSY).

> [!NOTE]
> CodeScene MCP comes with a set of [example prompts](.github/prompts) and an [AGENTS.md](AGENTS.md) file to capture the key use cases and guide your AI agents. Copy the `AGENTS.md` file to your own repository.

With the CodeScene MCP Server in place, your AI tools can:

### Safeguard AI-Generated Code
Prevent AI from introducing technical debt by flagging maintainability issues like complexity, deep nesting, low cohesion, etc.

### Uplifting Unhealthy Code for AI Readiness: Refactoring With ACE + AI
AI works best on healthy, modular code. Many legacy functions are too large or complex for reliable AI refactoring, which leads to poor suggestions and unstable changes.  
[CodeScene ACE](https://codescene.com/product/integrations/ide-extensions/ai-refactoring), exposed through the MCP server, helps by *first* restructuring these complex functions into smaller and more cohesive units. This modularity makes the code far easier for AI agents to understand and refactor safely.

The result is a cooperative workflow where:  
- **CodeScene ACE improves modularity and structure**,  
- **AI performs more precise refactorings**, and  
- **Code Health guides both toward maintainable outcomes**.

🎗️ ACE is a **CodeScene add-on** and requires an additiona