iiif-mcp

trevormunoz/iiif-mcp

3.2

If you are the rightful owner of iiif-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The IIIF MCP Server is a Model Context Protocol server designed to provide AI assistants with access to IIIF documentation, enabling efficient retrieval, caching, and searching of API specifications.

Tools
  1. get_api_docs

    Retrieve IIIF Documentation for specific APIs.

  2. search_docs

    Search through cached IIIF documentation.

  3. health_check

    Check server operational status and database connectivity.

  4. ping

    Test server connectivity and responsiveness.

IIIF MCP Server

A Model Context Protocol (MCP) server that provides access to IIIF (International Image Interoperability Framework) documentation. This server enables AI assistants to retrieve, cache, and search through IIIF API specifications including Image API, Presentation API, Search API, and Authentication API documentation.

Features

  • šŸ“š Documentation Retrieval: Fetch and cache IIIF API documentation from iiif.io
  • šŸ” Smart Search: Search across cached documentation with keyword matching
  • šŸ’¾ Intelligent Caching: SQLite-based caching with configurable TTL (24 hours default)
  • āœ… Content Validation: Validates retrieved content contains IIIF-specific patterns
  • šŸ“Š Health Monitoring: Basic health checks for operational status

Installation

# Clone the repository
git clone <repository-url>
cd iiif-mcp

# Install dependencies
npm install

# Build the project
npm run build

Usage

Starting the Server

# Development mode
npm run dev

# Production mode
npm start

Available Tools

1. get_api_docs - Retrieve IIIF Documentation

Fetch documentation for specific IIIF APIs.

{
  "name": "get_api_docs",
  "arguments": {
    "api": "image",
    "version": "3.0",
    "section": "parameters",
    "forceRefresh": false
  }
}

Parameters:

  • api (required): API type (image, presentation, search, auth)
  • version (optional): API version (default: 3.0)
  • section (optional): Filter to specific section by title
  • forceRefresh (optional): Force refresh from source (default: false)
2. search_docs - Search Documentation

Search through cached IIIF documentation.

{
  "name": "search_docs", 
  "arguments": {
    "query": "image parameters",
    "apis": ["image", "presentation"],
    "maxResults": 5
  }
}

Parameters:

  • query (required): Search terms to look for
  • apis (optional): Specific APIs to search (default: all common APIs)
  • maxResults (optional): Maximum results to return (default: 10)
3. health_check - Server Health Status

Check server operational status and database connectivity.

{
  "name": "health_check",
  "arguments": {}
}
4. ping - Test Connectivity

Test server connectivity and responsiveness.

{
  "name": "ping",
  "arguments": {
    "includeTimestamp": true
  }
}

Configuration

Configure the server using environment variables:

# Cache directory (default: ./cache)
export IIIF_CACHE_DIR=/path/to/cache

# HTTP request timeout in milliseconds (default: 5000)
export IIIF_HTTP_TIMEOUT=10000

# Log level (default: info)
export IIIF_LOG_LEVEL=debug

Architecture

Core Components

  • MCP Server: Handles tool requests and responses
  • HTTP Client: Fetches content from iiif.io with retry logic
  • Content Cache: SQLite-based caching with TTL management
  • Parser: Extracts and structures content from HTML documentation
  • Validator: Ensures retrieved content is valid IIIF documentation
  • Monitor: Health checks for operational status

File Structure

src/
ā”œā”€ā”€ server.ts              # MCP server setup and tool routing
ā”œā”€ā”€ config.ts              # Configuration management
ā”œā”€ā”€ http.ts                 # HTTP client with retry logic
ā”œā”€ā”€ cache.ts                # SQLite content caching
ā”œā”€ā”€ parser.ts               # HTML parsing and text extraction
ā”œā”€ā”€ validation.ts           # Content validation and error handling
ā”œā”€ā”€ monitoring.ts           # Health monitoring
└── tools/
    ā”œā”€ā”€ ping.ts            # Ping tool implementation
    ā”œā”€ā”€ get-docs.ts        # Documentation retrieval tool
    └── search.ts          # Search functionality

Development

Running Tests

# Run all tests
npm test

# Run tests in watch mode
npm run test:watch

# Run specific test file
npm test -- config.test.ts

Type Checking

# Check TypeScript types
npm run typecheck

Linting

# Run ESLint
npm run lint

API Coverage

The server provides access to documentation for these IIIF APIs:

License

This project is licensed under the MIT License - see the file for details.

Related Projects