swiftlens
by swiftlens·★ 124·Score 44
SwiftLens MCP server enables AI models to understand Swift codebases with compiler-grade accuracy via SourceKit-LSP integration.
Overview
SwiftLens is a specialized MCP server designed specifically for iOS/Swift development. It bridges AI agents and Swift codebases by providing semantic-level analysis with Xcode-grade accuracy through direct integration with Apple's SourceKit-LSP. The server offers 15 different tools for single-file and cross-file analysis, symbol navigation, and code modification capabilities. It features token-optimized output for efficient AI interactions and works out-of-the-box with standard Swift projects, though requires an index store for cross-file analysis.
Try asking AI
After installing, here are 3 things you can ask your AI assistant:
When to choose this
Choose SwiftLens when working with Swift codebases and need AI assistance with code analysis, refactoring, or documentation generation with compiler-level accuracy.
When NOT to choose this
Avoid if not using Swift or macOS, as SourceKit-LSP integration requires Apple's development tools exclusively.
Tools this server exposes
12 tools extracted from the READMEswift_analyze_fileAnalyze structure and symbols in a Swift file
swift_analyze_multiple_filesBatch analyze multiple Swift files
swift_summarize_fileGet symbol counts and file summary
swift_get_symbols_overviewExtract top-level type declarations
swift_get_declaration_contextGet fully-qualified symbol paths
swift_get_file_importsExtract import statements
swift_validate_fileValidate syntax and types with swiftc
swift_check_environmentVerify Swift development setup
swift_build_indexBuild index store for current project
swift_find_symbol_referencesFind all references to a symbol
swift_get_symbol_definitionJump to symbol definition
swift_get_hover_infoGet type info and documentation
Comparable tools
Installation
Installation
Prerequisites
- macOS (required for SourceKit-LSP)
- Python 3.10+
- Xcode (full installation from App Store)
Quick Start
Configure for Claude Code / Gemini CLI
Add to your JSON configuration file mcpServers section:
{
"mcpServers": {
"swiftlens": {
"command": "uvx",
"args": ["swiftlens"]
}
}
}Build SourceKit LSP Index
SwiftLens requires an index store for cross-file analysis. Build it with:
# Navigate to your Swift project
cd /path/to/your/swift/project
# Build with index store
swift build -Xswiftc -index-store-path -Xswiftc .build/index/store**Important**: Rebuild the index when you add new Swift files, change public interfaces, or notice missing symbol references.
Compare swiftlens with
Last updated · Auto-generated from public README + GitHub signals.