swift
🚀 Enhanced Swift MCP Server with Protocol-Oriented Programming Analysis and Architecture Detection
claude mcp add --transport stdio anhptimx-swift-mcp-server swift-mcp-server --transport stdio ${workspaceFolder} \
--env SWIFT_MCP_MODE="vscode"How to use
This Swift MCP server provides a production-ready Model Context Protocol (MCP) integration for Swift projects with dual transport (HTTP and STDIO) and a suite of analysis tools. It ships with a rich CLI and VS Code integration, enabling real-time architecture analysis, symbol search, reference tracking, and automated documentation generation. You can run the server in STDIO mode for seamless IDE integration or switch to HTTP to expose a production-grade API for external tooling. Use the available tools to analyze projects, map dependencies, and get guidance on performance and memory usage.
To connect from VS Code, configure the MCP extension to launch the server in STDIO mode and point it at your workspace. For production usage, start the HTTP server with a config file and a port, for example by running the server binary with --transport http and --port. The toolset includes core analyses like list_symbols, find_references, analyze_architecture, and generate_documentation, along with advanced features such as iOS framework analysis, dependency mapping, and performance analysis. These capabilities enable end-to-end project health checks and actionable recommendations right from your Swift projects.
How to install
Prerequisites:
- Swift 5.9+ (Swift 6 compatible) installed on macOS or Linux
- Xcode or Swift toolchain with swift build available
- Basic familiarity with Swift Package Manager projects
Installation steps:
- Clone the repository: git clone https://github.com/your-username/swift-mcp-server.git cd swift-mcp-server
- Build the production binary: swift build --configuration release
- Verify installation and run the server (example for STDIO mode):
./swift-mcp.sh # or run the built binary directly
Alternatively, run the binary explicitly
./.build/release/swift-mcp-server --help - For HTTP API usage, start the server with an HTTP config and port, e.g.: ./.build/release/swift-mcp-server --config http-config.json --transport http --port 9000
- Optional: Set up VS Code integration using the provided swift-mcp.sh script or manual configuration as shown in the README.
Additional notes
Tips and common issues:
- If you encounter Exit Code 64, ensure positional arguments are supported by your MCP extension and pass the workspace path as a positional argument.
- Use the STDIO transport for tight IDE integration; for production, prefer HTTP transport with a proper config file and secure access.
- The configuration supports environment variables to tailor behavior per environment (e.g., SWIFT_MCP_MODE for VS Code integration).
- Regularly run health checks and tests via the included script (swift-mcp.sh) to verify integration points and tool availability.
- Ensure the Swift toolchain is up-to-date to take advantage of Swift 6 concurrency features and improved performance.
Related MCP Servers
swift-sdk
The official Swift SDK for Model Context Protocol servers and clients.
memory
A Model Context Protocol server that provides knowledge graph management capabilities.
Claude-Project-Coordinator
Claude Project Coordinator is a Swift-powered MCP (Model Context Protocol) server designed to streamline multi-project Xcode development. It lets you track project status, auto-detect frameworks, search code patterns, and maintain a structured development knowledge base — all locally, with Claude Desktop as your assistant.
shortcuts
Shortcuts + MCP = ♥️
macPilotCli
MacPilot CLI is a mcp server, It provides a collection of system tools that allow AI assistants to perform various operations on macOS systems.
riffmcp
Native macOS MCP server that lets LLMs compose and play music