Skip to main content

Add your description here

Project description

MCP Documentation Search Server

A powerful documentation search server built with FastMCP, enabling AI systems to intelligently search across multiple popular framework and library documentations. This tool ensures that AI models can quickly access and retrieve relevant information from various documentation sources using a unified interface.

๐ŸŒŸ Features

  • ๐Ÿ“š Multi-Library Support: Search documentation across multiple libraries:

  • ๐Ÿ” Intelligent Search

    • Smart name resolution for library variations
    • DuckDuckGo-powered search for accurate results
    • Site-specific search targeting
  • โšก Performance Features

    • Asynchronous processing
    • Efficient web request handling
    • Parallel content fetching
  • ๐Ÿ›ก๏ธ Robust Error Handling

    • Network timeout management
    • Invalid input validation
    • HTTP error handling
    • Request failure recovery

๐Ÿ“‹ Requirements

  • Python 3.8+
  • pip or uv package manager
  • Virtual environment (recommended)

๐Ÿš€ Quick Start

  1. Clone the Repository
git clone <repository-url>
cd mcp-server
  1. Set Up Virtual Environment
python -m venv .venv
# On Windows:
.venv\Scripts\activate
# On Unix or MacOS:
source .venv/bin/activate
  1. Install Dependencies
pip install -r requirements.txt
  1. Run the Server
python main.py

๐Ÿ’ป Usage

Basic Usage

from main import get_docs

# Search Framer Motion documentation
result = await get_docs(
    query="how to animate on scroll",
    library="framer-motion"
)

# Search Next.js documentation
result = await get_docs(
    query="how to use app router",
    library="next"
)

Library Name Variations

The system intelligently handles various library name formats:

# All these calls will work the same way
await get_docs(query="animations", library="framer")
await get_docs(query="animations", library="framermotion")
await get_docs(query="animations", library="framer-motion")
await get_docs(query="animations", library="motion")

๐Ÿงช Testing

The project includes a comprehensive test suite to ensure reliability and correctness. Tests are organized into three main categories:

Test Structure

  • Unit Tests: Test individual components in isolation

    • test_utils.py: Tests for library name normalization and URL retrieval
    • test_services.py: Tests for web search and content fetching services
  • Integration Tests: Test how components work together

    • test_main.py: Tests for the main API function get_docs

Running Tests

To run all tests:

python -m pytest

To run specific test modules:

python -m pytest tests/test_utils.py
python -m pytest tests/test_services.py
python -m pytest tests/test_main.py

To run tests with verbose output:

python -m pytest -v

Test Coverage

The tests cover:

  • โœ… Library name normalization and validation
  • โœ… URL retrieval for different libraries
  • โœ… Web search functionality
  • โœ… Content fetching and error handling
  • โœ… Documentation search integration
  • โœ… API input validation and error handling
  • โœ… Alias resolution for different library name formats

Asynchronous Testing

The project uses a custom run_async helper function to test asynchronous code in a synchronous test environment. This approach allows for testing async functions without requiring complex test setup.

๐Ÿ—๏ธ Project Structure

mcp-server/
โ”œโ”€โ”€ main.py          # Entry point and FastMCP tool definition
โ”œโ”€โ”€ config.py        # Configuration settings and constants
โ”œโ”€โ”€ services.py      # Web search and content fetching services
โ”œโ”€โ”€ utils.py         # Utility functions for library name handling
โ”œโ”€โ”€ tests/           # Test suite
โ”‚   โ”œโ”€โ”€ test_utils.py    # Tests for utility functions
โ”‚   โ”œโ”€โ”€ test_services.py # Tests for web services
โ”‚   โ”œโ”€โ”€ test_main.py     # Tests for main API
โ”‚   โ””โ”€โ”€ conftest.py      # Pytest configuration
โ”œโ”€โ”€ requirements.txt # Project dependencies
โ””โ”€โ”€ README.md        # Documentation

๐Ÿ”ง Configuration

Supported Libraries

To add a new library:

  1. Add the documentation URL in config.py:
DOCS_URLS = {
    "new-library": "https://docs.new-library.com",
    # ... existing entries
}
  1. Add common aliases:
LIBRARY_ALIASES = {
    "new-lib": "new-library",
    # ... existing entries
}

HTTP Settings

Modify in config.py:

HTTP_TIMEOUT = 30.0        # Timeout in seconds
MAX_SEARCH_RESULTS = 2     # Number of search results to fetch

๐Ÿค Contributing

We welcome contributions! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Ensure all tests pass
  6. Submit a pull request

Adding New Libraries

  1. Update DOCS_URLS in config.py
  2. Add relevant aliases in LIBRARY_ALIASES
  3. Test the integration
  4. Update documentation
  5. Submit a pull request

๐Ÿ› Troubleshooting

Common issues and solutions:

  • TimeoutError: Increase HTTP_TIMEOUT in config.py
  • No Results: Try different search terms or verify the library name
  • HTTP Errors: Check your internet connection and the documentation URL

๐Ÿ“„ License

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

๐Ÿ™ Acknowledgments

  • FastMCP for the core functionality
  • DuckDuckGo for search capabilities
  • pytest for testing framework
  • All supported documentation providers

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file iflow_mcp_picardraphael_mcp_server_documentation-0.1.1.tar.gz.

File metadata

File hashes

Hashes for iflow_mcp_picardraphael_mcp_server_documentation-0.1.1.tar.gz
Algorithm Hash digest
SHA256 aee5c1d18e0a84f7eb9e416689856df9761d936c2a255dc61b24d060e595d17c
MD5 75c552d070ffd445a4d6b9ba2da12da7
BLAKE2b-256 ae1aba29932884aac909655cfd597a774635c21b44cfaa89f138907b7f974c3d

See more details on using hashes here.

File details

Details for the file iflow_mcp_picardraphael_mcp_server_documentation-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for iflow_mcp_picardraphael_mcp_server_documentation-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 24eda4c2ed4c56f7394132e82f4f4e97afe5c2cbfb49b131b096e677ff7291b0
MD5 d5297c56b4e39ddb1499fad9ac06a14e
BLAKE2b-256 5fad3041995cf4c2b517f13483562db8147fb9a85ab0d5458f057cffc5e9d19f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page