Skip to main content
Glama
Audiobook Library MCP Server

Audiobook Library MCP Server

by joelmale
README.md
# ๐ŸŽง Audiobook Library MCP Server

> **Advanced MCP server for intelligent audiobook library management with AI-powered pattern recognition, web lookup capabilities, and audio processing features.**

[![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
[![Node.js](https://img.shields.io/badge/Node.js-43853D?style=for-the-badge&logo=node.js&logoColor=white)](https://nodejs.org/)
[![Claude MCP](https://img.shields.io/badge/Claude-MCP-orange?style=for-the-badge)](https://modelcontextprotocol.io/)

## โœจ Features

### ๐Ÿง  **AI-Powered Intelligence**
- **Web Lookup Integration** - Identifies books using Google Books, Open Library, and more
- **Advanced Pattern Recognition** - Learns your organizational preferences
- **Smart Entity Recognition** - Extracts authors, titles, series from any filename format
- **Intelligent Suggestions** - Context-aware recommendations with confidence scoring

### ๐ŸŽต **Audio Processing** 
- **MP3 Combination** - Merge multiple files with lossless concatenation
- **M4B Audiobook Creation** - Professional audiobooks with metadata and chapters
- **Format Conversion** - Support for MP3, M4A, FLAC, OGG โ†’ M4B
- **Automatic Chapter Markers** - Generated from individual files

### ๐Ÿ“š **Library Management**
- **Audiobookshelf Compatibility** - Perfect integration with Audiobookshelf
- **Intelligent Organization** - Author-first, series-first, or hybrid structures
- **Bulk Operations** - Process hundreds of files efficiently
- **Archive Handling** - Extract ZIP, RAR, 7Z files automatically

### ๐Ÿ” **Advanced Analysis**
- **Filename Intelligence** - Handles any naming convention
- **Metadata Enhancement** - Combines file metadata with web sources
- **Confidence Scoring** - Reliability ratings for all suggestions
- **Learning System** - Gets smarter with every interaction

## ๐Ÿš€ Quick Start

### Prerequisites

```bash
# Install FFmpeg (required for audio processing)
brew install ffmpeg  # macOS
# or visit https://ffmpeg.org/download.html

# Verify installation
ffmpeg -version
```

### Installation

```bash
# Clone the repository
git clone https://github.com/yourusername/audiobook-mcp-server.git
cd audiobook-mcp-server

# Install dependencies
npm install

# Build the project
npm run build
```

### Configuration

1. **Set up Claude Desktop configuration** at `~/Library/Application Support/Claude/claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "audiobook-library": {
      "command": "node",
      "args": ["/path/to/audiobook-mcp-server/dist/index.js"],
      "env": {
        "AUDIOBOOK_ROOT": "/path/to/your/audiobook/library"
      }
    }
  }
}
```

2. **Restart Claude Desktop**

3. **Test the connection:**
   ```
   "Scan my audiobooks library"
   ```

## ๐Ÿ’ก Usage Examples

### Basic Operations
```
"Scan my audiobooks library"
"Analyze my Temp folder and suggest integration"
"Extract archive files in [folder]"
```

### AI-Powered Analysis
```
"Analyze this filename using web lookup: 'HP1_sorcerers_stone_jim_dale.mp3'"
"Bulk analyze my messy files and suggest proper names"
"Get smart suggestions for organizing my library"
```

### Audio Processing
```
"Combine the MP3 files in this folder into one audiobook"
"Create an M4B audiobook with metadata and chapters"
"Convert this series to M4B format with proper naming"
```

### Learning & Preferences
```
"Learn from this action: I renamed the file to include the author"
"Update my preferences: I prefer author-first organization"
"Show me insights about my organizing patterns"
```

## ๐Ÿ› ๏ธ Available Tools

| Tool | Description |
|------|-------------|
| `scan_library` | Recursively scan audiobook directories |
| `intelligent_filename_analysis` | Analyze filenames using web lookups |
| `smart_entity_recognition` | Identify authors, titles, series from names |
| `web_lookup_book` | Query web sources for book information |
| `bulk_filename_enrichment` | Mass analyze and suggest improvements |
| `combine_mp3_files` | Merge multiple MP3s into single file |
| `create_m4b_audiobook` | Convert to M4B with metadata and chapters |
| `analyze_patterns` | Deep analysis of library patterns |
| `smart_suggestions` | AI-powered organization recommendations |
| `learn_from_action` | Record user actions for learning |

## ๐ŸŒ Web Sources

- **Google Books API** - Comprehensive book database
- **Open Library** - Open-source book information  
- **LibriVox** - Public domain audiobooks
- **Audible** - Audiobook-specific data (limited)

## ๐Ÿ—๏ธ Architecture

```
src/
โ”œโ”€โ”€ index.ts                 # Main MCP server implementation
โ”œโ”€โ”€ WebLookupEngine         # Web API integration and caching
โ”œโ”€โ”€ PatternRecognizer       # AI pattern detection and learning
โ”œโ”€โ”€ SmartSuggestionEngine   # Intelligent recommendation system
โ””โ”€โ”€ AudiobookMCPServer      # Core server with all tool implementations
```

## ๐Ÿ“Š Data Storage

The server creates these files in your audiobook root directory:

- `.mcp_learning_data.json` - Pattern recognition and user actions
- `.mcp_user_preferences.json` - Explicit user preferences  
- `.mcp_lookup_cache.json` - Cached web lookup results (7-day expiry)

**All data stays local on your system** - no external data transmission except for web API queries.

## ๐Ÿ”ง Development

```bash
# Development mode with auto-reload
npm run dev

# Build for production
npm run build

# Test the built server
node dist/index.js
```

## ๐Ÿ“‹ Requirements

- **Node.js** 18.0.0 or higher
- **FFmpeg** (for audio processing)
- **TypeScript** 5.0.0 or higher
- **Claude Desktop** (for MCP integration)

## ๐Ÿค Contributing

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## ๐Ÿ“ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## ๐Ÿ™ Acknowledgments

- [Model Context Protocol](https://modelcontextprotocol.io/) for the MCP framework
- [Google Books API](https://developers.google.com/books) for book data
- [Open Library](https://openlibrary.org/) for open-source book information
- [FFmpeg](https://ffmpeg.org/) for audio processing capabilities
- [Audiobookshelf](https://www.audiobookshelf.org/) for inspiration on audiobook organization

## ๐Ÿ“ง Support

If you encounter issues or have questions:

1. Check the [Issues](https://github.com/yourusername/audiobook-mcp-server/issues) page
2. Create a new issue with detailed information
3. Include your system information and error logs

---

**Transform your chaotic audiobook collection into a perfectly organized, AI-enhanced library!** ๐ŸŽงโœจ

TDQS

C2.8/5.0

Scored across 24 tools

Disambiguation2/5

Several clusters of near-duplicate tools exist: intelligent_filename_analysis, smart_entity_recognition, and bulk_filename_enrichment all parse filenames with web lookups; analyze_patterns, smart_suggestions, pattern_insights, and learn_from_action all operate on the same learning/pattern domain; and validate_naming_rules, validate_audiobookshelf_compliance, standardize_audiobookshelf_structure, and suggest_reorganization overlap heavily. An agent would struggle to pick the right tool for 'identify book from filename' or 'check naming'.

Naming Consistency3/5

All names use snake_case, but verb style is inconsistent: verb-first action names (rename_file, validate_naming_rules) mix with noun-first and adjective-prefixed names (pattern_insights, intelligent_filename_analysis, smart_suggestions, web_lookup_book). The smart_/intelligent_/analyze_ prefixes don't map to a predictable pattern.

Tool Count3/5

24 tools is at the heavy end for what is essentially a file-management/metadata domain, and the count is inflated by redundant learning and validation tools. The core capabilities could be delivered in roughly half the tools without loss of function.

Completeness4/5

Coverage spans scanning, metadata enrichment, file operations, structure standardization, and MP3/M4B conversion, which is broadly complete for an audiobook library workflow. Gaps remain: no delete/remove file tool, no search/query tool over the library, and no direct read of embedded audio tags.

Maintenance

ActivityInactive
ResponsivenessNo recent community issues