Skip to main content
Glama
README.md
# Docs Librarian Agent

<!--BADGES-START-->
[![Version](https://img.shields.io/badge/version-6.0.0-blue)](https://github.com/Emasoft/docs-librarian-agent/releases)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
<!--BADGES-END-->

Apple Developer Documentation for Claude Code: search iOS, macOS, watchOS, tvOS and visionOS documentation, frameworks, APIs, SwiftUI, UIKit and WWDC videos, and get Swift/Objective-C code examples, API references and technical guides directly in your Claude Code session. The plugin bundles an MCP (Model Context Protocol) server, so installing the plugin is all it takes.

The plugin also ships 14 skills (`/docs-librarian-agent:dla-<name>`): Apple documentation search, Apple SDK release notes per platform, Claude Code docs search and changelog, and `/dla-ask-the-librarian` (see [Skills](#skills) and [Librarian agent](#librarian-agent)).

This plugin (`docs-librarian-agent`) is based on [kimsungwhee/apple-docs-mcp](https://github.com/kimsungwhee/apple-docs-mcp) by kimsungwhee (MIT license). It is an independent fork, repackaged as a Claude Code plugin; it is not published to npm.

**English** | [日本語](README.ja.md) | [한국어](README.ko.md) | [简体中文](README.zh-CN.md)

**Table of contents**

- [Quick start](#quick-start)
  - [Requirements](#requirements)
  - [From a Claude Code session](#from-a-claude-code-session)
  - [From a terminal](#from-a-terminal)
  - [Update and uninstall](#update-and-uninstall)
  - [Upgrading from 5.x](#upgrading-from-5x)
  - [Troubleshooting](#troubleshooting)
- [Features](#features)
- [Usage examples](#usage-examples)
  - [Search and documentation access](#search-and-documentation-access)
  - [Apple Design and HIG](#apple-design-and-hig)
  - [Frameworks, APIs and platforms](#frameworks-apis-and-platforms)
  - [Updates, overviews and sample code](#updates-overviews-and-sample-code)
  - [WWDC videos](#wwdc-videos)
  - [Advanced usage](#advanced-usage)
- [Skills](#skills)
  - [Release-notes skills](#release-notes-skills)
  - [Librarian agent](#librarian-agent)
- [Tools](#tools)
- [Technical architecture](#technical-architecture)
  - [Performance features](#performance-features)
  - [Caching strategy](#caching-strategy)
- [WWDC data](#wwdc-data)
- [Configuration](#configuration)
  - [Jev semantic selection (on by default when a key is set, paid)](#jev-semantic-selection-on-by-default-when-a-key-is-set-paid)
- [Claude Code docs search (requires Jev)](#claude-code-docs-search-requires-jev)
- [Development](#development)
- [Contributing](#contributing)
- [License](#license)
- [Disclaimer](#disclaimer)

## Quick start

### Requirements

- [Claude Code](https://code.claude.com/docs/en/overview)
- `node` (Node.js 22 or later) on your `PATH`. Claude Code runs the bundled server with `node`, and its native installer does not ship Node.js. Check with `node --version`.
- About 11 MB of disk space for the WWDC data, downloaded once the first time a WWDC tool is used (see [WWDC Data](#wwdc-data)).

### From a Claude Code session

```text
/plugin marketplace add Emasoft/emasoft-plugins
/plugin install docs-librarian-agent@emasoft-plugins
```

### From a terminal

```bash
claude plugin marketplace add Emasoft/emasoft-plugins
claude plugin install docs-librarian-agent@emasoft-plugins --scope user
```

Restart Claude Code (or run `/reload-plugins`) to activate the plugin, then run `/mcp` to check that the `apple-docs` server of this plugin is connected.

### Update and uninstall

```bash
claude plugin update docs-librarian-agent@emasoft-plugins
claude plugin uninstall docs-librarian-agent
```

**Upgrading from the previous plugin name.** The plugin was renamed to `docs-librarian-agent` (repository https://github.com/Emasoft/docs-librarian-agent). Its skills now start with `dla-` and its MCP tools are named `mcp__plugin_docs-librarian-agent_apple-docs__<tool>`. Install the plugin under the new name (see above), then uninstall the old one (`claude plugin list` shows its name). The WWDC data is downloaded once more, into the new cache folder (see [Upgrading from 5.x](#upgrading-from-5x)).

### Upgrading from 5.x

The plugin is now named `docs-librarian-agent`; install it as `docs-librarian-agent@emasoft-plugins`.

**Caches.** On the first tool call after the upgrade, the server removes, once, the cache folders of earlier versions: `~/Library/Caches/apple-docs-mcp`, `~/.cache/apple-docs-mcp`, `$XDG_CACHE_HOME/apple-docs-mcp`, `apple-docs-mcp` and `apple-docs-mcp-design-*` in the system temporary folder, and the `wwdc-data` folder in the data folder of the old plugin. They are caches: their content is downloaded again into the new folder, `~/.cache/docs-librarian-cache` (see [Caching strategy](#caching-strategy)). If a folder cannot be removed, the removal is retried at the next start.

**Environment variables.** These variables were renamed. The old names are no longer read; if one is still set, a startup warning names the new variable. `APPLE_DOCS_MCP_CACHE_DIR` is removed: use `DOCS_LIBRARIAN_CACHE_DIR`.

| Old name | New name |
|----------|----------|
| `APPLE_DOCS_MCP_JEV_RERANK` | `DOCS_LIBRARIAN_JEV_RERANK` |
| `APPLE_DOCS_MCP_JEV_PROVIDER` | `DOCS_LIBRARIAN_JEV_PROVIDER` |
| `APPLE_DOCS_MCP_RANKING` | `DOCS_LIBRARIAN_RANKING` |
| `APPLE_DOCS_MCP_WWDC_DATA_DIR` | `DOCS_LIBRARIAN_WWDC_DATA_DIR` |
| `APPLE_DOCS_MCP_REPORTS_DIR` | `DOCS_LIBRARIAN_REPORTS_DIR` |
| `APPLE_DOCS_MCP_CACHE_MAX_BYTES` | `DOCS_LIBRARIAN_CACHE_MAX_BYTES` |
| `APPLE_DOCS_MCP_JEV_LIVE` | `DOCS_LIBRARIAN_JEV_LIVE` |
| `APPLE_DOCS_MCP_CC_CHANGELOG_CACHE_DIR` | `DOCS_LIBRARIAN_CC_CHANGELOG_CACHE_DIR` |
| `APPLE_DOCS_MCP_CC_EXTENDED_CHANGELOG_CACHE_DIR` | `DOCS_LIBRARIAN_CC_EXTENDED_CHANGELOG_CACHE_DIR` |
| `APPLE_DOCS_MCP_CC_DOCS_CORPUS_CACHE_DIR` | `DOCS_LIBRARIAN_CC_DOCS_CORPUS_CACHE_DIR` |
| `APPLE_DOCS_MCP_CACHE_DIR` | `DOCS_LIBRARIAN_CACHE_DIR` (removed; see above) |

### Troubleshooting

- **The server fails to start, or `/mcp` shows it as failed?** Claude Code launches the server with the command `node`. GUI apps do not always inherit the `PATH` of your shell: run `which node` in a terminal, and make sure that directory is on the `PATH` of the process that starts Claude Code. The plugin needs Node.js 22 or later.
- **`search_apple_docs` returning nothing, or erroring?** It depends on an undocumented Apple search backend (`devintserv.msc.sbz.apple.com`) that the search page of developer.apple.com uses internally. If Apple changes its response shape, `search_apple_docs` can break until this plugin catches up. `get_apple_doc_content`, `search_framework_symbols` and the WWDC tools do not depend on that endpoint and keep working.
- **`search_apple_docs` feels slow?** Apple streams the full result set, so a search typically takes 5 to 25 seconds (median about 10). Repeating the same query within 10 minutes is answered from a local cache.

## Features

- **Smart Search**: Intelligent search across Apple Developer Documentation for SwiftUI, UIKit, Foundation, CoreData, ARKit, and more
- **Complete Documentation Access**: Full access to the Apple JSON API for Swift, Objective-C, and framework documentation
- **Apple Design and HIG Access**: Read Human Interface Guidelines JSON, Apple Design pages, and Design Resources catalog entries
- **Design Resource Previews**: Return Apple-provided HIG images and resource thumbnails as MCP image content blocks
- **Downloadable Design Resources**: Download direct Apple-hosted templates, fonts, tools, and archives into a local MCP resource cache
- **Framework Index**: Browse hierarchical API structures for iOS, macOS, watchOS, tvOS, visionOS frameworks
- **Technology Catalog**: Explore Apple technologies including SwiftUI, UIKit, Metal, Core ML, Vision, and ARKit
- **Documentation Updates**: Track WWDC 2025/2026 announcements, iOS 27, macOS 27, and latest SDK releases
- **Technology Overviews**: Comprehensive guides for Swift, SwiftUI, UIKit, and all Apple development platforms
- **Sample Code Library**: Swift and Objective-C code examples for iOS, macOS, and cross-platform development
- **WWDC Video Library**: Search WWDC 2014-2026 sessions with transcripts, Swift/SwiftUI code examples, and resources (the data is downloaded once, on first use)
- **Related APIs Discovery**: Find SwiftUI views, UIKit controllers, and framework-specific API relationships
- **Platform Compatibility**: iOS 13+, macOS 10.15+, watchOS 6+, tvOS 13+, visionOS compatibility analysis
- **High Performance**: Optimized for Xcode, Swift Playgrounds, and AI-powered development environments
- **Smart UserAgent Pool**: Rotating Safari-on-macOS User-Agent strings (25 in the pool) with automatic failure recovery and performance monitoring
- **Multi-Platform**: Complete iOS, iPadOS, macOS, watchOS, tvOS, and visionOS documentation support
- **Beta and Status Tracking**: Beta and newly released APIs, deprecated UIKit methods, new SwiftUI features tracking

## Usage examples

Ask Claude in plain language; it chooses the right tool. Examples:

### Search and documentation access

```text
"Search for SwiftUI animations"
"Find withAnimation API documentation"
"Look up async/await patterns in Swift"
"Show me UITableView delegate methods"
"Search Core Data NSPersistentContainer examples"
"Find AVFoundation video playback APIs"
"Get detailed information about the SwiftUI framework"
"Show me withAnimation API with related APIs"
"Get platform compatibility for SwiftData"
"Access UIViewController documentation with similar APIs"
"Show me NSManagedObjectContext documentation"
"Get URLSession async/await methods"
```

### Apple Design and HIG

```text
"Search Apple Design docs for layout"
"Read the HIG page about color"
"List Apple Design Resources for iOS templates"
"Download the Apple Design resource with this resourceId"
"Show Apple Design examples for the layout HIG page"
```

### Frameworks, APIs and platforms

```text
"Show me SwiftUI framework API index"
"List the UIKit classes whose name matches UIView*"
"Browse ARKit framework structure"
"Get WeatherKit API hierarchy"
"Explore Core ML model loading APIs"
"Show Vision framework image analysis APIs"
"Find APIs related to UIViewController"
"Show me similar APIs to withAnimation"
"Get all references from SwiftData documentation"
"Discover alternatives to Core Data NSManagedObject"
"List all Beta frameworks in the latest iOS"
"Show me Graphics & Games technologies"
"What machine learning frameworks are available?"
"Analyze platform compatibility for Vision framework"
```

### Updates, overviews and sample code

```text
"Show me the latest WWDC updates"
"What is new in SwiftUI?"
"Get technology updates for iOS"
"Show me release notes for Xcode"
"Find beta features in the latest updates"
"Show me technology overviews for app design and UI"
"Get comprehensive guides for games development"
"Explore AI and machine learning overviews"
"Show me iOS-specific technology guides"
"Get data management technology overviews"
"Show SwiftUI sample code projects"
"Find sample code for machine learning"
"Get UIKit example projects"
"Show featured WWDC sample code"
"Find Core Data sample implementations"
"Show only beta sample code projects"
```

### WWDC videos

```text
"Search WWDC videos about SwiftUI"
"Find WWDC sessions on machine learning"
"Show me WWDC 2026 videos"
"Search for async/await WWDC talks"
"Find WWDC videos about Swift concurrency"
"Show accessibility-focused WWDC sessions"
"Get details for WWDC session 10176"
"Show me the transcript for WWDC23 session on SwiftData"
"Get code examples from WWDC video 10019"
"Show resources from Vision Pro WWDC session"
"Get transcript for the Meet async/await in Swift session"
"List all WWDC topics"
"Show me Swift topic WWDC videos"
"Get WWDC videos about developer tools"
"List WWDC videos from 2023"
"Show all SwiftUI and UI frameworks sessions"
"Get machine learning WWDC content"
```

### Advanced usage

```text
"Find related APIs for @State with platform analysis"
"Resolve all references from SwiftUI documentation"
"Get platform compatibility analysis for Vision framework"
"Find similar APIs to UIViewController with deep search"
```

## Skills

The plugin ships 14 skills: 13 documentation skills and `dla-ask-the-librarian`. Invoke one as `/docs-librarian-agent:dla-<name>` (`dla` stands for Docs Librarian Agent). Every skill except `dla-the-skills-menu` (a catalog that agents load to pick a skill) and `dla-ask-the-librarian` (it hands the question to the librarian agent, see [Librarian agent](#librarian-agent)) reads documentation live through the bundled `apple-docs` MCP server and cites the pages it relies on instead of answering from memory.

| Skill | Invocation | What it does |
|-------|------------|--------------|
| `dla-apple-docs-search` | `/docs-librarian-agent:dla-apple-docs-search` | Looks up official Apple documentation: Swift, SwiftUI, UIKit, AppKit and Objective-C APIs, availability and deprecations, Human Interface Guidelines, design resources, sample code, technology overviews and WWDC sessions |
| `dla-apple-ios-sdk-changelog` | `/docs-librarian-agent:dla-apple-ios-sdk-changelog` | iOS SDK release notes (from 13.1 on, one shared "iOS & iPadOS" page per version) |
| `dla-apple-ipados-sdk-changelog` | `/docs-librarian-agent:dla-apple-ipados-sdk-changelog` | iPadOS SDK release notes (an alias of the shared "iOS & iPadOS" page; iPadOS 16 has its own page) |
| `dla-apple-macos-sdk-changelog` | `/docs-librarian-agent:dla-apple-macos-sdk-changelog` | macOS SDK release notes (AppKit and Foundation topic pages are excluded and counted in the header) |
| `dla-apple-safari-sdk-changelog` | `/docs-librarian-agent:dla-apple-safari-sdk-changelog` | Safari release notes (Safari Technology Preview is not covered) |
| `dla-apple-swift-sdk-changelog` | `/docs-librarian-agent:dla-apple-swift-sdk-changelog` | Swift toolchain notes read from the Xcode release notes; the argument is an Xcode version, never a Swift version |
| `dla-apple-tvos-sdk-changelog` | `/docs-librarian-agent:dla-apple-tvos-sdk-changelog` | tvOS SDK release notes |
| `dla-apple-visionos-sdk-changelog` | `/docs-librarian-agent:dla-apple-visionos-sdk-changelog` | visionOS SDK release notes (the first page is visionOS 1.0; Apple has published no visionOS patch page) |
| `dla-apple-watchos-sdk-changelog` | `/docs-librarian-agent:dla-apple-watchos-sdk-changelog` | watchOS SDK release notes |
| `dla-apple-xcode-sdk-changelog` | `/docs-librarian-agent:dla-apple-xcode-sdk-changelog` | Xcode release notes, including their Swift toolchain sections |
| `dla-ask-the-librarian` | `/docs-librarian-agent:dla-ask-the-librarian` | Asks the librarian agent one question (`/dla-ask-the-librarian <question>`) and returns only the answer with its source URLs (see [Librarian agent](#librarian-agent)) |
| `dla-cc-changelog` | `/docs-librarian-agent:dla-cc-changelog` | Claude Code changelog for one version, an interval or the newest |
| `dla-cc-docs-search` | `/docs-librarian-agent:dla-cc-docs-search` | Looks up the official Claude Code documentation (code.claude.com/docs) instead of answering from memory |
| `dla-the-skills-menu` | not user-invocable | Catalog of the skills of this plugin; agents load it with `Skill()` to pick a downstream skill at runtime |

### Release-notes skills

The nine Apple SDK changelog skills (`dla-apple-*-sdk-changelog`) each take a version (`18`, `18.4`), an interval (`17-18`), `latest N` or nothing for the newest, and read the release notes through the one tool `get_apple_sdk_changelog`. This is a deterministic read: no Jev, no cost. The version must exist for that platform (for example watchOS has no 18). The Swift skill takes an Xcode version, such as `26`, and reads the Swift toolchain notes from the Xcode release notes.

`/docs-librarian-agent:dla-cc-changelog <semver version or interval, empty = most recent>` reads the Claude Code changelog for one version (`2.1.300`), an interval (`2.1.300-2.1.310`) or the newest version through `get_claude_code_changelog`.

### Librarian agent

The plugin also ships a research agent, `docs-librarian-main-agent` (the librarian, which runs on Haiku). It answers ONE question about Apple developer documentation (APIs, Human Interface Guidelines, WWDC sessions, SDK and Xcode release notes) or about Claude Code (features, settings, hooks, plugins, changelog). It runs the searches and reads the pages in its own context, then returns only the answer with the source URL of each fact (for Claude Code, also the section breadcrumb), or "Not found in the documentation" with the queries it tried. The raw search output never reaches the caller, so other agents can spawn it to save their own context. It is addressed as `docs-librarian-agent:docs-librarian-main-agent`, and its definition is `agents/docs-librarian-main-agent.md`.

To ask it yourself, run `/dla-ask-the-librarian <question>` (full form `/docs-librarian-agent:dla-ask-the-librarian`). With no question it only prints the usage line.

## Tools

The bundled MCP server is named `apple-docs` inside the plugin, so Claude Code shows each tool as `mcp__plugin_docs-librarian-agent_apple-docs__<tool>`: the tool `search_apple_docs` appears as `mcp__plugin_docs-librarian-agent_apple-docs__search_apple_docs`. You never have to type these names: describe what you need and Claude picks the tool.

| Tool | Description | Key Features |
|------|-------------|--------------|
| `search_apple_docs` | Search Apple Developer Documentation | Official search API, find specific APIs, classes, methods |
| `get_apple_doc_content` | Get detailed documentation content | JSON API access, optional enhanced analysis (related/similar APIs, platform compatibility) |
| `search_apple_design_docs` | Search Apple Design and HIG content | HIG JSON references, Design pages, Design Resources catalog |
| `get_apple_design_content` | Read Apple Design and HIG pages | HIG JSON rendering, HTML fallback for `/design/` pages |
| `list_apple_design_resources` | List Apple Design Resources | Stable resource IDs, category/platform/format filters, previews and links |
| `download_apple_design_resource` | Download direct Apple Design resources | Local cache, MCP `resource_link` blocks, `resources/read` blob access |
| `get_apple_design_examples` | Return Apple Design visual examples | MCP `image` blocks with base64 data and MIME type |
| `list_technologies` | Browse all Apple technologies | Category filtering, language support, beta status |
| `search_framework_symbols` | Search symbols in specific framework | Classes, structs, protocols, wildcard patterns, type filtering |
| `get_related_apis` | Find related APIs | Inheritance, conformance, "See Also" relationships |
| `resolve_references_batch` | Batch resolve API references | Extract and resolve all references from documentation |
| `get_platform_compatibility` | Platform compatibility analysis | Version support, beta status, deprecation info |
| `find_similar_apis` | Discover similar APIs | Official Apple recommendations, topic groupings |
| `get_documentation_updates` | Track Apple documentation updates | WWDC announcements, technology updates, release notes |
| `get_technology_overviews` | Get technology overviews and guides | Comprehensive guides, hierarchical navigation, platform filtering |
| `get_sample_code` | Browse Apple sample code projects | Framework filtering (with limitations), keyword search, beta status |
| `list_wwdc_videos` | Browse WWDC video sessions | Offline transcripts and code, topic/year filtering |
| `search_wwdc_content` | Full-text search of WWDC transcripts and code | Specific discussions, API mentions, implementation examples |
| `get_wwdc_video` | Get a complete WWDC session | Full transcript, code examples, resources |
| `get_wwdc_code_examples` | Browse code examples from WWDC sessions | Implementation patterns with session context |
| `browse_wwdc_topics` | List WWDC topic categories with their IDs | Topic IDs usable as filters in `list_wwdc_videos` |
| `find_related_wwdc_videos` | Discover sessions related to a video | Prerequisites, follow-up sessions, similar talks |
| `list_wwdc_years` | List all available WWDC years | Conference years with video counts and statistics |
| `search_claude_code_docs` | Search the Claude Code documentation | Live index of code.claude.com/docs plus llms-full.txt, returns a short answer and a report file with the full section text (optional `reportsDir`: an absolute folder for the report of that one search; one report is written per search and the newest 50 of the two default folders are kept, so the tool is not read-only), requires Jev |
| `get_claude_code_doc_content` | Read a Claude Code docs page or section | Page URL or one section by its sectionId |
| `get_claude_code_changelog` | Read specific Claude Code versions from the changelog | Exactly one of `latest`, `version` (X.Y.Z) or `fromVersion`/`toVersion` (X.Y.Z or X.Y; a partial X.Y covers every X.Y.z), plus optional `fromDate`/`toDate` (YYYY-MM-DD, inclusive; enough on their own, or narrowing any one mode) and optional `tags` (bracketed bullet tags such as VSCode, matched as whole words ignoring case) and `categories` (Added, Changed, Improved, Fixed; Fixed also matches "N bug fixes", Improved "N improvements") that keep only the matching bullets of those versions; optional `source` (`official`, the default, or `extended`: the unofficial Piebald-AI changelog, CC BY 4.0, with `badges` `documented`/`wrong-version`/`undocumented` and a 1-based `page` when the answer is paged); returns only those version blocks, no Jev |
| `search_claude_code_changelog` | Search the Claude Code changelog by meaning and return the best matching versions | `query`; optional `latest`, `version`, `fromVersion`/`toVersion` or `allVersions` (default: newest 50 versions), plus optional `fromDate`/`toDate` (YYYY-MM-DD, inclusive; a date bound replaces the default newest 50 and narrows any one mode) and optional `tags` / `categories` (as above; applied after the scope, and Jev scores only the kept bullets); optional `source` (`official`, the default, or `extended`: the unofficial Piebald-AI changelog, CC BY 4.0, searched by whole item windows; the default extended scope is the newest 50 versions or fewer when the pool would pass its caps, and `tags`, `categories`, `fromDate`/`toDate` and `page` are rejected with it; about 3 cents per default extended search, an estimated 4 cents at most at the caps (not measured), Jev-reported 2026-11-28) with `badges` `documented`/`wrong-version`/`undocumented` to keep only those items; each listed version has a ready `get_claude_code_changelog` call; `maxResults` counts versions (1 to 20, default 5); needs Jev |

## Technical architecture

```text
docs-librarian-agent/
├── .claude-plugin/plugin.json        # Claude Code plugin manifest
├── .mcp.json                         # Registers the bundled MCP server (apple-docs)
├── servers/apple-docs/
│   ├── index.js                      # Committed esbuild bundle, the server users run
│   └── THIRD_PARTY_LICENSES.txt      # Licenses of the bundled dependencies
├── src/                              # TypeScript sources of the server
│   ├── index.ts                      # MCP server entry point with all tools
│   ├── tools/                        # MCP tool implementations (docs, design, WWDC, ...)
│   └── utils/                        # Cache, HTTP client, UserAgent pool, error handling
├── scripts/                          # build-bundle.mjs and publish.py
├── tests/                            # Jest test suites
└── package.json                      # Development dependencies and scripts (private)
```

### Performance features

- **Memory-Based Caching**: Custom cache implementation with automatic cleanup and TTL support
- **Smart UserAgent Pool**: Rotation of 25 Safari-on-macOS User-Agent strings with automatic failure recovery and performance monitoring (see [Configuration](#configuration))
- **Dynamic Headers**: Generated browser-style headers (Accept, Accept-Encoding, Accept-Language, DNT, Cache-Control) that go with the chosen User-Agent
- **Lazy Warm-up**: No network traffic at startup; the Apple cache warm-up and its 30-minute refresh start on the first Apple tool call (see [Caching strategy](#caching-strategy))
- **Smart Search**: Official Apple search API with enhanced result formatting
- **Enhanced Analysis**: Optional related APIs, platform compatibility, and similarity analysis
- **Error Resilience**: Graceful degradation with comprehensive error handling
- **Type Safety**: Full TypeScript with Zod runtime validation
- **Zero Runtime Dependencies**: The server ships as one bundled file, with no node_modules to install

### Caching strategy

| Content Type | Cache Duration | Cache Size | Reason |
|--------------|----------------|------------|--------|
| API Documentation | 30 minutes | 500 entries | Frequently accessed, moderate updates |
| Search Results | 10 minutes | 200 entries | Dynamic content, user-specific |
| Framework Indexes | 1 hour | 100 entries | Stable structure, less frequent changes |
| Technologies List | 2 hours | 50 entries | Rarely changes, large content |
| Documentation Updates | 30 minutes | 100 entries | Regular updates, WWDC announcements |
| Apple Design Content | 2 hours | 100 entries | HIG and Design pages are stable during a session |
| Apple Design Resources | 2 hours | 20 entries | Catalog metadata changes less often than page reads |

Every download and cache of the plugin lives under ONE folder, `~/.cache/docs-librarian-cache`, on every platform. Set `DOCS_LIBRARIAN_CACHE_DIR` (an absolute path) to move the whole folder. Its subfolders are:

- `wwdc-data/<version>`: the WWDC data, downloaded on first use of a WWDC tool (see [WWDC data](#wwdc-data))
- `design-docs`: the downloaded Apple Design files, exposed through MCP `resources/list` and `resources/read`
- `cc-changelog`, `cc-changelog-extended` and `cc-docs-corpus`: the cached Claude Code changelogs and docs corpus
- `reports/cc-docs-search`: the reports of `search_claude_code_docs` when no project folder is known (see [Claude Code docs search](#claude-code-docs-search-requires-jev))

To clear every cache, run `rm -rf ~/.cache/docs-librarian-cache`; what you use again is downloaded again. Nothing is stored in the Claude Code plugin data folder.

**Startup and warm-up.** The server sends no network request when it starts, and nothing is preloaded at startup. The Apple cache warm-up starts once per server process, in the background, on the first call of any tool except the four Claude Code docs tools (`search_claude_code_docs`, `get_claude_code_doc_content`, `get_claude_code_changelog`, `search_claude_code_changelog`) and the two statistics tools (`get_performance_report`, `get_cache_stats`); it never delays that call. It downloads these five files of developer.apple.com:

- `https://developer.apple.com/tutorials/data/documentation/technologies.json` (the technologies list)
- `https://developer.apple.com/tutorials/data/documentation/Updates.json` and `https://developer.apple.com/tutorials/data/index/updates` (the documentation updates)
- `https://developer.apple.com/tutorials/data/documentation/TechnologyOverviews.json` and `https://developer.apple.com/tutorials/data/index/technologyoverviews` (the technology overviews)

It repeats every 30 minutes while the server runs. A session that only uses the Claude Code docs tools never sends this traffic.

## WWDC data

The WWDC video data (2014-2026) is **not shipped with the plugin**. The first call of a WWDC tool downloads one archive (about 11 MB: 1,400+ sessions with full transcripts, 19 topic categories) from the plugin's data release, checks its SHA-256 and extracts it into `~/.cache/docs-librarian-cache/wwdc-data/v2` (or into `wwdc-data/v2` under `DOCS_LIBRARIAN_CACHE_DIR`, when that variable is set). Later calls, in any session, read it from disk. Starting the server and every other tool never download it. Videos, slides and sample projects are never downloaded: the WWDC tools only return their links.

**Input checks.** The WWDC tools validate their identifiers before they build any file path: a `year` must be exactly 4 digits (`list_wwdc_videos` and `browse_wwdc_topics` also accept `all`), a `videoId` must be digits only, and a `topicId` must be lowercase letters, digits and hyphens. Anything else is an error.

After an upgrade from 5.x the old WWDC data folder is removed and the archive is downloaded once more into the new cache folder (see [Upgrading from 5.x](#upgrading-from-5x)).

To install the data offline or on a machine without access to GitHub, extract the archive yourself and point the plugin at it:

```bash
mkdir -p /path/to/wwdc-data
curl -L -o wwdc-data.tar.gz https://github.com/Emasoft/apple-docs-wwdc-data/releases/download/v2/wwdc-data.tar.gz
tar xzf wwdc-data.tar.gz -C /path/to/wwdc-data
export DOCS_LIBRARIAN_WWDC_DATA_DIR=/path/to/wwdc-data
```

The SHA-256 of the archive is `9e436884c29acb8ccef0b1077bc0713e1d380be513ba174cbf865fa7f17bc3bb`. If the download fails, the WWDC tools report an error naming the URL, the target directory and `DOCS_LIBRARIAN_WWDC_DATA_DIR`.

> **Note**: Update the plugin to get a newer WWDC data release.

## Configuration

The server reads these optional environment variables when it starts. Set them in the environment of the process that starts Claude Code, because a Claude Code launched from the GUI does not see variables exported in a shell profile (observed on Claude Code 2.1.285; not documented by Anthropic). To set them, either start Claude Code from a terminal where they are exported, or, on macOS, run `launchctl setenv NAME value` and then restart Claude Code (launchctl values do not survive a reboot).

| Variable | Description | Default |
|----------|-------------|---------|
| `DOCS_LIBRARIAN_CACHE_DIR` | Absolute path of the one folder that holds every download and cache of the plugin (see [Caching strategy](#caching-strategy)) | `~/.cache/docs-librarian-cache` on every platform |
| `DOCS_LIBRARIAN_WWDC_DATA_DIR` | Directory with an already extracted WWDC data archive; nothing is downloaded when it is set (see [WWDC Data](#wwdc-data)) | Unset: the data is downloaded on first use |
| `DOCS_LIBRARIAN_CACHE_MAX_BYTES` | Size limit of the download cache, in bytes | 1073741824 (1 GiB) |
| `DOCS_LIBRARIAN_REPORTS_DIR` | Absolute folder for the reports of `search_claude_code_docs` (see [Claude Code docs search](#claude-code-docs-search-requires-jev)) | Unset: `$CLAUDE_PROJECT_DIR/reports_dev/cc-docs-search/`, else `~/.cache/docs-librarian-cache/reports/cc-docs-search/` |
| `MCP_DEBUG` | Set to `true` to enable debug logging | Off |
| `DEFAULT_ACCEPT_LANGUAGE` | Accept-Language header sent to Apple servers | `en-US,en;q=0.9` |
| `DISABLE_LANGUAGE_ROTATION` | Set to `true` to stop rotating the Accept-Language header | Off |
| `DISABLE_SEC_FETCH` | Set to `true` to drop the Sec-Fetch-* headers | Off |
| `DISABLE_DNT` | Set to `true` to drop the DNT header | Off |
| `SIMPLE_HEADERS_MODE` | Set to `true` to send minimal request headers | Off |
| `DOCS_LIBRARIAN_RANKING` | Default ranking route of `search_apple_docs` and `search_wwdc_content`: `classic` or `relevance` (see below) | `relevance` |
| `DOCS_LIBRARIAN_JEV_RERANK` | Jev semantic selection is on by default when a provider key is found; set to `0` to turn it off, `1` to require it (see below); any other value is an error | Unset (Jev on when a key is found) |
| `DOCS_LIBRARIAN_JEV_PROVIDER` | Jev provider: `typesafe`, `openrouter` or `gateway`; when unset, `OPENROUTER_API_KEY` is used if set, else `TYPESAFE_API_KEY` | Auto-detected |
| `TYPESAFE_API_KEY` | API key for the `typesafe` provider | None |
| `OPENROUTER_API_KEY` | API key for the `openrouter` provider | None |
| `JEV_GATEWAY_URL`, `JEV_GATEWAY_API_KEY` | URL and API key for the `gateway` provider | None |

**User-Agent and request headers.** Every request the server sends through its own HTTP client (for example the Apple documentation and search requests) carries a User-Agent chosen at random from a pool of 25 Safari-on-macOS strings (macOS 12 to a macOS 26 beta, Safari 15 to a Safari 19 beta; `SAFARI_USER_AGENTS` in `src/utils/constants.ts`), with automatic failure recovery, plus generated browser-style headers (Accept, Accept-Encoding, Accept-Language, DNT, Cache-Control; no Sec-Fetch-* headers go with a Safari User-Agent). The pool holds no Chrome, Firefox, Edge, Windows or Linux strings. If the pool cannot be created, the client sends one fixed Safari string instead.

The `search_apple_docs` backend call, a POST to the undocumented search endpoint, also sends an `Origin` header of `https://developer.apple.com` and a `Referer` header naming the developer.apple.com search page for your query. Why (inferred, not tested): that endpoint is the one the search page of developer.apple.com calls from its own JavaScript, Apple publishes no contract for it, and the server calls it the way that page does; no test shows the endpoint refusing a request without these headers. The endpoint needs no authentication or cookies.

The Claude Code docs and changelog reads, the Apple SDK release-notes reads, the WWDC data download and the Jev requests do not go through that HTTP client and do not use the pool.

### Jev semantic selection (on by default when a key is set, paid)

`search_wwdc_content` and `search_apple_docs` can use the Jev relevance-scoring service to narrow their results to the few that best match the query (5 by default, up to 20), each printed with a relevance score. It is on by default whenever a key is found: `OPENROUTER_API_KEY` is used if set, else `TYPESAFE_API_KEY`; or choose a provider with `DOCS_LIBRARIAN_JEV_PROVIDER` and set that provider's key (`TYPESAFE_API_KEY`, `OPENROUTER_API_KEY`, or `JEV_GATEWAY_URL` plus `JEV_GATEWAY_API_KEY`; `gateway` is used only when set explicitly). **Any such key in the environment means every search spends Jev credit**; the server prints one line on stderr at start naming the provider and the off switch. Set `DOCS_LIBRARIAN_JEV_RERANK=0` to turn Jev off whatever keys exist. `DOCS_LIBRARIAN_JEV_RERANK=1` with no resolvable provider and any value other than `0` or `1` are errors. With no key found, Jev is off and the Apple and WWDC searches run without selection.

If you exported one of these keys for another tool and do not want Jev, set `DOCS_LIBRARIAN_JEV_RERANK=0`.

- **Ranking route:** both tools accept `ranking`: `classic` or `relevance`. The default is `relevance`; `DOCS_LIBRARIAN_RANKING` overrides it and the tool argument overrides both. `classic` is the original behaviour: the original search and grouping for `search_apple_docs`, the substring match for `search_wwdc_content`. `relevance` is wide-recall. For `search_apple_docs` with Jev selection off, it runs the same single search as `classic` and only changes the ordering and grouping of the results; the wide recall happens only with selection on: up to 6 sub-queries derived from your query plus pages from the same documentation hierarchy as the best hits, from which Jev chooses. For `search_wwdc_content` it uses relaxed matching (any query word, prefixes, one typo tolerated) ranked by how many query words a video covers. The latency figures below are for the first call after the server starts (each query ran in a fresh server process, so every figure includes starting the server and its first network connections); they are not per-search times. A running MCP server pays that start-up cost only once, and later calls in the same session are faster. `search_apple_docs` (real Apple requests): median of about 12 s on both routes with selection off and about 15 s on `relevance` with selection on (p90 about 25 s). `search_wwdc_content` runs on local data; on that first call `relevance` takes about 1.5-3x as long as `classic` (median about 8 s against 5 s with selection off). The worst case is the first read of the data files from disk: up to about 45 s for a broad one-word query such as "SwiftUI", where the same query took about 8-11 s once the files were cached. The 120 s deadline is the ceiling for `relevance` with selection on.
- **Top result and evaluation:** on the `relevance` route, `search_apple_docs` selection always keeps the direct top result of your original query first (marked as pinned) and lets Jev fill the remaining slots; pass `select: false` for the full list. With `ranking: 'classic'` and selection on, `search_apple_docs` prints the original unpinned, grouped output. In a 20-query evaluation, WWDC selection put the right session in the top 5 for 8 of 8 queries versus 5 of 8 without it, while for Apple documentation the direct top result was usually already right, which is why the `relevance` route always keeps it.
- **Parameters:** both tools accept `select` (`true` or `false`; the default is on whenever Jev is on, see above) and `maxResults` (1-20, default 5, ignored when selection is off). For list-style requests ("all X", "list every Y") pass `maxResults: 20` or `select: false`. `select: true` while Jev is not enabled is an error.
- **Weak and no-strong-match notices:** if the best score is below 0.50, the results carry the note "Weak match: the best score is ... These results are related to the query, not a confident answer; try shorter identifier-level queries." If no result scores above 0.30, only the best result (for `search_apple_docs` on the `relevance` route: the pinned top result plus Jev's best guess) is returned with a "No strong match" note. Only `search_apple_docs` on the `relevance` route states the 0.30 threshold and the best score in that note. The exact sentence differs by tool and route: the `classic` route of `search_apple_docs` says "no result scored above the relevance threshold" and ends "Treat the result below as a weak guess.", and `search_wwdc_content` prints "no video scored above the relevance threshold" on both routes.
- **`limit` in `search_wwdc_content`:** with selection on, `limit` is the recall width: that many videos, ranked by match count, are scored by Jev (maximum 256). When `limit` is omitted, every candidate up to 256 is scored. With selection off, `limit` keeps its meaning (default 20, maximum 100). When the scan matched more videos than were scored, the header reads "Selected N of M scored (of T matching)".
- **What is sent, and to whom:** with selection on, the query and, for each candidate, its title, summary (Apple documentation results only), URL, topics and, for WWDC, an excerpt of its first match (transcript or code) are sent to the provider you chose: `api.typesafe.ai` for `typesafe`, `openrouter.ai` for `openrouter`, or the URL in `JEV_GATEWAY_URL` for `gateway`, together with your API key. Nothing is sent when selection is off.
- **Cost:** it is a paid service, billed by the provider to your key. Measured order of magnitude: about $0.0001 for about 17 Apple documentation results, about $0.001 for about 90 WWDC candidates, up to about $0.003 at the 256-candidate maximum; a search with Jev selection on typically costs well under a cent. On the `classic` route, selection typically adds under 2 seconds; at most about 15 seconds when the provider is slow or retrying. The `relevance` route is slower (see Ranking route).
- **Fail fast:** when selection is on, any failure (a missing key, an invalid provider, a network or provider error after retries) returns an error instead of unranked results. Pass `select: false` to get the unfiltered results.

The selection design is ported from [jgrep](https://github.com/kyu1204/jgrep) (MIT).

## Claude Code docs search (requires Jev)

`search_claude_code_docs` searches the Claude Code docs: the index https://code.claude.com/docs/llms.txt (fetched live on every call) and llms-full.txt (about 11 MB, cached on disk and revalidated with If-Modified-Since on every call; a cold start downloads it). It returns a short answer and writes the full text of the matching sections to a report file. `get_claude_code_doc_content` reads a page URL (https://code.claude.com/docs/en/....md) or one section by its sectionId. `get_claude_code_changelog` reads the live changelog and returns only the requested version blocks (`latest` N, one `version`, or a `fromVersion`/`toVersion` range); reading the changelog page with `get_claude_code_doc_content` (whole page or any sectionId) is refused.
`search_claude_code_changelog` searches the live changelog by meaning with one Jev pass and returns the best matching versions (default: the newest 50 versions; widen with `allVersions: true` or a `fromVersion`/`toVersion` range; `maxResults` counts versions). Measured 2026-10-27: about 0.6 cents per default search, about 1.3 to 1.5 cents over all versions. With `source: "extended"` (the unofficial Piebald-AI changelog, CC BY 4.0) it searches whole item windows of 6 KB; the default scope is the newest 50 versions, or fewer when the pool would pass its caps (1,024 windows, 4 MiB), and the response header names the versions searched. `badges` (`documented`, `wrong-version`, `undocumented`) keep only those items; `tags`, `categories`, `fromDate`/`toDate` and `page` are rejected with it. Measured 2026-11-28 (Jev-reported): about 3 cents per default extended search, an estimated 4 cents at most at the caps (not measured). Each listed version has a ready `get_claude_code_changelog` call whose `page` is valid for the README revision (ETag) named in the response header. It needs Jev, like `search_claude_code_docs`.

- `maxPages` (1 to 10, default 3) is the number of pages the Jev page pass keeps, scored by their headings. The 20 best sections of the whole docs by BM25 are added regardless. One Jev pass then scores the windows of all those sections. `maxResults` (1 to 20, default 5) is the number of sections listed. A value outside the range is an error. The query is limited to 2,000 characters after JSON encoding.
- The short answer has the query line; `Best match: strong | weak | none (best score X)`; `Report: <absolute path>`; one line per listed section (`page > heading path | sectionId | score | report lines A-B (best window C-D)`); the changelog pointer line when the changelog matches; the best-scoring window of section #1, verbatim and labelled as a partial view; and the Jev usage line. `strong` means a best score of at least 0.5. `weak` (at least 0.3) and `none` are indeterminate: read the pointed report lines before concluding. A band is never a verdict that the docs do not cover the topic.
- The report file is Markdown. It holds the full text of every reported section, code blocks intact and never truncated, grouped by page: every section scoring at least 0.3 (at least the best one, at most 4 times `maxResults`). The folder is the first of these: the optional `reportsDir` argument of the call (an absolute folder, for that one search); `DOCS_LIBRARIAN_REPORTS_DIR` (must be absolute); `$CLAUDE_PROJECT_DIR/reports_dev/cc-docs-search/`; `~/.cache/docs-librarian-cache/reports/cc-docs-search/`. The name is `<YYYYMMDD_HHMMSS+HHMM>-<query-slug>.md`, with `-2`, `-3` on a clash. It reads `$CLAUDE_PROJECT_DIR` when it starts; MCP clients other than Claude Code do not set it and get the folder under `~/.cache/docs-librarian-cache`. The first time the server writes into the project default folder, it puts a `.gitignore` holding `*` there, so the reports stay untracked in any repository; reports committed there earlier need `git rm --cached`.
- One report is written per search, and the server keeps only the newest 50 report files of the two default folders (`CC_DOCS_REPORTS_KEEP`): after each write it deletes the older files whose names match the report name above; any other file in the folder is never touched. A folder chosen with `reportsDir` or `DOCS_LIBRARIAN_REPORTS_DIR` is never pruned. Because every search writes a file, `search_claude_code_docs` is not a read-only tool (its MCP `readOnlyHint` is `false`).
- Read the `Best match` line and the #1 window first, then the listed report line ranges (or grep the report). Call `get_claude_code_doc_content` only for a section that is not in the report.
- The search requires Jev, which is on by default when `OPENROUTER_API_KEY` or `TYPESAFE_API_KEY` (or `DOCS_LIBRARIAN_JEV_PROVIDER` and its key) is set (see the Jev section above). With `DOCS_LIBRARIAN_JEV_RERANK=0` or no key, the search fails at once, before any request. There is no fallback without Jev: the error says so, and its suggestions name setting a provider key or, for Apple documentation, `search_apple_docs` with `select: false`, which works without Jev.
- Measured on 2026-11-29 (4 live queries, Jev-reported): 0.84 to 1.34 cents per search and 4.3 to 6.6 s per call. Two early runs took 22 s; their cause was not measured.
- Any fetch failure (no stale cache is served), any Jev failure, a report write failure or the 120 s deadline fails the whole call. There is no partial result and no unranked fallback.
- The skill `dla-cc-docs-search` covers usage in detail. Its companion skill `dla-cc-changelog` reads the changelog (see [Skills](#skills)).

## Development

This section is for maintainers; plugin users never need it. Requirements: Node.js 22 or later and pnpm (the version is pinned by `packageManager` in `package.json`).

```bash
pnpm install --frozen-lockfile   # install the development dependencies
pnpm build                       # regenerate servers/apple-docs/index.js and THIRD_PARTY_LICENSES.txt
pnpm typecheck                   # tsc --noEmit
pnpm lint                        # eslint src
pnpm test                        # Jest test suites
pnpm start                       # run the built stdio server (node servers/apple-docs/index.js)
```

- **The bundle is committed.** `servers/apple-docs/index.js` is what Claude Code runs, with no dependency installation step on the user machine. After changing anything under `src/` or a bundled dependency, run `pnpm build` and commit the result: a freshness test (`tests/bundle-freshness.test.ts`) fails when the committed bundle differs from a fresh build.
- **No npm or bun lockfile.** Claude Code runs `npm ci` in the plugin root when `package.json` sits next to a `package-lock.json`, `npm-shrinkwrap.json`, `bun.lock` or `bun.lockb`, which would install every development dependency on every user machine. This repository uses pnpm, whose lockfile Claude Code ignores. A guard test (`tests/plugin-lockfile-guard.test.ts`) fails if one of those files appears.
- **Dependency updates.** A cheerio upgrade must re-verify the redirect to its `load-parse` entry in `scripts/build-bundle.mjs` (run `pnpm build` and the standalone bundle test).
- **Release.** Releases are cut with the CPV canonical pipeline: `uv run python scripts/publish.py` (lint, validation, tests, version bump in `plugin.json`, `package.json` and `pyproject.toml`, changelog, tag, push and GitHub release). Nothing is published to npm.

## Contributing

Contributions are welcome! Here is how to get started:

1. **Fork** the repository
2. **Create** a feature branch: `git checkout -b feature/amazing-feature`
3. **Commit** your changes using Conventional Commits (checked by commitlint in CI): `git commit -m "feat: add amazing feature"`
4. **Push** to the branch: `git push origin feature/amazing-feature`
5. **Open** a Pull Request

## License

MIT License, see [LICENSE](LICENSE) for details. The original work is copyright kimsungwhee; additions are copyright Emasoft. The licenses of the dependencies bundled into the server are listed in [servers/apple-docs/THIRD_PARTY_LICENSES.txt](servers/apple-docs/THIRD_PARTY_LICENSES.txt).

## Disclaimer

This project is not affiliated with or endorsed by Apple Inc. It uses publicly available Apple Developer Documentation APIs for educational and development purposes.

---

[Report Issues](https://github.com/Emasoft/docs-librarian-agent/issues) • [Request Features](https://github.com/Emasoft/docs-librarian-agent/issues/new) • [Source](https://github.com/Emasoft/docs-librarian-agent)

TDQS

A3.5/5.0

Scored across 28 tools

Disambiguation3/5

Most tools target distinct corpora and actions, but several boundaries blur: get_documentation_updates overlaps with get_apple_sdk_changelog, find_similar_apis overlaps with get_related_apis, and search_wwdc_content overlaps with get_wwdc_code_examples. Descriptions provide guidance, but with 28 tools across Apple, WWDC, and Claude Code there is still meaningful risk of misselection.

Naming Consistency4/5

Names are consistently snake_case and generally follow a verb_noun pattern. Minor deviations such as browse_wwdc_topics versus list_* tools and the batch suffix in resolve_references_batch keep it from being perfectly uniform.

Tool Count2/5

At 28 tools, the surface is heavy for a documentation server. While the breadth comes from covering multiple corpora, many fine-grained tools could be consolidated or scoped more tightly.

Completeness4/5

Coverage is broad across Apple developer docs, design resources, WWDC content, Claude Code docs, and changelogs, with search/read/list/download operations for the main domains. Minor gaps remain, such as no dedicated symbol-detail tool and overlapping rather than unified update/changelog retrieval.

Maintenance

ActivityActive
ResponsivenessNo recent community issues