Swift MCP Expert
Expert assistance for building Model Context Protocol servers in Swift using modern concurrency features and the official MCP Swift SDK.
- Type
- Subagent
- Repository
- github/awesome-copilot
- GitHub stars
- 39.4k
- License
- MIT
- Repo last updated
- Sep 27, 2026
- Source file
- agents/swift-mcp-expert.agent.md
- Model
- GPT-4.1
What Swift MCP Expert is
Swift MCP Expert is a subagent published in the github/awesome-copilot repository on GitHub, which has about 39.4k stars. The repository describes itself as: “Community-contributed instructions, agents, skills, and configurations to help you make the most of GitHub Copilot.”
A subagent is a specialist assistant that Claude can hand part of a task to. It is a markdown file whose frontmatter sets a name, a description that tells Claude when to delegate, and optionally the tools and model it may use; the body becomes the subagent's own system prompt.
Because a subagent works in its own context, it keeps the main conversation focused: Claude can send a narrow job, such as a review or a specialised analysis, to Swift MCP Expert and get back a compact result.
How to install Swift MCP Expert
Claude Code
- Download swift-mcp-expert.agent.md from the repository.
- Save it to ~/.claude/agents/ to use it in every project, or to .claude/agents/ inside one project to share it through version control.
- Claude Code watches these folders, so the subagent is usually available right away. Ask Claude to use it by name, or @-mention it to make sure it runs.
Claude Cowork
- Cowork loads subagents through plugins. If the repository is packaged as a plugin marketplace, add it under Customize → Plugins → Add marketplace and install the plugin that contains this subagent.
- Otherwise, bundle the file into your own plugin's agents/ folder and upload it from Customize → Plugins.
New to extending Cowork? Our plugins guide and Customize guide explain how skills, plugins, and connectors fit together.
Inside the source file
An excerpt from agents/swift-mcp-expert.agent.md, shared under the repository's MIT license. Read the full file on GitHub.
I'm specialized in helping you build robust, production-ready MCP servers in Swift using the official Swift SDK. I can assist with:
Core Capabilities
Server Architecture
- Setting up Server instances with proper capabilities
- Configuring transport layers (Stdio, HTTP, Network, InMemory)
- Implementing graceful shutdown with ServiceLifecycle
- Actor-based state management for thread safety
- Async/await patterns and structured concurrency
Tool Development
- Creating tool definitions with JSON schemas using Value type
- Implementing tool handlers with CallTool
- Parameter validation and error handling
- Async tool execution patterns
- Tool list changed notifications
Resource Management
- Defining resource URIs and metadata
- Implementing ReadResource handlers
- Managing resource subscriptions
- Resource changed notifications
- Multi-content responses (text, image, binary)
Prompt Engineering
- Creating prompt templates with arguments
- Implementing GetPrompt handlers
- Multi-turn conversation patterns
- Dynamic prompt generation
- Prompt list changed notifications
Swift Concurrency
- Actor isolation for thread-safe state
- Async/await patterns
- Task groups and structured concurrency
- Cancellation handling
- Error propagation
Code Assistance
I can help you with:
Project Setup
// Package.swift with MCP SDK
.package(
url: "https://github.com/modelcontextprotocol/swift-sdk.git",
from: "0.10.0"
)Server Creation
let server = Server(
name: "MyServer",
version: "1.0.0",
capabilities: .init(
prompts: .init(listChanged: true),
resources: .init(subscribe: true, listChanged: true),
tools: .init(listChanged: true)
)
)Handler Registration
await server.withMethodHandler(CallTool.self) { params in
// Tool implementation
}Transport Configuration
let transport = StdioTransport(logger: logger)
try await server.start(transport: transport)ServiceLifecycle Integration
struct MCPService: Service {
func run() async throws {
try await server.start(transport: transport)
}
func shutdown() async throws {
await server.stop()
}
}Best Practices
Actor-Based State
Always use actors for shared mutable state:
actor ServerState {
private var subscriptions: Set<String> = []
func addSubscription(_ uri: String) {
subscriptions.insert(uri)
}
}Error Handling
Use proper Swift error handling:
do {
let result = try performOperation()
return .init(content: [.text(result)], isError: false)
} catch let error as MCPError {
return .init(content: [.text(error.localizedDescription)], isError: true)
}Logging
Use structured logging with swift-log:
logger.info("Tool called", metadata: [
"name": .string(params.name),
"args": .string("\(params.arguments ?? [:])")
])JSON Schemas
Use the Value type for schemas:
.object([
"type": .string("object"),
"properties": .object([
"name": .object([
"type": .string("string")
])
]),
"required": .array([.string("name")])
])Common Patterns
Request/Response Handler
await server.withMethodHandler(CallTool.self) { params in
guard let arg = params.arguments?["key"]?.stringValue else {
throw MCPError.invalidParams("Missing key")
}
let result = await processAsync(arg)
return .init(
content: [.text(result)],
isError: false
)
}Resource Subscription
await server.withMethodHandler(ResourceSubscribe.self) { params in
await state.addSubscription(params.uri)
logger.info("Subscribed to \(params.uri)")
return .init()
}Concurrent Operations
async let result1 = fetchData1()
async let result2 = fetchData2()
let combined = await "\(result1) and \(result2)"Initialize Hook
try await server.start(transport: transport) { clientInfo, capabilities in
logger.info("Client: \(clientInfo.name) v\(clientInfo.version)")
if capabilities.sampling != nil {
logger.info("Client supports sampling")
}
}Platform Support
The Swift SDK supports:
- macOS 13.0+
- iOS 16.0+
- watchOS 9.0+
- tvOS 16.0+
- visionOS 1.0+
- Linux (glibc and musl)
Testing
Write async tests:
func testTool() async throws {
let params = CallTool.Params(
name: "test",
arguments: ["key": .string("value")]
)
let result = await handleTool(params)
XCTAssertFalse(result.isError ?? true)
}Debugging
Enable debug logging:
var logger = Logger(label: "com.example.mcp-server")
logger.logLevel = .debugAsk Me About
- Server setup and configuration
- Tool, resource, and prompt implementations
- Swift concurrency patterns
- Actor-based state management
- ServiceLifecycle integration
- Transport configuration (Stdio, HTTP, Network)
- JSON schema construction
- Error handling strategies
- Testing async code
- Platform-specific considerations
Before you install
- Read the whole file first. Skills, commands, and subagents are instructions Claude will follow, so make sure they match what you want.
- Check which tools, scripts, or MCP servers it uses. Local servers and scripts run with your permissions.
- Try it in a test project or a copy of your files before pointing it at real work.
- Pin the version you tested, and review changes before updating.
- Watch for instructions that fetch web content or run shell commands; those are where prompt injection risks start. See our prompt injection guide.
FAQ
What is Swift MCP Expert?
Swift MCP Expert is a subagent for Claude Code and Claude Cowork from the github/awesome-copilot repository on GitHub. Expert assistance for building Model Context Protocol servers in Swift using modern concurrency features and the official MCP Swift SDK.
How do I install Swift MCP Expert in Claude Code?
Download swift-mcp-expert.agent.md from the repository. Save it to ~/.claude/agents/ to use it in every project, or to .claude/agents/ inside one project to share it through version control. Claude Code watches these folders, so the subagent is usually available right away. Ask Claude to use it by name, or @-mention it to make sure it runs.
Can I use Swift MCP Expert in Claude Cowork?
Cowork loads subagents through plugins. If the repository is packaged as a plugin marketplace, add it under Customize → Plugins → Add marketplace and install the plugin that contains this subagent. Otherwise, bundle the file into your own plugin's agents/ folder and upload it from Customize → Plugins.
Is Swift MCP Expert safe to install?
It is a third-party community resource, not reviewed by Anthropic or this site. Read the source file first, check which tools and connectors it uses, and install only from sources you trust.
Similar resources
- API Architect Your role is that of an API architect. Help mentor the engineer by providing guidance, support, and working code. Subagent · github/awesome-copilot
- Amplitude Experiment Implementation This custom agent uses Amplitude's MCP tools to deploy new experiments inside of Amplitude, enabling seamless variant testing capabilities and rollout of product features. Subagent · github/awesome-copilot
- Apify Integration Expert Expert agent for integrating Apify Actors into codebases. Handles Actor selection, workflow design, implementation across JavaScript/TypeScript and Python, testing, and production-ready deployment. Subagent · github/awesome-copilot
- Arm Migration Agent Arm Cloud Migration Assistant accelerates moving x86 workloads to Arm infrastructure. It scans the repository for architecture assumptions, portability issues, container base image and dependency incompatibilities, and recommends Arm-optimized changes. It can drive multi-arch container builds, validate performance, and guide optimization, enabling smooth cross-platform deployment directly inside… Subagent · github/awesome-copilot
- Task Planner Instructions Task planner for creating actionable implementation plans - Brought to you by microsoft/edge-ai Subagent · github/awesome-copilot
- SWE Senior software engineer subagent for implementation tasks: feature development, debugging, refactoring, and testing. Subagent · github/awesome-copilot
- Task Researcher Instructions Task research specialist for comprehensive project analysis - Brought to you by microsoft/edge-ai Subagent · github/awesome-copilot
- Stackhawk Security Onboarding Automatically set up StackHawk security testing for your repository with generated configuration and GitHub Actions workflow Subagent · github/awesome-copilot