A community-driven registry for Claude, Cursor, Windsurf, Cline & more. Not affiliated with Anthropic.
Are you the author? Sign in to claim
SwiftLens is a Model Context Protocol (MCP) server that provides deep, semantic-level analysis of Swift codebases to any
SwiftLens 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 statementsswift_validate_file - Validate syntax and types with swiftcswift_check_environment - Verify Swift development setupswift_build_index - Build index store db of current project for sourcekit-lspswift_find_symbol_references - Find all references to a symbolswift_get_symbol_definition - Jump to symbol definitionswift_get_hover_info - Get type info and documentationswift_replace_symbol_body - Replace function/type bodyswift_search_pattern - Search with regex patternsget_tool_help - Get help for any toolAsk your AI agent:
"Analyze the UserManager.swift file and find all references to the login() method"
The AI will use SwiftLens tools to:
SwiftLens includes a web dashboard for monitoring AI interactions:
Rebuild your index:
swift build -Xswiftc -index-store-path -Xswiftc .build/index/store
New files need to be indexed:
swift build -Xswiftc -index-store-path -Xswiftc .build/index/store
Ensure Xcode is properly installed:
xcode-select -p # Should show Xcode path
xcrun sourcekit-lsp --help # Should show help text
The SwiftLens MCP Server accurately reflects SourceKit-LSP's capabilities. The following are known limitations of SourceKit-LSP itself, not bugs in this tool:
object.property often don't provide hover information when inside functionsThese limitations exist because SourceKit-LSP:
For the most up-to-date status, see the SourceKit-LSP repository.
# All tests
make test
# Unit tests only (fast, no LSP required)
make test-unit
# LSP integration tests
make test-lsp
# Check environment
make check-env
# Format code
./format.sh
# Check formatting
./format.sh check
See LICENSE.md for details.
We welcome contributions! Areas where you can help:
SwiftLens - Bringing compiler-grade Swift understanding to AI development
mcp-language-server gives MCP enabled clients access semantic tools like get definition, references, rename, and diagnos
Run Claude Code as an MCP server so any agent can delegate coding tasks to it
MCP server integration for DaVinci Resolve Studio