Production-ready Swift analysis via Model Context Protocol - Now fully functional with Claude Code, Vibe CLI, and other MCP clients!
This is a community-maintained fork of anhptimx/swift-mcp-server with critical bug fixes that make all 15 tools fully functional with MCP clients like:
- β Claude Code (Anthropic's CLI tool)
- β Vibe CLI (Mistral's coding agent)
- β Claude Desktop (Anthropic's desktop app)
- β Cursor (AI-powered code editor)
- β Any MCP-compatible client
The original server had 10 out of 15 tools broken due to:
- 5 schema bugs - Missing required parameters caused "Invalid params" errors
- 4 mocked tools - Returned fake data instead of real analysis
See CHANGELOG-COMMUNITY.md for detailed fix documentation.
- macOS 13.0+ or Linux
- Swift 5.9+
- Xcode 15.0+ (for macOS)
# Clone this fork
git clone https://github.com/ClassicalDude/swift-mcp-server.git
cd swift-mcp-server
# Build release version
swift build -c release
# Binary will be at: .build/release/swift-mcp-serverAdd to your Claude Code config (~/.config/claude/config.json):
{
"mcpServers": {
"swift-analysis": {
"command": "/path/to/swift-mcp-server/.build/release/swift-mcp-server",
"args": [
"--transport", "stdio",
"--workspace", "/path/to/your/swift/project",
"--log-level", "error"
]
}
}
}Add to your Vibe config (~/.vibe/config.toml):
[[mcp_servers]]
name = "swift-mcp-server"
transport = "stdio"
command = "/path/to/swift-mcp-server/.build/release/swift-mcp-server"
args = [
"--transport", "stdio",
"--workspace", "/path/to/your/swift/project",
"--log-level", "error"
]# In Claude Code or Vibe, ask:
"Use the swift-mcp-server_analyze_project tool to analyze this project"
# Expected output: Real analysis with file counts, architecture pattern, etc.- β find_symbols - Search for symbols by name pattern
- β find_references - Find all references to a symbol (FIXED: now uses real analysis)
- β get_definition - Get symbol definition location (FIXED: now returns real data)
- β get_hover_info - Get symbol information (FIXED: now returns real data)
β οΈ format_document - Requires external swift-format (FIXED: honest message)
- β analyze_project - Project metrics and architecture (FIXED: schema bug)
- β detect_architecture - Identify MVC/MVVM/VIPER/etc. (FIXED: schema bug)
- β analyze_symbol_usage - Symbol occurrence analysis (FIXED: schema bug)
- β analyze_pop_usage - Protocol-oriented programming metrics
- β analyze_ios_frameworks - Framework usage (UIKit vs SwiftUI)
- β create_project_memory - Capture key symbols/patterns (FIXED: schema bug)
- β intelligent_project_memory - Cached analysis with evolution tracking
- β generate_documentation - Auto-generate README and API docs
- β generate_migration_plan - Architecture migration planning (FIXED: schema + enum)
- β generate_template - Project template generation
Ask Claude Code/Vibe:
"What architecture pattern is this Swift project using?"
Tool used: detect_architecture
Result: "Custom" (or MVC, MVVM, VIPER, Features-based, Clean Architecture, Modular)
Ask: "Find all symbols matching 'ViewController' in the project"
Tool used: find_symbols
Result: List of all ViewControllers with locations
Ask: "How would I migrate this project from MVC to MVVM?"
Tool used: generate_migration_plan
Result: 5-step migration plan with effort estimate and risks
Ask: "Is this project using UIKit or SwiftUI?"
Tool used: analyze_ios_frameworks
Result: Framework breakdown (e.g., "76 UIKit imports, 28 ViewControllers")
| Feature | This Fork | SwiftLens | gzaal/swift-mcp-server |
|---|---|---|---|
| Architecture Detection | β Unique | β | β |
| POP Analysis | β Unique | β | β |
| Compiler Accuracy | β SourceKit-LSP | β | |
| Real Formatting | β | β | β swift-format |
| Documentation Search | β | β | β TSPL/DocC |
| Migration Planning | β Unique | β | β |
| Setup Complexity | β Easy | β Easy | |
| Claude Code Support | β Tested | β Yes | β Yes |
| Vibe CLI Support | β Tested | β Yes | β Yes |
Recommendation: Use multiple servers together!
- This fork: Architecture analysis and migration planning
- SwiftLens: Compiler-accurate symbol analysis
- gzaal: Documentation lookup and real formatting
-
Storyboard/XIB files not analyzed - Only searches
.swiftfiles- Impact: Symbol counts may be incomplete for UIKit projects
-
Regex-based, not compiler-accurate - Uses pattern matching, not Swift compiler
- Impact: May miss complex syntax cases
- Alternative: Use SwiftLens for compiler-accurate analysis
-
No integrated formatting - Requires external swift-format or SwiftFormat
- Alternative: Use gzaal/swift-mcp-server for real formatting
This is a community fork focused on Claude Code and Vibe compatibility. Contributions welcome!
- Testing with more MCP clients (Cursor, Windsurf, Continue, etc.)
- Improving position-based symbol extraction accuracy
- Adding storyboard/XIB file support
- Writing comprehensive tests
- Documentation improvements
- Fork this repository
- Create a feature branch:
git checkout -b feature/my-improvement - Make your changes with tests
- Submit a pull request
Verified working with:
- β Vibe CLI + LM Studio (Devstral Small 2)
- β Claude Code (Claude Sonnet 4.5)
- β All 15 tools tested and functional
Test project: StageAssistant (186 Swift files, 54,170 lines)
- Original Project: anhptimx/swift-mcp-server
- Community Fork: ClassicalDude/swift-mcp-server
- Bug Discovery: Testing with Vibe CLI and Claude Code (December 2025)
- Alternative Servers:
- SwiftLens - Compiler-accurate SourceKit-LSP integration
- gzaal/swift-mcp-server - Documentation & formatting
- Cocoanetics/SwiftMCP - Server builder framework
MIT License - same as original project
Copyright (c) 2024 anhptimx (original) Copyright (c) 2025 ClassicalDude (community fixes)
For issues specific to this fork:
- Open an issue on ClassicalDude/swift-mcp-server
For issues with the original project:
- Add comprehensive test suite
- Storyboard/XIB file support
- Improved position-based symbol extraction
- Swift Package Manager integration
- Docker image for easy deployment
- CI/CD pipeline
- Real SourceKit-LSP integration (future)
Made with β€οΈ for the Swift + AI community
Bringing production-ready Swift analysis to Claude Code, Vibe, and all MCP clients!