MCP Catalogs
Home

swiftlens

by swiftlens·124·Score 44

SwiftLens MCP server enables AI models to understand Swift codebases with compiler-grade accuracy via SourceKit-LSP integration.

developer-toolsai-llmother
6
Forks
4
Open issues
10 mo ago
Last commit
2d ago
Indexed

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:

you:AI-assisted code refactoring and modernization of Swift applications
you:Deep code analysis and documentation generation for Swift projects
you:Cross-referencing and impact analysis during code changes

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 README
  • swift_analyze_file

    Analyze structure and symbols in a Swift file

  • swift_analyze_multiple_files

    Batch analyze multiple Swift files

  • swift_summarize_file

    Get symbol counts and file summary

  • swift_get_symbols_overview

    Extract top-level type declarations

  • swift_get_declaration_context

    Get fully-qualified symbol paths

  • swift_get_file_imports

    Extract import statements

  • swift_validate_file

    Validate syntax and types with swiftc

  • swift_check_environment

    Verify Swift development setup

  • swift_build_index

    Build index store for current project

  • swift_find_symbol_references

    Find all references to a symbol

  • swift_get_symbol_definition

    Jump to symbol definition

  • swift_get_hover_info

    Get type info and documentation

Comparable tools

sourcekit-lsp-mcpswift-analyzer-mcpxcode-mcp

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

GitHub →

Last updated · Auto-generated from public README + GitHub signals.