
Periphery Code Audit
io.github.zyntx-lab由 GitHub 帳號 zyntx-lab 發布v1.0.0更新於 Oct 24, 2026
Swift code analysis with Periphery - detect unused code and improve code quality
發布方自己的服務:audit.domains - Domain Valuation
概覽
一個本機 MCP 伺服器,封裝 Periphery CLI,讓助理稽核 Swift 專案中未使用的程式碼、匯入與過度公開的宣告。
- 可以做什麼
- 檢查 Periphery CLI 是否已安裝,並回報其版本與路徑,以便及早發現設定問題。對 Xcode 專案或 Swift 套件執行基本掃描,回傳包含未使用宣告與摘要資訊的結構化 JSON 結果。可依 YAML 設定檔掃描,或使用進階參數,例如保留 public 或 @objc 宣告、關閉未使用匯入分析、指定索引儲存路徑與詳細輸出。針對特定檢查:未使用的匯入,以及可改為 internal 的 public 宣告。
- 適用情境
- 適合在整理 iOS 或 macOS 程式碼庫時使用,讓助理在 Xcode 專案或 Swift 套件中找出無用程式碼、未使用的匯入或不必要的公開 API,並在對話中說明結果。
- 執行需求
- 以本機二進位檔執行,需要 macOS 13.0 或更新版本以及 Swift 6.0 或更新版本。需另外安裝 Periphery CLI 並使其位於路徑中。專案需先建置以產生索引儲存,scheme 應設為共享。可透過 Homebrew、GitHub 發行版二進位檔、原始碼建置或 MCP 登錄檔安裝,並在用戶端的 MCP 設定檔中設定。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Periphery Code Audit,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Periphery MCP Server
A Model Context Protocol (MCP) server that wraps the 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):
From Source:
Prerequisites
- macOS 13.0 or later
- Swift 6.0 or later
- Periphery installed
Installing Periphery
Or download from Periphery releases.
Installation
Option 1: Homebrew (Recommended)
Option 2: Download from GitHub Releases
Download the latest binary from Releases:
Option 3: Build from Source
Option 4: Install from MCP Registry
The server is also available on the MCP Registry. 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:
If you installed to /usr/local/bin:
If you're using the build directory directly:
If you already have other MCP servers configured:
Step 3: Restart Claude Desktop
Important: You must completely quit and restart Claude Desktop for changes to take effect.
- Quit Claude Desktop: Press
Cmd+Qor use Claude Desktop → Quit - Wait a few seconds
- Reopen Claude Desktop
Step 4: Verify It's Working
Open a new conversation in Claude Desktop and try:
If configured correctly, Claude will use the check_periphery_installed tool and respond with installation status.
Testing with MCP Inspector
Before configuring Claude Desktop, you can test the server with the MCP Inspector:
The Inspector will open in your browser where you can test all tools interactively.
Other Editors
VS Code
Add to .vscode/mcp.json:
Cursor
Add to .cursor/mcp.json:
Available Tools
1. check_periphery_installed
Verify that Periphery CLI is installed and accessible.
Parameters: None
Example Response:
2. get_periphery_version
Get the installed version of Periphery.
Parameters: None
Example Response:
3. scan_project
Run a basic Periphery scan on a project.
Parameters:
project_path(required): Path to .xcodeproj or Package.swiftschemes(optional): Build schemes to scan (Xcode only)targets(optional): Specific targets to analyzeformat(optional): Output format: json, xcode, csv, checkstyle (default: json)
Example Response:
4. scan_with_config
Run Periphery scan using a YAML configuration file.
Parameters:
config_path(required): Path to .periphery.yml config file
5. analyze_unused_imports
Focus specifically on detecting unused imports.
Parameters:
project_path(required): Path to .xcodeproj or Package.swiftschemes(optional): Build schemes to scantargets(optional): Specific targets to analyze
6. find_redundant_public
Identify public declarations that could be internal.
Parameters:
project_path(required): Path to .xcodeproj or Package.swiftschemes(optional): Build schemes to scantargets(optional): Specific targets to analyze
7. scan_with_options
Advanced scanning with custom Periphery flags.
Parameters:
project_path(required): Path to .xcodeproj or Package.swiftschemes(optional): Build schemes to scantargets(optional): Specific targets to analyzeformat(optional): Output formatretain_public(optional): Retain all public declarationsretain_objc_accessible(optional): Retain @objc declarationsdisable_unused_import_analysis(optional): Disable unused import analysisindex_store_path(optional): Custom index store locationverbose(optional): Enable verbose output
Usage Examples
With Claude Desktop
Once configured, you can have natural conversations with Claude about your code:
Check Installation:
Scan a Project:
Find Redundant Public:
Analyze Unused Imports:
With Custom Configuration
Create .periphery.yml in your project:
Then use scan_with_config:
Troubleshooting
Server Not Appearing in Claude Desktop
Symptoms: Claude doesn't recognize Periphery tools after configuration
Solutions:
-
Verify config file syntax:
-
Check the binary path is correct:
-
Completely restart Claude Desktop:
- Press
Cmd+Qto quit (not just close the window) - Wait 5 seconds
- Reopen Claude Desktop
- Start a new conversation (old conversations won't see new servers)
- Press
-
Check Claude Desktop logs:
Periphery Not Found
If you get "Periphery is not installed":
- Install Periphery:
brew install peripheryapp/periphery/periphery - Verify installation:
which periphery - Restart Claude Desktop/VS Code/Cursor
- Try the
check_periphery_installedtool again
MCP Inspector Connection Errors
If the Inspector can't connect to the server:
-
Verify the server runs:
-
Check for errors:
-
Use the absolute path:
Scan Timeout
Default timeout is 5 minutes. For large projects:
- Use
scan_with_configwith a focused configuration - Scan specific targets instead of the entire project
- Use
--index-store-pathto reuse build artifacts - Build your project in Xcode first to generate the index
No Results or Empty Scan
Periphery requires a compiled project with an index store:
- Build your project first in Xcode (Cmd+B)
- Ensure schemes are shared:
- Xcode → Product → Scheme → Manage Schemes
- Check the "Shared" checkbox for your scheme
- Verify the project path:
- Check Periphery can access the project:
Permission Denied
If you get "Permission denied" when running the server:
Architecture
This server uses the CLI approach rather than importing Periphery as a library for maximum stability:
- ✅ CLI interface is Periphery's public API contract
- ✅ Survives internal Periphery refactorings
- ✅ Users can update Periphery independently
- ✅ Simpler dependency management
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Submit a pull request
License
MIT License - see LICENSE file for details.
Related Projects
- Periphery - The underlying code analysis tool
- Model Context Protocol - The protocol specification
- MCP Swift SDK - Official Swift SDK for MCP
- MCP Registry - Official MCP server registry
- MCP Community Servers - Collection of community MCP servers
Distribution Channels
This server is available through multiple channels:
- MCP Registry: registry.modelcontextprotocol.io
- Homebrew Tap: github.com/zyntx-lab/homebrew-tap
- GitHub Releases: github.com/zyntx-lab/periphery-mcp-server/releases
- Community Servers: Listed in modelcontextprotocol/servers
Support
- Issues: GitHub Issues
- Periphery Docs: Periphery Guide
- MCP Docs: MCP Specification
來源:README.md,提交 cbb2a2f
工具
0版本歷史
1- v1.0.0最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
其他 Audit 整合
audit.domains - Domain Valuation
domains.audit官方發布者
確定性的網域名稱估值服務:提供公允價值區間、真實可比成交紀錄、可用性查詢,以及經 DNS 驗證的待售網域市場。
Revenue Agent — OpenAPI Audit & Change Detection
news.prh官方發布者
一個遠端 MCP 端點,用於稽核 OpenAPI 規格並偵測 API 變更,每次分析透過 Base 上的 x402 收取 0.10 USDC。

SEO Audit & Broken Link Checker
由 GitHub 帳號 prometheus-maker 發布
由 Apify 託管的 MCP 伺服器,用來稽核網站頁面的 SEO 中繼資料並找出失效連結與圖片,回傳每頁評分。

FinePrint AI Legal Risk & Contract Audit MCP Server
由 GitHub 帳號 RitualDev-Lab 發布
在本機記憶體中執行的合約風險掃描器,為編碼代理評估法律合約、NDA 與租約風險並產生修訂建議。

Mcp Supply Audit
由 GitHub 帳號 kimmawla 發布
把 MCP 伺服器當成供應鏈產物來稽核:登錄檔項目、PyPI/npm 套件、用戶端設定與工具定義,全為唯讀靜態檢查。