home / mcp / swift mcp server

Swift MCP Server

Provides dual-transport MCP server for Swift projects with real-time analysis and VS Code integration.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "anhptimx-swift-mcp-server": {
      "command": "./swift-mcp.sh",
      "args": [
        "stdio"
      ],
      "env": {
        "SWIFT_MCP_MODE": "vscode"
      }
    }
  }
}

You have an production-ready Swift MCP Server that analyzes Swift projects, provides real-time feedback, and integrates with VS Code and other tools. It combines dual transport capabilities with a robust analysis engine to help you improve code quality, architecture, and performance in Swift projects.

How to use

Use the MCP client to connect to the server via either the HTTP API or the STDIO transport. You can run analyses, request architecture guidance, search symbols, and get performance-related insights. The server is designed to work with professional Swift workflows and to integrate smoothly into your IDE and CI processes.

How to install

Prerequisites you need to meet before installing: - Swift 5.9+ (Swift 6 compatible) - macOS 13.0+ or Linux Ubuntu 18.04+ - Xcode 15.0+ (includes SourceKit-LSP) for development and Swift tooling Follow these concrete steps to get up and running:

# 1) Clone the project
git clone https://github.com/your-username/swift-mcp-server.git
cd swift-mcp-server

# 2) Set up and install dependencies via the provided management script
./swift-mcp.sh

# 3) Build the production binary
swift build --configuration release

# 4) Verify the installation and see available commands
./.build/release/swift-mcp-server --help

Additional setup and quick-start tips

If you want to run the server in STDIO mode for tight IDE integration, use the STDIO transport. You typically start it with a single command and keep it running for multiple requests.

To use the all-in-one setup, you can run the management script which builds, configures, and tests functionality in under 30 seconds.

Available tools

list_symbols

Find all functions, classes, protocols, and variables with intelligent filtering.

find_references

Locate where symbols are used across the codebase.

get_definition

Navigate to symbol definitions.

analyze_project

Full project analysis and health metrics.

generate_documentation

Auto-generate comprehensive API documentation.

analyze_architecture

Detect architectural patterns and organization such as MVVM, VIPER, or TCA.