Registry Caching
mcpd includes a built-in caching system to improve performance when working with remote MCP server registries. The caching system stores registry manifests locally to avoid repeated network requests.
Cache Directory
All commands that access remote registries (add and search) support optional parameters to configure caching behavior.
You can specify the cache directory in multiple ways:
CLI flag:
--cache-dir <path>Default:
~/.cache/mcpd/registries/
Cache Time-to-Live (TTL)
You can configure how long cached registry manifests remain valid:
CLI flag:
--cache-ttl <duration>Default:
24h
The duration format accepts values like:
1h(1 hour)30m(30 minutes)24h(24 hours)1h30m(1 hour 30 minutes)
Caching Control
Disabling Cache
To disable caching entirely and always fetch fresh data:
Refreshing Cache
To force refresh cached manifests (ignoring TTL):
Cache Behavior
When Caching is Enabled (Default)
First Request: Downloads registry manifest from remote URL and stores it in the cache directory
Subsequent Requests: Uses cached file if it exists and hasn't expired (based on TTL)
Expired Cache: Automatically downloads fresh manifest when TTL expires
Cache Miss: Falls back to remote URL if cache file is corrupted or missing
When Caching is Disabled
No Directory Creation: Cache directory is never created on the filesystem
Always Remote: All requests go directly to remote registry URLs
No Storage: No files are written to disk
Cache File Naming
Cache files are stored using SHA-256 hashes of the registry URLs:
Examples
Basic Usage with Custom Cache Directory
Combining Cache Options
Common Issues
If registry results look stale, retry with --refresh-cache or bypass cache once with --no-cache.
If cache directory creation fails, ensure:
Parent directory is writable
Sufficient disk space is available
No conflicting file already exists at the cache path
For step-by-step diagnosis of registry lookup or cache problems, see Troubleshooting.
Performance
Caching significantly improves performance for repeated operations. The default 24-hour TTL provides a good balance between freshness and performance for most use cases.
Last updated