### Install doc2mcp Python SDK Source: https://github.com/ell-hol/doc2mcp-python/blob/main/README.md Instructions to install the doc2mcp Python client library using pip. ```bash pip install doc2mcp ``` -------------------------------- ### doc2mcp SDK Configuration File Source: https://github.com/ell-hol/doc2mcp-python/blob/main/README.md Example of the `config.json` file used by the doc2mcp SDK for storing server URL and API key. ```json { "server_url": "https://your-instance.com", "api_key": "your-api-key" } ``` -------------------------------- ### Install Git Pre-commit Hooks Source: https://github.com/ell-hol/doc2mcp-python/blob/main/CONTRIBUTING.md Command to install pre-commit hooks, which automate code quality checks and formatting before commits are finalized. ```bash pre-commit install ``` -------------------------------- ### Install doc2mcp Python SDK in Development Mode Source: https://github.com/ell-hol/doc2mcp-python/blob/main/CONTRIBUTING.md Command to install the doc2mcp Python SDK package in editable development mode, which includes all necessary development dependencies. ```bash pip install -e ".[dev]" ``` -------------------------------- ### Upload documentation files using doc2mcp Python client Source: https://github.com/ell-hol/doc2mcp-python/blob/main/README.md Shows how to initialize the `Doc2MCPClient` and upload multiple documentation files to create a new project, printing the project details. ```python from doc2mcp import Doc2MCPClient # Initialize authenticated client client = Doc2MCPClient() # Upload documentation files project = client.upload_documents( name="My API Documentation", files=["./docs/api.md", "./docs/guide.md", "./README.md"], description="Complete API documentation for my project" ) print(f"Project created: {project.name}") print(f"MCP Endpoint: {project.mcp_endpoint}") print(f"API Token: {project.api_token}") ``` -------------------------------- ### Create and Activate Python Virtual Environment Source: https://github.com/ell-hol/doc2mcp-python/blob/main/CONTRIBUTING.md Commands to create a new Python virtual environment and activate it, ensuring project dependencies are isolated. Includes instructions for both Unix-like and Windows operating systems. ```bash python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate ``` -------------------------------- ### Initialize Doc2MCPClient API Reference Source: https://github.com/ell-hol/doc2mcp-python/blob/main/README.md API reference for initializing the `Doc2MCPClient` class, including optional parameters for `base_url` and `api_key`. ```APIDOC Doc2MCPClient: __init__(base_url: str = "https://your-instance.com", api_key: str = "your-api-key") base_url: Optional, uses authenticated server api_key: Optional, uses stored credentials ``` -------------------------------- ### Clone doc2mcp Python SDK Repository Source: https://github.com/ell-hol/doc2mcp-python/blob/main/CONTRIBUTING.md Instructions to clone the forked doc2mcp Python SDK repository locally and navigate into its directory for development. ```bash git clone https://github.com/YOUR_USERNAME/doc2mcp.git cd doc2mcp/python-sdk ``` -------------------------------- ### Authenticate with doc2mcp server in Python Source: https://github.com/ell-hol/doc2mcp-python/blob/main/README.md Demonstrates how to log in to your doc2mcp instance using the `login` function from the SDK. ```python from doc2mcp import login # Login to your doc2mcp instance login("https://your-doc2mcp-instance.com") ``` -------------------------------- ### Manage doc2mcp projects via CLI Source: https://github.com/ell-hol/doc2mcp-python/blob/main/README.md CLI commands for uploading documentation, listing projects, searching within a project, and deleting a project. ```bash # Upload documentation doc2mcp upload --name "My Docs" --description "API documentation" ./docs/ # List projects doc2mcp list # Search in a project doc2mcp search my-project-slug "authentication" # Delete a project doc2mcp delete my-project-slug ``` -------------------------------- ### Run Pytest Test Suite Source: https://github.com/ell-hol/doc2mcp-python/blob/main/CONTRIBUTING.md Command to execute the project's entire test suite using the pytest framework to ensure code functionality. ```bash pytest ``` -------------------------------- ### List all doc2mcp projects using Python Source: https://github.com/ell-hol/doc2mcp-python/blob/main/README.md Shows how to retrieve and display a list of all projects associated with the authenticated user, including their status and file count. ```python # Get all your projects projects = client.get_projects() for project in projects: print(f"{project.name} ({project.status}) - {project.file_count} files") ``` -------------------------------- ### API Reference: get_project method Source: https://github.com/ell-hol/doc2mcp-python/blob/main/README.md Documentation for the `get_project` method, detailing its parameter (`project_id`) and return type (`Project` object). ```APIDOC get_project(project_id: int) project_id: Project ID Returns: Project object ``` -------------------------------- ### API Reference: get_projects method Source: https://github.com/ell-hol/doc2mcp-python/blob/main/README.md Documentation for the `get_projects` method, detailing its return type (List of `Project` objects). ```APIDOC get_projects() Returns: List of Project objects ``` -------------------------------- ### Run Python Code Formatting and Linting Tools Source: https://github.com/ell-hol/doc2mcp-python/blob/main/CONTRIBUTING.md Commands to apply code formatting with Black, perform linting with Flake8, and run static type checking with Mypy on the Python codebase to maintain coding standards. ```bash black . flake8 . mypy doc2mcp ``` -------------------------------- ### Run Pytest with Code Coverage Report Source: https://github.com/ell-hol/doc2mcp-python/blob/main/CONTRIBUTING.md Command to execute tests with pytest and generate an HTML code coverage report for the `doc2mcp` module, indicating tested lines of code. ```bash pytest --cov=doc2mcp --cov-report=html ``` -------------------------------- ### Authenticate with doc2mcp CLI Source: https://github.com/ell-hol/doc2mcp-python/blob/main/README.md Commands for logging in, checking login status, and logging out using the doc2mcp command-line interface. ```bash # Login doc2mcp login --server https://your-instance.com # Check login status doc2mcp whoami # Logout doc2mcp logout ``` -------------------------------- ### API Reference: search method Source: https://github.com/ell-hol/doc2mcp-python/blob/main/README.md Documentation for the `search` method, detailing its parameters (`project_slug`, `query`, `api_token`, `limit`) and return type (`SearchResult` object). ```APIDOC search(project_slug: str, query: str, api_token: str, limit: int = 10) project_slug: Project slug query: Search query api_token: API token for authentication limit: Maximum number of results (optional) Returns: SearchResult object with matching documents ``` -------------------------------- ### API Reference: upload_documents method Source: https://github.com/ell-hol/doc2mcp-python/blob/main/README.md Documentation for the `upload_documents` method, detailing its parameters (`name`, `files`, `description`) and return type (`Project` object). ```APIDOC upload_documents(name: str, files: List[str], description: str = "") name: Project name files: List of file paths to upload description: Project description (optional) Returns: Project object with endpoint details ``` -------------------------------- ### Search documents in a doc2mcp project using Python Source: https://github.com/ell-hol/doc2mcp-python/blob/main/README.md Illustrates how to perform a search query within a specific doc2mcp project using its slug and API token, then iterates through the results. ```python # Search your documentation results = client.search( project_slug=project.slug, query="authentication setup", api_token=project.api_token, limit=5 ) for result in results.results: print(f"Score: {result.score}") print(f"Content: {result.content[:200]}...") ``` -------------------------------- ### Handle doc2mcp SDK errors in Python Source: https://github.com/ell-hol/doc2mcp-python/blob/main/README.md Demonstrates how to catch specific exceptions like `UploadError` and `APIError` when interacting with the doc2mcp SDK, providing robust error handling. ```python from doc2mcp.exceptions import ( Doc2MCPError, ProjectNotFoundError, UploadError, APIError ) try: project = client.upload_documents( name="My Docs", files=["./nonexistent.md"] ) except UploadError as e: print(f"Upload failed: {e}") except APIError as e: print(f"API error: {e}") ``` -------------------------------- ### Run Specific Pytest File Source: https://github.com/ell-hol/doc2mcp-python/blob/main/CONTRIBUTING.md Command to execute tests contained within a particular test file, allowing for focused testing. ```bash pytest tests/test_client.py ``` -------------------------------- ### API Reference: delete_project method Source: https://github.com/ell-hol/doc2mcp-python/blob/main/README.md Documentation for the `delete_project` method, detailing its parameter (`project_id`) and return type (Boolean indicating success). ```APIDOC delete_project(project_id: int) project_id: Project ID to delete Returns: Boolean indicating success ``` -------------------------------- ### Run Specific Pytest Test Method Source: https://github.com/ell-hol/doc2mcp-python/blob/main/CONTRIBUTING.md Command to execute a single, specific test method within a test class in a file, useful for debugging or verifying isolated changes. ```bash pytest tests/test_client.py::TestDoc2MCPClient::test_upload_documents ``` -------------------------------- ### Commit Git Changes with Descriptive Message Source: https://github.com/ell-hol/doc2mcp-python/blob/main/CONTRIBUTING.md Command to commit staged changes to Git, including a descriptive message that summarizes the nature of the changes. ```bash git commit -m "Add feature: your feature description" ``` -------------------------------- ### Create New Git Branch for Feature or Bugfix Source: https://github.com/ell-hol/doc2mcp-python/blob/main/CONTRIBUTING.md Command to create and switch to a new Git branch, isolating development work for a specific feature or bugfix. ```bash git checkout -b feature/your-feature-name ``` -------------------------------- ### API Reference: Project Data Model Source: https://github.com/ell-hol/doc2mcp-python/blob/main/README.md Definition of the `Project` data class, including its attributes and their types, representing a doc2mcp project. ```APIDOC @dataclass class Project: id: int name: str slug: str description: str status: str # 'processing', 'ready', 'error' file_count: int mcp_endpoint: str api_token: str created_at: str ``` -------------------------------- ### API Reference: SearchResult Data Model Source: https://github.com/ell-hol/doc2mcp-python/blob/main/README.md Definition of the `SearchResult` and `SearchResultItem` data classes, including their attributes and types, used for search operation results. ```APIDOC @dataclass class SearchResult: results: List[SearchResultItem] total: int query: str @dataclass class SearchResultItem: content: str score: float metadata: dict ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.