Periphery Code Audit

Swift code analysis with Periphery - detect unused code and improve code quality

2MITother

Install

Config snippet generator goes here (5 client tabs)

README

# Periphery MCP Server

A [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server that wraps the [Periphery](https://github.com/peripheryapp/periphery) tool, enabling AI assistants to perform Swift code audits and detect unused code in iOS/macOS projects.

## Features

- **7 MCP Tools** for comprehensive code analysis
- **CLI Integration** - Uses Periphery CLI for stability and version flexibility
- **JSON Output** - Structured, parseable results perfect for AI interpretation
- **Flexible Scanning** - Support for Xcode projects and Swift Packages
- **Advanced Options** - Full control over Periphery scan configurations

## Quick Start

**Using Homebrew (Recommended):**

```bash
# 1. Install Periphery
brew install peripheryapp/periphery/periphery

# 2. Install Periphery MCP Server
brew tap zyntx-lab/tap
brew install periphery-mcp-server

# 3. Configure Claude Desktop
# Edit: ~/Library/Application Support/Claude/claude_desktop_config.json
# Add:
#   "periphery": {
#     "command": "/opt/homebrew/bin/periphery-mcp-server"
#   }

# 4. Restart Claude Desktop (Cmd+Q then reopen)

# 5. Test it
# In Claude Desktop: "Check if Periphery is installed"
```

**From Source:**

```bash
# 1. Install Periphery
brew install peripheryapp/periphery/periphery

# 2. Clone and build this server
git clone https://github.com/zyntx-lab/periphery-mcp-server.git
cd periphery-mcp-server
swift build -c release

# 3. Install to system path
sudo cp .build/release/periphery-mcp-server /usr/local/bin/
sudo chmod +x /usr/local/bin/periphery-mcp-server

# 4. Configure Claude Desktop
# Edit: ~/Library/Application Support/Claude/claude_desktop_config.json
# Add:
#   "periphery": {
#     "command": "/usr/local/bin/periphery-mcp-server"
#   }

# 5. Restart Claude Desktop (Cmd+Q then reopen)

# 6. Test it
# In Claude Desktop: "Check if Periphery is installed"
```

## Prerequisites

- macOS 13.0 or later
- Swift 6.0 or later
- [Periphery](https://github.com/peripheryapp/periphery) installed

### Installing Periphery

```bash
brew install peripheryapp/periphery/periphery
```

Or download from [Periphery releases](https://github.com/peripheryapp/periphery/releases).

## Installation

### Option 1: Homebrew (Recommended)

```bash
# Add the tap
brew tap zyntx-lab/tap

# Install the server
brew install periphery-mcp-server

# Verify installation
which periphery-mcp-server
# Should output: /opt/homebrew/bin/periphery-mcp-server
```

### Option 2: Download from GitHub Releases

Download the latest binary from [Releases](https://github.com/zyntx-lab/periphery-mcp-server/releases):

```bash
# Download and install
curl -L https://github.com/zyntx-lab/periphery-mcp-server/releases/download/v1.0.0/periphery-mcp-server \
  -o /usr/local/bin/periphery-mcp-server
chmod +x /usr/local/bin/periphery-mcp-server

# Verify installation
which periphery-mcp-server
# Should output: /usr/local/bin/periphery-mcp-server
```

### Option 3: Build from Source

```bash
# Clone the repository
git clone https://github.com/zyntx-lab/periphery-mcp-server.git
cd periphery-mcp-server

# Build release version
swift build -c release

# Install to system path (requires password)
sudo cp .build/release/periphery-mcp-server /usr/local/bin/
sudo chmod +x /usr/local/bin/periphery-mcp-server

# Verify installation
which periphery-mcp-server
# Should output: /usr/local/bin/periphery-mcp-server
```

### Option 4: Install from MCP Registry

The server is also available on the [MCP Registry](https://registry.modelcontextprotocol.io). Use your MCP-compatible client to install it directly.

## Configuration

### Claude Desktop

#### Step 1: Locate Your Config File

The config file is at: `~/Library/Application Support/Claude/claude_desktop_config.json`

#### Step 2: Edit the Configuration

**If you installed via Homebrew:**

```json
{
  "mcpServers": {
    "periphery": {
      "command": "/opt/homebrew/bin/periphery-mcp-server"
    }
  }
}
```

**If you installed to /usr/local/bin:**

```json
{
  "mcpServers": {
    "periphery": {
      "command": "/usr/local/bin/periphery-mcp-server"
    }
  }
}
```

**If you're using the build directory directly:**

```json
{
  "mcpServers": {
    "periphery": {
      "command": "/FULL/PATH/TO/periphery-mcp-server/.build/release/periphery-mcp-server"
    }
  }
}
```

**If you already have other MCP servers configured:**

```json
{
  "mcpServers": {
    "xcode": {
      "command": "node",
      "args": ["/path/to/xcode-mcp-server/dist/index.js"]
    },
    "periphery": {
      "command": "/usr/local/bin/periphery-mcp-server"
    }
  }
}
```

#### Step 3: Restart Claude Desktop

**Important:** You must completely quit and restart Claude Desktop for changes to take effect.

1. Quit Claude Desktop: Press `Cmd+Q` or use Claude Desktop → Quit
2. Wait a few seconds
3. Reopen Claude Desktop

#### Step 4: Verify It's Working

Open a new conversation in Claude Desktop and try:

```
"Check if Periphery is installed"
```

If configured correctly, Claude will us