Summary
A lightweight MCP server that gives coding agents authoritative Swift knowledge and enforceable code quality. It exposes TSPL and API Guidelines search, Apple DocC search, Swift Evolution lookup, SwiftLint, and formatter tooling as first‑class MCP tools an agent can call during coding and PRs. A hybrid search unifies Apple docs, HIG, and curated Cocoa patterns with facets for drill‑down.
Highlights
- Unified access to TSPL, API guidelines, Apple DocC, HIG, and Cocoa patterns.
- One‑command lint/format checks for PR automation.
- Hybrid search with facets (sources, frameworks, kinds, topics, tags).
- Offline‑friendly via
swift_update_sync
+ weekly refresh workflow.
Challenges & Solutions
- Tool names: Adopted
snake_case
to satisfy model tool‑name constraints. - Formatter parity: Prefer Apple
swift-format
; fall back toSwiftFormat
for flexibility. - Fresh knowledge: Added an update tool to mirror Swift Evolution and TSPL locally; extended to build Apple/HIG/pattern indexes for offline search.
- Discoverability: Introduced symbol aliases and hybrid search facets so agents can narrow down quickly.
Outcome
Improved reliability of Swift answers in agent sessions and consistent code style across MetaScope development. Enables automated PR feedback with concrete guideline references. Hybrid search and offline indexes speed up exploration when network access is limited.
Screenshots (suggested)
- MCP Inspector showing loaded
swift
server and tools. - Terminal snippet running
swift_lint_run
andswift_format_apply
. - Agent chat citing TSPL pages.
- Repo structure in the editor.
Keywords: Swift, MCP, Apple DocC, HIG, Cocoa patterns, AI coding agent, Codex, Claude, SwiftLint, swift‑format, Developer Tools, Docker