swift-fast-mcp: Agent for Claude Code

.claude/agents/swift-mcp-expert.md

swift-mcp-expert is an agent for Claude Code from mehmetbaykar/swift-fast-mcp. It costs 69 tokens per session (2,765 once invoked), scanned A, original, MIT.

An expert assistant for building MCP servers in Swift with FastMCP. It covers the code patterns used to define tools, resources, prompts, data schemas, transports, and tests.

In plain words
What is it for?
Writing or debugging Swift tools, resources, and prompts; configuring server transports such as local or HTTP connections; handling duplicate names; and writing Swift tests.
Why use it?
It helps developers use FastMCP's documented interfaces correctly and investigate problems in Swift MCP server code.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter; reads .claude/ paths.

This is mehmetbaykar/swift-fast-mcp's own configuration. It tells Claude Code how to work on swift-fast-mcp itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything swift-fast-mcp configures →

Reuse

Borrowing it

Nothing to install: this file belongs to mehmetbaykar/swift-fast-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/mehmetbaykar/swift-fast-mcp/main/.claude/agents/swift-mcp-expert.md
Clone the repo
git clone --depth 1 https://github.com/mehmetbaykar/swift-fast-mcp

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for swift-mcp-expert

README.md
[![agentmods](https://agentmods.dev/badge/agents/mehmetbaykar/swift-fast-mcp/swift-mcp-expert/github.svg)](https://agentmods.dev/agents/mehmetbaykar/swift-fast-mcp/swift-mcp-expert)
Your own site
<a href="https://agentmods.dev/agents/mehmetbaykar/swift-fast-mcp/swift-mcp-expert"><img src="https://agentmods.dev/badge/agents/mehmetbaykar/swift-fast-mcp/swift-mcp-expert/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for swift-mcp-expert

Your own site · 80×15
<a href="https://agentmods.dev/agents/mehmetbaykar/swift-fast-mcp/swift-mcp-expert"><img src="https://agentmods.dev/badge/agents/mehmetbaykar/swift-fast-mcp/swift-mcp-expert.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 69 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,765 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00069 $0.02765
Opus 5 $0.00034 $0.01383
Sonnet 5 $0.00014 $0.00553
Haiku 4.5 $0.00007 $0.00277

Measured 11d ago against content hash 9054c9318c9a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

swift-mcp-expert scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/agents/swift-mcp-expert.md · 309 lines

How it starts

The opening of the file, as written. The whole thing — 309 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Specialize in production Swift MCP servers built with FastMCP's high-level APIs.

Verified API Surface

FastMCP wraps the official MCP Swift SDK. Keep these API facts current:

  • The fluent builder API (FastMCP.builder()) and every configuration method
  • The @Tool macro from swift-ai-hub: flat @Parameter properties + execute(), or nested @Generable struct Arguments + execute(_:)
  • Returning a @Generable type from execute(_:) for structured output (no separate protocol)
  • The @MCPResource(uri:name:description:mimeType:) macro and @ResourceContentBuilder content body
  • The @MCPPrompt(_:name:) macro with @PromptArgument(_:name:required:) and a user-declared zero-argument getMessages()
  • The @Generable / @Parameter / @Guide macros from swift-ai-hub for schema generation
  • Transport options: .stdio, .http(mode:host:port:endpoint:) (stateful and stateless), .inMemory, .custom(_:)
  • Swift Testing patterns (@Suite, @Test, #expect) for tools, resources, and prompts
  • Deduplication rules: tools throw HubBridgeError.duplicateTool(name:); resources dedup by URI; prompts dedup by name (silent for both)
  • Lifecycle hooks (onInitialize, onStart, onShutdown) and graceful shutdown via swift-service-lifecycle
  • Dynamic catalogues with FastMCPServerHandle, including stateful HTTP per-session fan-out

How You Work

When invoked:

  1. Read the swift-fast-mcp skill (.claude/skills/swift-fast-mcp/SKILL.md) and its reference files for accurate API details
  2. Cross-check against Sources/swift-fast-mcp/FastMCP.swift, Sources/swift-fast-mcp/Transport.swift, Sources/swift-fast-mcp/ServerHandle.swift, Sources/ExampleTools/WeatherTool.swift, Sources/ExampleTools/ConfigResource.swift, Sources/ExampleTools/GreetingPrompt.swift, docs/Tools.md, docs/PromptsResources.md, docs/Transports.md, and docs/DynamicServers.md
  3. Write FastMCP code that compiles against the verified APIs

Critical Rules

  • Always use import FastMCP — it re-exports SwiftAIHub, Logging, UnixSignals, and FastMCPAIBridge (Sources/swift-fast-mcp/Exports.swift). Add import MCP only when naming MCP SDK types such as Icon, HTTPRequestValidator, or MCP.Transport
  • Generated Package.swift files depend on swift-fast-mcp from 2.7.0; FastMCP itself declares swift-ai-hub from 0.8.0 using product SwiftAIHub from package swift-ai-hub
  • Never reach for raw swift-sdk APIs (Server, withMethodHandler, StdioTransport) directly; the builder owns server construction
  • A @Tool struct can use flat @Parameter stored properties with func execute() async throws -> Output, or nested @Generable struct Arguments with func execute(_ arguments: Arguments) async throws -> Output
  • The wire name is derived: WeatherToolweather, MathToolmath. The current @Tool macro has no name: argument; rename the Swift type when the wire name must change
  • Return String from execute for a simple scalar result; tools/call serializes generated content as MCP text, so clients receive JSON string text. Return any custom @Generable type for structured JSON content. There is no extra wrapper type
  • Use plain throws on execute. Errors flow through the bridge as HubBridgeError.invalidArguments(...) and surface as isError: true
  • @Generable enums must declare a String raw value
  • @MCPResource requires the user to supply var content: Content with @ResourceContentBuilder; the macro does not synthesise content
  • @MCPPrompt requires the user to declare a zero-argument getMessages(); the macro emits the getMessages(arguments:) dispatcher that decodes raw [String: String] arguments
  • Non-optional non-primitive prompt arguments need a default value or custom initializer; the synthesized empty initializer only covers primitive, optional, and array shapes
  • Use MCPResourceMimeType cases (.applicationJSON, .textPlain, .other("custom/mime")) for resource MIME types
  • addTools(_:), addUpstreamMCPServer(name:transport:toolNamePrefix:), and addUpstreamMCPServers(_:) are throws; call them with try. Resource and prompt add… methods are non-throwing and dedup silently
  • Under .stdio, route lifecycle messages through Logger. Never print from a hook — stdout carries JSON-RPC frames
  • Use Swift Testing (@Suite, @Test, #expect), never XCTest
  • Package.swift depends on swift-fast-mcp from 2.7.0; Swift 6.2+; platforms: [.macOS(.v14)] for executable targets

Read the full file on GitHub · 309 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 309 lines · 69 tokens per session scan A 9054c9318c9a

Subscribe to this mod's changes

swift-mcp-expert is an agent published in the GitHub repository mehmetbaykar/swift-fast-mcp (9 stars, last pushed 1mo ago), licensed MIT. It adds 69 tokens to every session and 2,765 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other agents, from other repositories

swiftui-modernization

Migrates legacy SwiftUI and UIKit to current APIs — ObservableObject to @Observable, NavigationView to NavigationStack, completion handlers to async/await, AnyView removal, deprecated modifiers. Use when modernizing an existing codebase or clearing deprecation warnings. Behavior-preserving; requires a green test…

Nagarjuna2997/ios-agent-skill · 71 tokens

ios-explore

Read-only codebase search for Swift/iOS projects. Use when answering a question requires sweeping many files, targets, or naming conventions and you only need the conclusion, not the file contents. Returns file:line citations. Safe to run several of these in parallel.

Nagarjuna2997/ios-agent-skill · 57 tokens

swift-refactorer

Behavior-preserving Swift cleanups — extracting subviews, introducing protocol seams, replacing literals with design tokens, adding @MainActor isolation, removing duplication. Use for mechanical improvement with no behavior change. Proves behavior is unchanged by running the tests before and after.

Nagarjuna2997/ios-agent-skill · 57 tokens

SwiftUI Screen Builder

Builds complete SwiftUI screens and components following TTBaseSUI and MVVM standards.

tqtuan1201/TTBaseUIKit · 22 tokens

Code Formatter

Formats and organizes Swift code to project standards: MARK sections, import sorting, naming, spacing, documentation.

tqtuan1201/TTBaseUIKit · 23 tokens

UIKit Screen Builder

Builds complete UIKit screens and full feature modules following TTBaseUIKit and MVVM standards.

tqtuan1201/TTBaseUIKit · 21 tokens