Skip to main content
Glama

Calibre MCP Server

by ispyridis
test.js3.02 kB
#!/usr/bin/env node /** * Test script for Calibre MCP Server * Verifies that Calibre is accessible and the library exists */ const CalibreMCPServer = require('./server.js'); const fs = require('fs'); const path = require('path'); console.log('🔍 Testing Calibre MCP Server Setup...\n'); // Create server instance const server = new CalibreMCPServer(); // Test 1: Check if Calibre is found console.log('1. Checking Calibre installation...'); if (server.calibredbPath) { console.log(` ✅ Found calibredb at: ${server.calibredbPath}`); } else { console.log(' ❌ calibredb not found!'); console.log(' 💡 Install Calibre or add it to your PATH'); } // Test 2: Check library exists console.log('\n2. Checking Calibre library...'); const libraryPath = 'D:\\e-library'; const metadataPath = path.join(libraryPath, 'metadata.db'); if (fs.existsSync(libraryPath)) { console.log(` ✅ Library folder exists: ${libraryPath}`); if (fs.existsSync(metadataPath)) { console.log(' ✅ Database file found'); } else { console.log(' ⚠️ Database file not found - library may be empty'); } } else { console.log(` ❌ Library not found at: ${libraryPath}`); console.log(' 💡 Create a Calibre library or update the path in server.js'); } // Test 3: Try a simple command console.log('\n3. Testing Calibre command...'); server.runCalibreCommand(['--version']) .then(result => { console.log(' ✅ Calibre command works!'); console.log(` 📖 Version: ${result.trim()}`); return testSearch(); }) .catch(error => { console.log(' ❌ Calibre command failed:'); console.log(` Error: ${error.message}`); }); async function testSearch() { console.log('\n4. Testing library search...'); try { const results = await server.runCalibreCommand(['list', '--limit', '5', '--for-machine']); const books = JSON.parse(results || '[]'); if (books.length > 0) { console.log(` ✅ Found ${books.length} books in library`); console.log(' 📚 Sample books:'); books.slice(0, 3).forEach(book => { console.log(` - "${book.title}" by ${book.authors}`); }); } else { console.log(' ⚠️ No books found in library'); console.log(' 💡 Add some books to your Calibre library'); } } catch (error) { console.log(' ❌ Library search failed:'); console.log(` Error: ${error.message}`); } console.log('\n🎉 Test complete!'); console.log('\nIf all tests passed, you can now use this MCP server with Claude Desktop.'); console.log('Add this to your claude_desktop_config.json:'); console.log(JSON.stringify({ mcpServers: { calibre: { command: "node", args: [__dirname.replace(/\\/g, '/') + "/server.js"] } } }, null, 2)); }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ispyridis/calibre-mcp-nodejs'

If you have feedback or need assistance with the MCP directory API, please join our Discord server