{"_id":"@ankush_thxkur/miyami-pdf-tool-mcp-server","name":"@ankush_thxkur/miyami-pdf-tool-mcp-server","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@ankush_thxkur/miyami-pdf-tool-mcp-server","version":"1.0.0","description":"MCP Server for Miyami PDF Tool - Advanced PDF operations for Claude Desktop","type":"module","main":"dist/index.js","bin":{"pdf-mcp-server":"dist/index.js"},"scripts":{"build":"tsc && chmod +x dist/index.js","dev":"tsc --watch","start":"node dist/index.js","test":"node dist/index.js","prepublishOnly":"npm run build"},"keywords":["mcp","model-context-protocol","pdf","pdf-generation","claude","ai","miyami","pdf-tool","pdf-api","document-generation"],"author":{"name":"Ankush Thakur","email":"ankushthakur2007@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/ankushthakur2007/miyami-pdf-mcptool.git","directory":"mcp-server"},"homepage":"https://github.com/ankushthakur2007/miyami-pdf-mcptool#readme","bugs":{"url":"https://github.com/ankushthakur2007/miyami-pdf-mcptool/issues"},"engines":{"node":">=18.0.0"},"publishConfig":{"access":"public"},"dependencies":{"@modelcontextprotocol/sdk":"^1.22.0","zod":"^3.25.76","node-fetch":"^3.3.2"},"devDependencies":{"@types/node":"^20.11.0","typescript":"^5.3.3"},"_id":"@ankush_thxkur/miyami-pdf-tool-mcp-server@1.0.0","gitHead":"248a3c65606cec0352a2cee547c265f9a52bffd1","types":"./dist/index.d.ts","_nodeVersion":"20.19.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-grFpc3CO9TsIwfYDEkXm5EqvSyBu7D9ChXi4UkanQYcMU5LK3tIqgvd6XimY4Zpyb04iZAQWbegQA3X304C21w==","shasum":"5102ed71743efcf35c0ad92494ecfa677e983b72","tarball":"https://registry.npmjs.org/@ankush_thxkur/miyami-pdf-tool-mcp-server/-/miyami-pdf-tool-mcp-server-1.0.0.tgz","fileCount":15,"unpackedSize":90457,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDKTff2v0Yu0vYTZeYgcsXr35qFvWe3ASePr7j2HyzeTgIhAPZ4Tl2amgMIW+GSnZAnauYklVolJ4rszwdwQq/wxQqo"}]},"_npmUser":{"name":"ankush_thxkur","email":"k41946688@gmail.com"},"directories":{},"maintainers":[{"name":"ankush_thxkur","email":"k41946688@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/miyami-pdf-tool-mcp-server_1.0.0_1763738419260_0.97657978091427"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-21T15:20:18.886Z","1.0.0":"2025-11-21T15:20:19.446Z","modified":"2025-11-21T15:20:19.698Z"},"maintainers":[{"name":"ankush_thxkur","email":"k41946688@gmail.com"}],"description":"MCP Server for Miyami PDF Tool - Advanced PDF operations for Claude Desktop","homepage":"https://github.com/ankushthakur2007/miyami-pdf-mcptool#readme","keywords":["mcp","model-context-protocol","pdf","pdf-generation","claude","ai","miyami","pdf-tool","pdf-api","document-generation"],"repository":{"type":"git","url":"git+https://github.com/ankushthakur2007/miyami-pdf-mcptool.git","directory":"mcp-server"},"author":{"name":"Ankush Thakur","email":"ankushthakur2007@gmail.com"},"bugs":{"url":"https://github.com/ankushthakur2007/miyami-pdf-mcptool/issues"},"license":"MIT","readme":"# Miyami PDF Tool - MCP Server\n\nAdvanced PDF generation and manipulation server for Claude Desktop using the Model Context Protocol (MCP).\n\n## Features\n\n### 🎨 PDF Generation\n- **HTML to PDF**: Convert rich HTML with CSS styling\n- **Markdown to PDF**: Automatic conversion with beautiful formatting\n- **Text to PDF**: Plain text with customizable layout\n- **URL to PDF**: Convert any webpage to PDF\n\n### 🔧 PDF Manipulation\n- **Merge PDFs**: Combine multiple PDFs into one\n- **Extract Pages**: Pull specific pages from a PDF\n- **Rotate Pages**: Rotate pages by 90°, 180°, or 270°\n- **Add Watermarks**: Text watermarks with position, opacity, rotation\n\n### 📊 PDF Analysis\n- **Extract Text**: Pull text content for processing\n- **Get Info**: Metadata, page count, size, format\n- **List PDFs**: View all your generated PDFs\n\n## Quick Start\n\n### 1. Prerequisites\n\n- Node.js 18+ installed\n- PDF SaaS platform running (see main README)\n- API key from the dashboard\n\n### 2. Install Dependencies\n\n```bash\ncd mcp-server\nnpm install\n```\n\n### 3. Configure Environment\n\nCreate `.env` file:\n\n```bash\nPDF_API_BASE_URL=http://localhost:3000\nPDF_API_KEY=sk_live_your_api_key_here\nPDF_API_TIMEOUT=120000\n```\n\n**Get your API key:**\n1. Run the PDF SaaS platform: `cd .. && npm run dev`\n2. Sign up/login at http://localhost:3000\n3. Go to Dashboard → API Keys\n4. Create a new key and copy it\n\n### 4. Build the Server\n\n```bash\nnpm run build\n```\n\n### 5. Configure Claude Desktop\n\nEdit your Claude Desktop config file:\n\n**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`\n**Windows**: `%APPDATA%\\Claude\\claude_desktop_config.json`\n\nAdd this configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"pdf-saas\": {\n      \"command\": \"node\",\n      \"args\": [\"/absolute/path/to/pdf-saas/mcp-server/dist/index.js\"],\n      \"env\": {\n        \"PDF_API_BASE_URL\": \"http://localhost:3000\",\n        \"PDF_API_KEY\": \"sk_live_your_api_key_here\"\n      }\n    }\n  }\n}\n```\n\n**Replace `/absolute/path/to/pdf-saas/` with your actual path!**\n\n### 6. Restart Claude Desktop\n\nQuit and reopen Claude Desktop. The PDF tools will now be available!\n\n## Usage Examples\n\n### Generate PDF from HTML\n\n```\nCan you create a PDF from this HTML:\n<h1>Invoice</h1>\n<p>Invoice #12345</p>\n<table>\n  <tr><th>Item</th><th>Price</th></tr>\n  <tr><td>Service</td><td>$100</td></tr>\n</table>\n```\n\n### Generate PDF from Markdown\n\n```\nGenerate a PDF from this markdown:\n# Project Report\n## Summary\nThis is the summary...\n```\n\n### Convert Webpage to PDF\n\n```\nConvert https://example.com to PDF\n```\n\n### Merge Multiple PDFs\n\n```\nMerge these PDFs into one:\n- https://example.com/doc1.pdf\n- https://example.com/doc2.pdf\n- https://example.com/doc3.pdf\n```\n\n### Extract Specific Pages\n\n```\nExtract pages 1, 3, and 5 from this PDF:\nhttps://example.com/document.pdf\n```\n\n### Add Watermark\n\n```\nAdd a \"CONFIDENTIAL\" watermark to this PDF:\nhttps://example.com/document.pdf\nPosition: center, opacity 0.3, rotation 45 degrees\n```\n\n### Extract Text\n\n```\nExtract all text from this PDF:\nhttps://example.com/document.pdf\n```\n\n## Available Tools\n\n| Tool | Description | Key Parameters |\n|------|-------------|----------------|\n| `generate-pdf-from-html` | Convert HTML to PDF | html, options (format, margins, header/footer) |\n| `generate-pdf-from-markdown` | Convert Markdown to PDF | markdown, options |\n| `generate-pdf-from-text` | Convert text to PDF | text, options |\n| `generate-pdf-from-url` | Web page to PDF | url, format, wait_for, full_page |\n| `merge-pdfs` | Combine PDFs | pdf_urls (2-10 PDFs) |\n| `extract-pages` | Pull specific pages | pdf_url, pages (array) |\n| `rotate-pages` | Rotate pages | pdf_url, pages, angle (90/180/270) |\n| `add-watermark` | Add text watermark | pdf_url, text, position, opacity, rotation |\n| `extract-text` | Extract text content | pdf_url, pages (optional), max_length |\n| `get-pdf-info` | Get PDF metadata | pdf_url |\n| `list-pdfs` | List your PDFs | page, limit |\n\n## Configuration Options\n\n### PDF Generation Options\n\n```typescript\n{\n  format: 'A4' | 'Letter' | 'Legal',  // Default: A4\n  filename: 'output.pdf',              // Optional custom name\n  margin: {\n    top: '20mm',\n    right: '20mm',\n    bottom: '20mm',\n    left: '20mm'\n  },\n  landscape: false,                    // Portrait by default\n  header: 'Header text',               // Optional\n  footer: 'Page {page} of {pages}'     // Optional, supports placeholders\n}\n```\n\n### Watermark Options\n\n```typescript\n{\n  position: 'center' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right',\n  opacity: 0.3,        // 0-1, default 0.3\n  rotation: 45,        // -90 to 90, default 0\n  font_size: 48        // 8-72, default 48\n}\n```\n\n## Troubleshooting\n\n### MCP Server Not Appearing in Claude\n\n1. **Check config path**: Ensure the path in `claude_desktop_config.json` is absolute\n2. **Verify build**: Run `npm run build` in mcp-server directory\n3. **Check logs**: Look at Claude Desktop logs (Help → View Logs)\n4. **Restart Claude**: Fully quit and reopen\n\n### API Connection Errors\n\n```\nError: PDF_API_KEY environment variable is required\n```\n\n**Solution**: Add `PDF_API_KEY` to your `.env` file or Claude config\n\n```\nError: Request timeout\n```\n\n**Solution**: Increase `PDF_API_TIMEOUT` in environment (default 120 seconds)\n\n```\nError: Unauthorized - Please provide a valid API key\n```\n\n**Solution**: \n1. Verify API key is correct\n2. Check key is active in dashboard\n3. Ensure PDF SaaS platform is running\n\n### PDF Generation Errors\n\n```\nError: Failed to generate PDF\n```\n\n**Common causes**:\n- Invalid HTML/Markdown syntax\n- Extremely large content (>50MB)\n- Network timeout for URL conversion\n- Insufficient disk space\n\n**Solutions**:\n1. Validate HTML/Markdown before submission\n2. Split large documents into smaller parts\n3. Increase timeout for complex web pages\n4. Check disk space\n\n### Rate Limiting\n\n```\nError: Rate limit exceeded\n```\n\n**Solution**: \n- Wait for rate limit to reset (shown in error)\n- Increase rate limit in dashboard (API Keys page)\n- Use different API key\n\n## Development\n\n### Run in Development Mode\n\n```bash\nnpm run dev\n```\n\nThis watches for file changes and recompiles automatically.\n\n### Test the Server\n\n```bash\n# Build first\nnpm run build\n\n# Test directly\nnpm run test\n```\n\n### Project Structure\n\n```\nmcp-server/\n├── src/\n│   ├── index.ts          # Main MCP server\n│   ├── api-client.ts     # API client for Next.js endpoints\n│   └── schemas.ts        # Zod validation schemas\n├── dist/                 # Compiled output\n├── package.json\n├── tsconfig.json\n└── .env.example\n```\n\n## Security\n\n- ✅ API key authentication required\n- ✅ Rate limiting enforced\n- ✅ Input validation with Zod\n- ✅ Timeout protection\n- ✅ Error sanitization\n\n**Best Practices**:\n- Never commit `.env` file\n- Use different API keys for dev/prod\n- Rotate API keys regularly\n- Monitor usage in dashboard\n- Set appropriate rate limits\n\n## Performance Tips\n\n1. **Batch Operations**: Merge multiple PDFs instead of generating separately\n2. **Cache Results**: Reuse generated PDFs when possible\n3. **Optimize Content**: Minimize HTML/CSS for faster rendering\n4. **Use Templates**: Create reusable templates for common formats\n5. **Parallel Requests**: Generate multiple PDFs concurrently (respects rate limits)\n\n## API Endpoints Used\n\n| MCP Tool | API Endpoint | Method |\n|----------|--------------|--------|\n| generate-pdf-* | `/api/pdf/generate` | POST |\n| generate-pdf-from-url | `/api/pdf/generate-from-url` | POST |\n| merge-pdfs | `/api/pdf/merge` | POST |\n| extract-pages, rotate-pages | `/api/pdf/modify` | POST |\n| add-watermark | `/api/pdf/watermark` | POST |\n| extract-text | `/api/pdf/extract` | POST |\n| get-pdf-info | `/api/pdf/{id}` | GET |\n| list-pdfs | `/api/pdf/list` | GET |\n\n**Note**: Some endpoints need to be implemented in the Next.js app (merge, modify, watermark, extract, single PDF info).\n\n## Contributing\n\nWe welcome contributions! Areas for improvement:\n- Additional PDF operations (compress, OCR, form filling)\n- Template system integration\n- Batch processing utilities\n- Enhanced error messages\n- Performance optimizations\n\n## Support\n\n- 📚 Documentation: See main [README.md](../README.md)\n- 🐛 Issues: Report bugs in GitHub issues\n- 💬 Questions: Check [PROJECT_SUMMARY.md](../PROJECT_SUMMARY.md)\n\n## License\n\nMIT License - See main project for details\n\n---\n\n**Made with ❤️ for Claude Desktop and the MCP ecosystem**\n","readmeFilename":"README.md","_rev":"1-7d91cd2c783233da3e74631b2d0687be"}