Labsco
mehmetozcan-zz logo

KnowledgeBaseMCP

โ˜… 5

from mehmetozcan-zz

Extract text content from local PDF, DOCX, and PPTX files to build a knowledge base.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeAdvanced setup

KnowledgeBaseMCP

A powerful Model Context Protocol (MCP) server for extracting text content from various document formats including PDF, DOCX, PPTX, and XLSX files. This tool enables AI assistants like Claude to read and analyze document contents from your local knowledge base, and also create new Excel spreadsheets.

๐Ÿš€ Features

Document Reading

  • Multi-format support: Extract text from PDF, DOCX, PPTX, and XLSX files
  • Directory processing: Process entire directories of documents
  • Recursive scanning: Optionally scan subdirectories
  • File metadata: Get detailed information about document files
  • Error handling: Robust error handling with clear error messages
  • Async processing: Efficient asynchronous document processing

Excel Spreadsheet Creation

  • XLSX workbook creation: Create Excel files with multiple sheets
  • DataFrame support: Convert pandas DataFrames to Excel
  • Data formatting: Apply professional formatting and styling
  • Report generation: Create structured reports with summaries
  • Data appending: Add data to existing Excel files
  • Template support: Use predefined templates for consistent formatting

Integration

  • Easy integration: Simple setup with Claude Desktop
  • MCP protocol: Built on the Model Context Protocol standard

๐Ÿ“ Supported File Types

Reading Support

  • PDF (.pdf) - Portable Document Format (using pdfplumber)
  • DOCX (.docx) - Microsoft Word documents
  • PPTX (.pptx) - Microsoft PowerPoint presentations
  • XLSX (.xlsx) - Microsoft Excel spreadsheets (using openpyxl and pandas)

Writing Support

  • DOCX (.docx) - Create Word documents with formatting
  • XLSX (.xlsx) - Create Excel workbooks with multiple sheets, formatting, and charts

๐Ÿ—๏ธ Project Structure

Copy & paste โ€” that's it
KnowledgeBaseMCP/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ __init__.py          # Package initialization
โ”‚   โ”œโ”€โ”€ main.py             # Main MCP server
โ”‚   โ”œโ”€โ”€ extractors.py       # Document reading classes
โ”‚   โ”œโ”€โ”€ docx_writer.py      # Word document creation
โ”‚   โ””โ”€โ”€ xlsx_writer.py      # Excel spreadsheet creation
โ”œโ”€โ”€ requirements.txt        # Python dependencies
โ”œโ”€โ”€ setup.py               # Package setup
โ”œโ”€โ”€ README.md              # This file
โ”œโ”€โ”€ LICENSE                # MIT License
โ”œโ”€โ”€ launch_mcp.py          # Server launcher
โ”œโ”€โ”€ run_server.py          # Alternative launcher
โ”œโ”€โ”€ test.py               # Basic test script
โ””โ”€โ”€ test_xlsx.py          # XLSX functionality tests

๐Ÿ”ง Development

Running Tests

Copy & paste โ€” that's it
python test.py

Adding New File Formats

To add support for additional document formats:

  1. Add the file extension to SUPPORTED_EXTENSIONS in extractors.py
  2. Install the required library
  3. Add the library check to check_dependencies()
  4. Implement the extraction method (e.g., _extract_xlsx())
  5. Add the format handling to extract_from_file()

Debugging

For debugging MCP connection issues:

  1. Check Claude Desktop logs
  2. Ensure the server starts without errors:
    Copy & paste โ€” that's it
    python launch_mcp.py
  3. Verify the config file path and format

๐Ÿ“ฆ Dependencies

Core Dependencies

  • mcp>=0.9.0 - Model Context Protocol framework

Document Reading

  • python-docx>=1.1.0 - For DOCX file processing
  • pdfplumber>=0.9.0 - For PDF file processing
  • python-pptx>=0.6.23 - For PPTX file processing
  • openpyxl>=3.1.0 - For XLSX file reading/writing
  • pandas>=2.0.0 - For advanced data manipulation and analysis

Additional

  • lxml>=4.9.0 - XML processing support

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit pull requests or open issues.

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

๐Ÿ“„ License

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

๐Ÿ™ Acknowledgments

๐Ÿ“ž Support

If you encounter any issues or have questions, please open an issue on GitHub.


Made with โค๏ธ for the Claude AI community