Skip to content

ClassicalDude/swift-mcp-server

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

18 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Swift MCP Server - Community Fork for Claude Code & Vibe

Production-ready Swift analysis via Model Context Protocol - Now fully functional with Claude Code, Vibe CLI, and other MCP clients!

Swift 6 Compatible MIT License MCP Compatible

🎯 What Is This Fork?

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

πŸ› What Was Fixed?

The original server had 10 out of 15 tools broken due to:

  1. 5 schema bugs - Missing required parameters caused "Invalid params" errors
  2. 4 mocked tools - Returned fake data instead of real analysis

See CHANGELOG-COMMUNITY.md for detailed fix documentation.

πŸš€ Quick Start

Prerequisites

  • macOS 13.0+ or Linux
  • Swift 5.9+
  • Xcode 15.0+ (for macOS)

Installation

# 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-server

Configuration for Claude Code

Add 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"
      ]
    }
  }
}

Configuration for Vibe CLI

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"
]

Verify Installation

# 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.

πŸ› οΈ Available Tools (15 Total - All Working!)

Symbol Analysis (100% Functional)

  • βœ… 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)

Project Analysis (100% Functional)

  • βœ… 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)

Project Management (100% Functional)

  • βœ… 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

πŸ“– Usage Examples

Architecture Analysis

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)

Symbol Search

Ask: "Find all symbols matching 'ViewController' in the project"

Tool used: find_symbols
Result: List of all ViewControllers with locations

Migration Planning

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

Framework Analysis

Ask: "Is this project using UIKit or SwiftUI?"

Tool used: analyze_ios_frameworks
Result: Framework breakdown (e.g., "76 UIKit imports, 28 ViewControllers")

πŸ†š Comparison with Other Swift MCP Servers

Feature This Fork SwiftLens gzaal/swift-mcp-server
Architecture Detection βœ… Unique ❌ ❌
POP Analysis βœ… Unique ❌ ❌
Compiler Accuracy ⚠️ Regex-based βœ… SourceKit-LSP ❌
Real Formatting ❌ ❌ βœ… swift-format
Documentation Search ❌ ❌ βœ… TSPL/DocC
Migration Planning βœ… Unique ❌ ❌
Setup Complexity βœ… Easy ⚠️ Needs index βœ… 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

πŸ” Known Limitations

  1. Storyboard/XIB files not analyzed - Only searches .swift files

    • Impact: Symbol counts may be incomplete for UIKit projects
  2. Regex-based, not compiler-accurate - Uses pattern matching, not Swift compiler

    • Impact: May miss complex syntax cases
    • Alternative: Use SwiftLens for compiler-accurate analysis
  3. No integrated formatting - Requires external swift-format or SwiftFormat

    • Alternative: Use gzaal/swift-mcp-server for real formatting

🀝 Contributing to This Fork

This is a community fork focused on Claude Code and Vibe compatibility. Contributions welcome!

Priority Areas:

  1. Testing with more MCP clients (Cursor, Windsurf, Continue, etc.)
  2. Improving position-based symbol extraction accuracy
  3. Adding storyboard/XIB file support
  4. Writing comprehensive tests
  5. Documentation improvements

How to Contribute:

  1. Fork this repository
  2. Create a feature branch: git checkout -b feature/my-improvement
  3. Make your changes with tests
  4. Submit a pull request

πŸ“Š Testing Results

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)

πŸ™ Credits & Links

πŸ“ License

MIT License - same as original project

Copyright (c) 2024 anhptimx (original) Copyright (c) 2025 ClassicalDude (community fixes)

πŸ› Reporting Issues

For issues specific to this fork:

For issues with the original project:

πŸ—ΊοΈ Roadmap

  • 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!

About

Community fork with Claude Code & Vibe MCP client support

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Swift 97.3%
  • Shell 2.7%