# Kavita (eBook/Manga) MCP

> Kavita (eBook/Manga) MCP lets your AI agent manage large media libraries. It handles core maintenance tasks like running global scans for new manga chapters or checking API key expiration dates. You authenticate sessions and maintain index health without ever touching the web UI.

## Overview
- **Category:** content-management
- **Price:** Free
- **Tags:** ebooks, manga, media-server, library-management, kavita

## Description

Managing a growing digital library—especially one filled with ongoing content like comics or manga—is usually tedious. You have to manually trigger full scans, check keys, and ensure everything is indexed correctly. This MCP connects your media server directly to your AI client, letting you automate all that overhead using natural conversation. Instead of navigating the web interface, you just ask your agent to 'check for new content' or 'verify my API key status.' It handles library maintenance, session authentication, and monitoring through a simple chat command. Because it integrates with Vinkius, you can connect this media management layer into any workflow using Claude, Cursor, or any compatible client. Your AI acts like a dedicated librarian that never sleeps.

## Tools

### check_authkey_expires
Checks the specific date when your API key will become invalid or expire.

### authenticate
Retrieves a JWT token after verifying credentials to establish an active, secure connection.

### scan_all_libraries
Initiates a full scan across every single library on the server for new content.

### scan_library
Starts a focused scan job on one specific library ID, useful for troubleshooting.

## Prompt Examples

**Prompt:** 
```
Scan all my Kavita libraries for new manga.
```

**Response:** 
```
I've triggered a global scan for all your libraries. Kavita is now processing your folders to detect any new or updated files.
```

**Prompt:** 
```
Check when my Kavita API key expires.
```

**Response:** 
```
I've checked your API key status. It is set to expire on 2025-12-31. You have plenty of time before needing a refresh.
```

**Prompt:** 
```
Trigger a scan for library ID 5.
```

**Response:** 
```
Targeted scan for Library ID 5 has been started. I will let you know if any issues occur during the process.
```

## Capabilities

### Scan entire content libraries
Triggering scans across all connected collections to detect new files and update metadata.

### Index specific library sections
Running a targeted scan on one library ID when you know exactly where the updates are.

### Verify API key validity
Checking the expiration date of your access keys to prevent service outages.

### Establish secure sessions
Authenticating with the server and retrieving necessary tokens for reliable interaction.

## Use Cases

### The weekly archive maintenance cycle
A DevOps engineer needs confirmation that the nightly manga ingest process worked. Instead of logging into the web UI and running multiple scans, they ask their agent to `scan_all_libraries` and then follow up by checking the API key status with `check_authkey_expires`. The agent reports on both success metrics in one chat.

### Troubleshooting a single collection
A collector notices only their sci-fi library is missing new chapters. They don't want to scan everything, so they ask the agent to `scan_library` using only that specific ID. The agent runs the targeted scan and confirms if the issue was indexing or an API failure.

### Pre-deployment readiness check
A developer needs to confirm their service access before deployment. They ask the agent to `authenticate` first, confirming they have a valid token. Then, they run `check_authkey_expires` to ensure the key is good for the next quarter.

### Automating onboarding for new content
A user adds a massive batch of books overnight. They ask the agent to trigger a scan, and because they used `authenticate` beforehand, the agent knows how to talk to the server right away and reports when the entire process is complete.

## Benefits

- Eliminate manual scanning. Instead of clicking 'Scan All' in the web UI, you can tell your agent to use `scan_all_libraries`, and it handles triggering the global library scan instantly.
- Stay ahead of service outages. Use `check_authkey_expires` to confirm if your API key is about to expire before it causes a content indexing failure.
- Target updates precisely. If only one specific collection needs checking, use `scan_library` with a defined ID instead of running a time-consuming full system scan.
- Secure access starts here. Run the `authenticate` tool first; your agent gets the necessary JWT token to talk to the server securely and reliably.
- Get immediate status updates. You don't have to guess if content was indexed. Your agent confirms success or flags potential issues after any operation.

## How It Works

The bottom line is, it lets your agent talk directly to your media server backend without needing any web browser interaction.

1. Subscribe to this MCP, then input your Kavita Server URL and API Key credentials.
2. Tell your AI client what you need—for example, 'Scan all my manga libraries for new chapters.'
3. The agent executes the required action against the server and reports back the status or result.

## Frequently Asked Questions

**How do I check if my Kavita key is about to expire using `check_authkey_expires`?**
You prompt the agent with a request to use `check_authkey_expires`. It will return the precise date of expiration, letting you know how much time you have before needing to update your credentials.

**Should I use `scan_all_libraries` or `scan_library`?**
Use `scan_all_libraries` when you need a comprehensive system audit. Use `scan_library` only when you know the update is confined to one specific collection ID; it's faster and more precise.

**What must I do before running any commands with `authenticate`?**
You must first provide your server URL and API key during setup. The agent uses this information to execute the `authenticate` tool, which establishes a secure session token you need for subsequent actions.

**Does the MCP help me with manga indexing? (Kavita)**
Yes. You can use the tools to trigger scans and verify API status, ensuring your latest chapters are correctly indexed and ready in your collection.

**If I use the `authenticate` tool, how do I pass the resulting JWT token to subsequent actions?**
The agent provides a temporary JSON Web Token (JWT). You must capture this token and include it in the headers of every follow-up request—like running a scan or checking status—to maintain session access.

**What happens if I run `scan_library` on an empty folder, and what error codes should I expect?**
It completes successfully. The system confirms that the specified library was scanned but found no new content. Look for a 'Scan Complete' message rather than an error code.

**After triggering `scan_all_libraries`, how can I verify that all libraries were indexed and updated?**
The tool returns a job ID or status report detailing which libraries are processing. Wait for the final confirmation message before assuming indexing is complete; check the logs for any warnings.

**Does `check_authkey_expires` only work with my primary Kavita instance, or can I monitor multiple locations?**
The tool queries a single configured API endpoint. To monitor multiple media sources, you'll need to configure and run the check against each distinct Kavita URL.

**Can I trigger a scan for just one specific library?**
Yes! Use the `scan_library` tool and provide the specific Library ID. The agent will trigger a targeted scan to detect new or changed content in that folder only.

**How do I check if my API key is still valid?**
You can run the `check_authkey_expires` tool. It will return the exact expiration timestamp for your current API key, helping you avoid service interruptions.

**Can I refresh my entire collection at once?**
Absolutely. Use the `scan_all_libraries` tool to trigger a global scan across all configured libraries in your Kavita instance.