by swiftlens
SwiftLens is a Model Context Protocol (MCP) server that provides deep, semantic-level analysis of Swift codebases to any AI models. By integrating directly with Apple's SourceKit-LSP, SwiftLens enables AI models to understand Swift code with compiler-grade accuracy.
# Add to your Claude Code skills
git clone https://github.com/swiftlens/swiftlensSwiftLens is a Model Context Protocol (MCP) server that provides deep, semantic-level analysis of Swift codebases to AI agents. By integrating directly with Apple's SourceKit-LSP, SwiftLens enables AI models to understand Swift code with compiler-grade accuracy.
SwiftLens bridges AI models and Swift development through:
AI Agent (Claude/GPT) → MCP Protocol → SwiftLens → SourceKit-LSP → Swift Code
Add to your json configuration file mcpServers section:
{
"mcpServers": {
"swiftlens": {
"command": "uvx",
"args": ["swiftlens"]
}
}
}
SwiftLens will need proper sourcekit-lsp index in order to work properly you can either
"hey claude, run swift_build_index tool"
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: Rebuilding of the index is required when you:
SwiftLens provides 15 tools for Swift code analysis:
swift_analyze_file - Analyze structure and symbols in a Swift fileswift_analyze_multiple_files - Batch analyze multiple filesswift_summarize_file - Get symbol counts and file summaryswift_get_symbols_overview - Extract top-level type declarationsswift_get_declaration_context - Get fully-qualified symbol pathsswift_get_file_imports - Extract import statements