
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 包、客户端配置与工具定义,全部为只读静态检查。