Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

feat: re-merge MCP server feature (originally PR #1366) (#2263)

LearningCircuit214c1f78d156
diff --git a/.github/workflows/mcp-tests.yml b/.github/workflows/mcp-tests.yml
new file mode 100644
index 0000000000..48d64c0d01
--- /dev/null
+++ b/.github/workflows/mcp-tests.yml
@@ -0,0 +1,122 @@
+name: MCP Server Tests
+
+on:
+ push:
+ branches: [ main, dev ]
+ paths:
+ - 'src/local_deep_research/mcp/**'
+ - 'src/local_deep_research/advanced_search_system/strategies/mcp_strategy.py'
+ - 'tests/mcp/**'
+ - 'scripts/mcp_smoke_test.sh'
+ - '.github/workflows/mcp-tests.yml'
+ pull_request:
+ branches: [ main, dev ]
+ paths:
+ - 'src/local_deep_research/mcp/**'
+ - 'src/local_deep_research/advanced_search_system/strategies/mcp_strategy.py'
+ - 'tests/mcp/**'
+ - 'scripts/mcp_smoke_test.sh'
+ - '.github/workflows/mcp-tests.yml'
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+jobs:
+ mcp-tests:
+ name: MCP Server Tests
+ runs-on: ubuntu-latest
+ timeout-minutes: 15
+
+ steps:
+ - name: Harden the runner (Audit all outbound calls)
+ uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
+ with:
+ egress-policy: audit
+
+ - name: Checkout code
+ uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
+ with:
+ persist-credentials: false
+
+ - name: Set up Python
+ uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6
+ with:
+ python-version: '3.12'
+
+ - name: Install dependencies
+ run: |
+ python -m pip install pip==25.0
+ pip install pdm==2.26.2
+ pdm install --dev --no-editable -G mcp
+
+ - name: Check if MCP server module exists
+ id: check-mcp
+ run: |
+ if [ -f "src/local_deep_research/mcp/server.py" ]; then
+ echo "mcp_exists=true" >> "$GITHUB_OUTPUT"
+ echo "MCP server module found, will run tests"
+ else
+ echo "mcp_exists=false" >> "$GITHUB_OUTPUT"
+ echo "MCP server module not found (feature not yet merged), skipping tests"
+ fi
+
+ - name: Run MCP smoke tests
+ if: steps.check-mcp.outputs.mcp_exists == 'true'
+ run: pdm run bash scripts/mcp_smoke_test.sh
+
+ - name: Run MCP unit tests
+ if: steps.check-mcp.outputs.mcp_exists == 'true'
+ run: |
+ pdm run pytest tests/mcp/ -v --tb=short -n auto \
+ --ignore=tests/mcp/test_mcp_strategy.py
+ env:
+ LDR_USE_FALLBACK_LLM: "true"
+ LDR_TESTING_WITH_MOCKS: "true"
+
+ - name: Run MCP strategy tests
+ if: steps.check-mcp.outputs.mcp_exists == 'true'
+ run: |
+ pdm run pytest tests/mcp/test_mcp_strategy.py -v --tb=short -n auto
+ env:
+ LDR_USE_FALLBACK_LLM: "true"
+ LDR_TESTING_WITH_MOCKS: "true"
+
+ - name: Skip notice
+ if: steps.check-mcp.outputs.mcp_exists != 'true'
+ run: |
+ echo "::notice::MCP server module not yet implemented. Tests will run once feature/mcp-server is merged."
+
+ - name: Generate test summary
+ if: always()
+ env:
+ MCP_EXISTS: ${{ steps.check-mcp.outputs.mcp_exists }}
+ run: |
+ {
+ echo "## MCP Server Test Summary"
+ echo ""
+ if [ "$MCP_EXISTS" != "true" ]; then
+ echo "### ⏭️ Tests Skipped"
+ echo ""
+ echo "MCP server module (\`src/local_deep_research/mcp/server.py\`) not yet implemented."
+ echo "Tests will run automatically once the MCP feature branch is merged."
+ else
+ echo "### What was tested:"
+ echo "- 🔌 MCP server module loading"
+ echo "- 🔧 Discovery tools (list_strategies, list_search_engines, get_configuration)"
+ echo "- 🧪 Unit tests for all MCP tools"
+ echo "- 🤖 MCP strategy (ReAct pattern) tests"
+ echo "- 🚀 Server startup verification"
+ echo ""
+ echo "### MCP Tools Tested:"
+ echo "| Tool | Description |"
+ echo "|------|-------------|"
+ echo "| \`quick_research\` | Fast research summary (1-5 min) |"
+ echo "| \`detailed_research\` | Comprehensive analysis (5-15 min) |"
+ echo "| \`generate_report\` | Full markdown report (10-30 min) |"
+ echo "| \`analyze_documents\` | Search local collections |"
+ echo "| \`list_search_engines\` | List available search engines |"
+ echo "| \`list_strategies\` | List research strategies |"
+ echo "| \`get_configuration\` | Get current config |"
+ fi
+ } >> "$GITHUB_STEP_SUMMARY"
diff --git a/README.md b/README.md
index 37cfe7da91..b5f8587f56 100644
--- a/README.md
+++ b/README.md
@@ -502,6 +502,56 @@ Works with: FAISS, Chroma, Pinecone, Weaviate, Elasticsearch, and any LangChain-
[Integration Guide →](docs/LANGCHAIN_RETRIEVER_INTEGRATION.md)
+## 🔌 MCP Server (Claude Integration)
+
+LDR provides an MCP (Model Context Protocol) server that allows AI assistants like Claude to perform deep research.
+
+> ⚠️ **Security Note**: This MCP server is designed for **local use only** via STDIO transport (e.g., Claude Desktop). It has no built-in authentication or rate limiting. Do not expose over a network without implementing proper security controls. See the [MCP Security Guide](https://modelcontextprotocol.io/docs/concepts/security) for network deployment requirements.
+
+### Installation
+
+```bash
+# Install with MCP extras
+pip install "local-deep-research[mcp]"
+```
+
+### Claude Desktop Configuration
+
+Add to your `claude_desktop_config.json`:
+
+```json
+{
+ "mcpServers": {
+ "local-deep-research": {
+ "command": "ldr-mcp",
+ "env": {
+ "LDR_LLM_PROVIDER": "openai",
+ "LDR_LLM_OPENAI_API_KEY": "sk-..."
+ }
+ }
+ }
+}
+```
+
+### Available Tools
+
+| Tool | Description | Duration |
+|------|-------------|----------|
+| `quick_research` | Fast research summary | 1-5 min |
+| `detailed_research` | Comprehensive analysis | 5-15 min |
+| `generate_report` | Full markdown report | 10-30 min |
+| `analyze_documents` | Search local collections | 30s-2 min |
+| `list_search_engines` | List available search engines | instant |
+| `list_strategies` | List research strategies | instant |
+| `get_configuration` | Get current config | instant |
+
+### Example Usage (via Claude)
+
+```
+"Use quick_research to find information about quantum computing applications"
+"Generate a detailed research report on renewable energy trends"
+```
+
## 📊 Performance & Analytics
### Benchmark Results
diff --git a/pdm.lock b/pdm.lock
index 399913bbc0..582f1c6391 100644
--- a/pdm.lock
+++ b/pdm.lock
@@ -2,10 +2,10 @@
# It is not intended for manual editing.
[metadata]
-groups = ["default", "dev"]
+groups = ["default", "dev", "mcp"]
strategy = ["inherit_metadata"]
lock_version = "4.5.0"
-content_hash = "sha256:dce5559a2a067def6ee9a19fee8c4f81d64e89dd3c8c250d80aa3d5a1343fb8d"
+content_hash = "sha256:bb25bc9c890445b17b98022c74426e08eb420974ff44411343b91b6e0ac6f7ac"
[[metadata.targets]]
requires_python = ">=3.11,<3.15"
@@ -174,7 +174,7 @@ name = "annotated-doc"
version = "0.0.4"
requires_python = ">=3.8"
summary = "Document parameters, class attributes, return types, and variables inline, with Annotated."
-groups = ["default"]
+groups = ["default", "mcp"]
files = [
{file = "annotated_doc-0.0.4-py3-none-any.whl", hash = "sha256:571ac1dc6991c450b25a9c2d84a3705e2ae7a53467b5d111c24fa8baabbed320"},
{file = "annotated_doc-0.0.4.tar.gz", hash = "sha256:fbcda96e87e9c92ad167c2e53839e57503ecfda18804ea28102353485033faa4"},
@@ -185,7 +185,7 @@ name = "annotated-types"
version = "0.7.0"
requires_python = ">=3.8"
summary = "Reusable constraint types to use with typing.Annotated"
-groups = ["default"]
+groups = ["default", "mcp"]
dependencies = [
"typing-extensions>=4.0.0; python_version < \"3.9\"",
]
@@ -196,7 +196,7 @@ files = [
[[package]]
name = "anthropic"
-version = "0.83.0"
+version = "0.84.0"
requires_python = ">=3.9"
summary = "The official Python library for the anthropic API"
groups = ["default"]
@@ -211,8 +211,8 @@ dependencies = [
"typing-extensions<5,>=4.10",
]
files = [
- {file = "anthropic-0.83.0-py3-none-any.whl", hash = "sha256:f069ef508c73b8f9152e8850830d92bd5ef185645dbacf234bb213344a274810"},
- {file = "anthropic-0.83.0.tar.gz", hash = "sha256:a8732c68b41869266c3034541a31a29d8be0f8cd0a714f9edce3128b351eceb4"},
+ {file = "anthropic-0.84.0-py3-none-any.whl", hash = "sha256:861c4c50f91ca45f942e091d83b60530ad6d4f98733bfe648065364da05d29e7"},
+ {file = "anthropic-0.84.0.tar.gz", hash = "sha256:72f5f90e5aebe62dca316cb013629cfa24996b0f5a4593b8c3d712bc03c43c37"},
]
[[package]]
@@ -220,7 +220,7 @@ name = "anyio"
version = "4.12.1"
requires_python = ">=3.9"
summary = "High-level concurrency and networking framework on top of asyncio or Trio"
-groups = ["default"]
+groups = ["default", "mcp"]
dependencies = [
"exceptiongroup>=1.0.2; python_version < \"3.11\"",
"idna>=2.8",
@@ -284,7 +284,7 @@ files = [
[[package]]
name = "arxiv"
-version = "2.4.0"
+version = "2.4.1"
requires_python = ">=3.9"
summary = "Python wrapper for the arXiv API"
groups = ["default"]
@@ -294,8 +294,8 @@ dependencies = [
"typing-extensions>=4.0.0; python_version < \"3.11\"",
]
files = [
- {file = "arxiv-2.4.0-py3-none-any.whl", hash = "sha256:c02ccb09a777aaadd75d3bc1d2627894ef9c987c651d0dacd864b9f69fb0569f"},
- {file = "arxiv-2.4.0.tar.gz", hash = "sha256:cabe5470d031aa3f22d2744a7600391c62c3489653f0c62bec9019e62bb0554b"},
+ {file = "arxiv-2.4.1-py3-none-any.whl", hash = "sha256:060d678410ffc224ada01089f877b7676f250e37f96c140bad6c287afadb15d8"},
+ {file = "arxiv-2.4.1.tar.gz", hash = "sha256:691606c1069bcca8316fcb082f5d15e65f1f24a021b0b87f01b9fa56347f63c8"},
]
[[package]]
@@ -303,7 +303,7 @@ name = "attrs"
version = "25.4.0"
requires_python = ">=3.9"
summary = "Classes Without Boilerplate"
-groups = ["default"]
+groups = ["default", "mcp"]
files = [
{file = "attrs-25.4.0-py3-none-any.whl", hash = "sha256:adcf7e2a1fb3b36ac48d97835bb6d8ade15b8dcce26aba8bf1d14847b57a3373"},
{file = "attrs-25.4.0.tar.gz", hash = "sha256:16d5969b87f0859ef33a48b35d55ac1be6e42ae49d5e853b597db70c35c57e11"},
@@ -458,24 +458,24 @@ files = [
[[package]]
name = "cachetools"
-version = "7.0.1"
+version = "7.0.2"
requires_python = ">=3.10"
summary = "Extensible memoizing collections and decorators"
groups = ["default"]
files = [
- {file = "cachetools-7.0.1-py3-none-any.whl", hash = "sha256:8f086515c254d5664ae2146d14fc7f65c9a4bce75152eb247e5a9c5e6d7b2ecf"},
- {file = "cachetools-7.0.1.tar.gz", hash = "sha256:e31e579d2c5b6e2944177a0397150d312888ddf4e16e12f1016068f0c03b8341"},
+ {file = "cachetools-7.0.2-py3-none-any.whl", hash = "sha256:938dcad184827c5e94928c4fd5526e2b46692b7fb1ae94472da9131d0299343c"},
+ {file = "cachetools-7.0.2.tar.gz", hash = "sha256:7e7f09a4ca8b791d8bb4864afc71e9c17e607a28e6839ca1a644253c97dbeae0"},
]
[[package]]
name = "certifi"
-version = "2026.1.4"
+version = "2026.2.25"
requires_python = ">=3.7"
summary = "Python package for providing Mozilla's CA Bundle."
-groups = ["default", "dev"]
+groups = ["default", "dev", "mcp"]
files = [
- {file = "certifi-2026.1.4-py3-none-any.whl", hash = "sha256:9943707519e4add1115f44c2bc244f782c0249876bf51b6599fee1ffbedd685c"},
- {file = "certifi-2026.1.4.tar.gz", hash = "sha256:ac726dd470482006e014ad384921ed6438c457018f4b3d204aea4281258b2120"},
+ {file = "certifi-2026.2.25-py3-none-any.whl", hash = "sha256:027692e4402ad994f1c42e52a4997a9763c646b73e4096e4d5d6db8af1d6f0fa"},
+ {file = "certifi-2026.2.25.tar.gz", hash = "sha256:e887ab5cee78ea814d3472169153c2d12cd43b14bd03329a39a9c6e2e80bfba7"},
]
[[package]]
@@ -483,7 +483,7 @@ name = "cffi"
version = "2.0.0"
requires_python = ">=3.9"
summary = "Foreign Function Interface for Python calling C code."
-groups = ["default"]
+groups = ["default", "mcp"]
dependencies = [
"pycparser; implementation_name != \"PyPy\"",
]
@@ -563,13 +563,33 @@ files = [
[[package]]
name = "chardet"
-version = "6.0.0.post1"
+version = "7.0.1"
requires_python = ">=3.10"
-summary = "Universal encoding detector for Python 3"
+summary = "Universal character encoding detector"
groups = ["dev"]
files = [
- {file = "chardet-6.0.0.post1-py3-none-any.whl", hash = "sha256:c894a36800549adf7bb5f2af47033281b75fdfcd2aa0f0243be0ad22a52e2dcb"},
- {file = "chardet-6.0.0.post1.tar.gz", hash = "sha256:6b78048c3c97c7b2ed1fbad7a18f76f5a6547f7d34dbab536cc13887c9a92fa4"},
+ {file = "chardet-7.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c3f59dc3e148b54813ec5c7b4b2e025d37f5dc221ee28a06d1a62f169cfaedf5"},
+ {file = "chardet-7.0.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:3355a3c8453d673e7c1664fdd24a0c6ef39964c3d41befc4849250f7eb1de3b5"},
+ {file = "chardet-7.0.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5333f9967863ea7d8642df0e00cf4d33e8ed7e99fe7b6464b40ba969a2808544"},
+ {file = "chardet-7.0.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:265cb3b5dafc0411c0949800a0692f07e986fb663b6ae1ecfba32ad193a55a03"},
+ {file = "chardet-7.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:26186f0ea03c4c1f9be20c088b127c71b0e9d487676930fab77625ddec2a4ef2"},
+ {file = "chardet-7.0.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:f661edbfa77b8683a503043ddc9b9fe9036cf28af13064200e11fa1844ded79c"},
+ {file = "chardet-7.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:169951fa88d449e72e0c6194cec1c5e405fd36a6cfbe74c7dab5494cc35f1700"},
+ {file = "chardet-7.0.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:dd6db7505556ae8f9e2a3bf6d689c2b86aa6b459cf39552645d2c4d3fdbf489c"},
+ {file = "chardet-7.0.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6f907962b18df78d5ca87a7484e4034354408d2c97cec6f53634b0ea0424c594"},
+ {file = "chardet-7.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:302798e1e62008ca34a216dd04ecc5e240993b2090628e2a35d4c0754313ea9a"},
+ {file = "chardet-7.0.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:67fe3f453416ed9343057dcf06583b36aae6d8bdb013370b3ff46bc37b7e30ac"},
+ {file = "chardet-7.0.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:63bc210ce73f8a1b87430b949f84d086cb326d67eb259305862e7c8861b73374"},
+ {file = "chardet-7.0.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:11f51985946b49739968b6dc2fa70e7d8f490bb15574377c5ee114f33d19ef7e"},
+ {file = "chardet-7.0.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8714f0013c208452a98e23595d99cef53c5364565454425f431446eb586e2591"},
+ {file = "chardet-7.0.1-cp313-cp313-win_amd64.whl", hash = "sha256:c12abc65830068ad05bd257fb953aaaf63a551446688e03e145522086be5738c"},
+ {file = "chardet-7.0.1-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:88793aeebb28a5296eea9bdd9b5e74ee4e3582766a6a2cb7f39e4761a96fdd55"},
+ {file = "chardet-7.0.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:44011e3b4fd4a8a15bc94736717414b7ec82880066fb22d9f476c68a4ded2647"},
+ {file = "chardet-7.0.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:33f4132f9781302beff34713fe6c990badd009aa8ea730611aef0931b27f1541"},
+ {file = "chardet-7.0.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1566d0f91990b8f33b53836391d557f779584bd48beabf90efbf7a6efa89179e"},
+ {file = "chardet-7.0.1-cp314-cp314-win_amd64.whl", hash = "sha256:9e827211249d8e3cacc1adf6950a7a8cf56920e5e303e56dcab827b71c03df33"},
+ {file = "chardet-7.0.1-py3-none-any.whl", hash = "sha256:e51e1ff2c51b2d622d97c9737bd5ee9d9b9038f05b7dd8f9ea10b9e2d9674c24"},
+ {file = "chardet-7.0.1.tar.gz", hash = "sha256:6fce895c12c5495bb598e59ae3cd89306969b4464ec7b6dd609b9c86e3397fe3"},
]
[[package]]
@@ -667,7 +687,7 @@ name = "click"
version = "8.3.1"
requires_python = ">=3.10"
summary = "Composable command line interface toolkit"
-groups = ["default", "dev"]
+groups = ["default", "dev", "mcp"]
dependencies = [
"colorama; platform_system == \"Windows\"",
]
@@ -681,7 +701,7 @@ name = "colorama"
version = "0.4.6"
requires_python = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
summary = "Cross-platform colored terminal text."
-groups = ["default", "dev"]
+groups = ["default", "dev", "mcp"]
marker = "platform_system == \"Windows\" or sys_platform == \"win32\""
files = [
{file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
@@ -788,8 +808,8 @@ files = [
[[package]]
name = "cookiecutter"
-version = "2.6.0"
-requires_python = ">=3.7"
+version = "2.7.1"
+requires_python = ">=3.10"
summary = "A command-line utility that creates projects from project templates, e.g. creating a Python package project from a Python package project template."
groups = ["dev"]
dependencies = [
@@ -803,8 +823,8 @@ dependencies = [
"rich",
]
files = [
- {file = "cookiecutter-2.6.0-py3-none-any.whl", hash = "sha256:a54a8e37995e4ed963b3e82831072d1ad4b005af736bb17b99c2cbd9d41b6e2d"},
- {file = "cookiecutter-2.6.0.tar.gz", hash = "sha256:db21f8169ea4f4fdc2408d48ca44859349de2647fbe494a9d6c3edfc0542c21c"},
+ {file = "cookiecutter-2.7.1-py3-none-any.whl", hash = "sha256:cee50defc1eaa7ad0071ee9b9893b746c1b3201b66bf4d3686d0f127c8ed6cf9"},
+ {file = "cookiecutter-2.7.1.tar.gz", hash = "sha256:ca7bb7bc8c6ff441fbf53921b5537668000e38d56e28d763a1b73975c66c6138"},
]
[[package]]
@@ -1019,7 +1039,7 @@ name = "cryptography"
version = "46.0.5"
requires_python = "!=3.9.0,!=3.9.1,>=3.8"
summary = "cryptography is a package which provides cryptographic recipes and primitives to Python developers."
-groups = ["default"]
+groups = ["default", "mcp"]
dependencies = [
"cffi>=1.14; python_full_version == \"3.8.*\" and platform_python_implementation != \"PyPy\"",
"cffi>=2.0.0; python_full_version >= \"3.9\" and platform_python_implementation != \"PyPy\"",
@@ -1120,14 +1140,14 @@ files = [
[[package]]
name = "datasets"
-version = "4.5.0"
-requires_python = ">=3.9.0"
+version = "4.6.1"
+requires_python = ">=3.10.0"
summary = "HuggingFace community-driven open-source library of datasets"
groups = ["default"]
dependencies = [
"dill<0.4.1,>=0.3.0",
"filelock",
- "fsspec[http]<=2025.10.0,>=2023.1.0",
+ "fsspec[http]<=2026.2.0,>=2023.1.0",
"httpx<1.0.0",
"huggingface-hub<2.0,>=0.25.0",
"multiprocess<0.70.19",
@@ -1141,8 +1161,8 @@ dependencies = [
"xxhash",
]
files = [
- {file = "datasets-4.5.0-py3-none-any.whl", hash = "sha256:b5d7e08096ffa407dd69e58b1c0271c9b2506140839b8d99af07375ad31b6726"},
- {file = "datasets-4.5.0.tar.gz", hash = "sha256:00c698ce1c2452e646cc5fad47fef39d3fe78dd650a8a6eb205bb45eb63cd500"},
+ {file = "datasets-4.6.1-py3-none-any.whl", hash = "sha256:f53228e6dadc9f837037b1bf3051d7d8c054abbb3eb29f1f022926e08090e0da"},
+ {file = "datasets-4.6.1.tar.gz", hash = "sha256:140ce500bc41939ff6ce995702d66b1f4b2ee7f117bb9b07512fab6804d4070a"},
]
[[package]]
@@ -1340,13 +1360,13 @@ files = [
[[package]]
name = "filelock"
-version = "3.24.3"
+version = "3.25.0"
requires_python = ">=3.10"
summary = "A platform independent file lock."
groups = ["default", "dev"]
files = [
- {file = "filelock-3.24.3-py3-none-any.whl", hash = "sha256:426e9a4660391f7f8a810d71b0555bce9008b0a1cc342ab1f6947d37639e002d"},
- {file = "filelock-3.24.3.tar.gz", hash = "sha256:011a5644dc937c22699943ebbfc46e969cdde3e171470a6e40b9533e5a72affa"},
+ {file = "filelock-3.25.0-py3-none-any.whl", hash = "sha256:5ccf8069f7948f494968fc0713c10e5c182a9c9d9eef3a636307a20c2490f047"},
+ {file = "filelock-3.25.0.tar.gz", hash = "sha256:8f00faf3abf9dc730a1ffe9c354ae5c04e079ab7d3a683b7c32da5dd05f26af3"},
]
[[package]]
@@ -1694,29 +1714,29 @@ files = [
[[package]]
name = "fsspec"
-version = "2025.10.0"
-requires_python = ">=3.9"
+version = "2026.2.0"
+requires_python = ">=3.10"
summary = "File-system specification"
groups = ["default"]
files = [
- {file = "fsspec-2025.10.0-py3-none-any.whl", hash = "sha256:7c7712353ae7d875407f97715f0e1ffcc21e33d5b24556cb1e090ae9409ec61d"},
- {file = "fsspec-2025.10.0.tar.gz", hash = "sha256:b6789427626f068f9a83ca4e8a3cc050850b6c0f71f99ddb4f542b8266a26a59"},
+ {file = "fsspec-2026.2.0-py3-none-any.whl", hash = "sha256:98de475b5cb3bd66bedd5c4679e87b4fdfe1a3bf4d707b151b3c07e58c9a2437"},
+ {file = "fsspec-2026.2.0.tar.gz", hash = "sha256:6544e34b16869f5aacd5b90bdf1a71acb37792ea3ddf6125ee69a22a53fb8bff"},
]
[[package]]
name = "fsspec"
-version = "2025.10.0"
+version = "2026.2.0"
extras = ["http"]
-requires_python = ">=3.9"
+requires_python = ">=3.10"
summary = "File-system specification"
groups = ["default"]
dependencies = [
"aiohttp!=4.0.0a0,!=4.0.0a1",
- "fsspec==2025.10.0",
+ "fsspec==2026.2.0",
]
files = [
- {file = "fsspec-2025.10.0-py3-none-any.whl", hash = "sha256:7c7712353ae7d875407f97715f0e1ffcc21e33d5b24556cb1e090ae9409ec61d"},
- {file = "fsspec-2025.10.0.tar.gz", hash = "sha256:b6789427626f068f9a83ca4e8a3cc050850b6c0f71f99ddb4f542b8266a26a59"},
+ {file = "fsspec-2026.2.0-py3-none-any.whl", hash = "sha256:98de475b5cb3bd66bedd5c4679e87b4fdfe1a3bf4d707b151b3c07e58c9a2437"},
+ {file = "fsspec-2026.2.0.tar.gz", hash = "sha256:6544e34b16869f5aacd5b90bdf1a71acb37792ea3ddf6125ee69a22a53fb8bff"},
]
[[package]]
@@ -1791,7 +1811,7 @@ name = "h11"
version = "0.16.0"
requires_python = ">=3.8"
summary = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1"
-groups = ["default"]
+groups = ["default", "mcp"]
files = [
{file = "h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86"},
{file = "h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1"},
@@ -1799,34 +1819,37 @@ files = [
[[package]]
name = "hf-xet"
-version = "1.2.0"
+version = "1.3.2"
requires_python = ">=3.8"
summary = "Fast transfer of large files with the Hugging Face Hub."
groups = ["default"]
marker = "platform_machine == \"x86_64\" or platform_machine == \"amd64\" or platform_machine == \"AMD64\" or platform_machine == \"arm64\" or platform_machine == \"aarch64\""
files = [
- {file = "hf_xet-1.2.0-cp313-cp313t-macosx_10_12_x86_64.whl", hash = "sha256:ceeefcd1b7aed4956ae8499e2199607765fbd1c60510752003b6cc0b8413b649"},
- {file = "hf_xet-1.2.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:b70218dd548e9840224df5638fdc94bd033552963cfa97f9170829381179c813"},
- {file = "hf_xet-1.2.0-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7d40b18769bb9a8bc82a9ede575ce1a44c75eb80e7375a01d76259089529b5dc"},
- {file = "hf_xet-1.2.0-cp313-cp313t-manylinux_2_28_aarch64.whl", hash = "sha256:cd3a6027d59cfb60177c12d6424e31f4b5ff13d8e3a1247b3a584bf8977e6df5"},
- {file = "hf_xet-1.2.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:6de1fc44f58f6dd937956c8d304d8c2dea264c80680bcfa61ca4a15e7b76780f"},
- {file = "hf_xet-1.2.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:f182f264ed2acd566c514e45da9f2119110e48a87a327ca271027904c70c5832"},
- {file = "hf_xet-1.2.0-cp313-cp313t-win_amd64.whl", hash = "sha256:293a7a3787e5c95d7be1857358a9130694a9c6021de3f27fa233f37267174382"},
- {file = "hf_xet-1.2.0-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:10bfab528b968c70e062607f663e21e34e2bba349e8038db546646875495179e"},
- {file = "hf_xet-1.2.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:2a212e842647b02eb6a911187dc878e79c4aa0aa397e88dd3b26761676e8c1f8"},
- {file = "hf_xet-1.2.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:30e06daccb3a7d4c065f34fc26c14c74f4653069bb2b194e7f18f17cbe9939c0"},
- {file = "hf_xet-1.2.0-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:29c8fc913a529ec0a91867ce3d119ac1aac966e098cf49501800c870328cc090"},
- {file = "hf_xet-1.2.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:66e159cbfcfbb29f920db2c09ed8b660eb894640d284f102ada929b6e3dc410a"},
- {file = "hf_xet-1.2.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:9c91d5ae931510107f148874e9e2de8a16052b6f1b3ca3c1b12f15ccb491390f"},
- {file = "hf_xet-1.2.0-cp314-cp314t-win_amd64.whl", hash = "sha256:210d577732b519ac6ede149d2f2f34049d44e8622bf14eb3d63bbcd2d4b332dc"},
- {file = "hf_xet-1.2.0-cp37-abi3-macosx_10_12_x86_64.whl", hash = "sha256:46740d4ac024a7ca9b22bebf77460ff43332868b661186a8e46c227fdae01848"},
- {file = "hf_xet-1.2.0-cp37-abi3-macosx_11_0_arm64.whl", hash = "sha256:27df617a076420d8845bea087f59303da8be17ed7ec0cd7ee3b9b9f579dff0e4"},
- {file = "hf_xet-1.2.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3651fd5bfe0281951b988c0facbe726aa5e347b103a675f49a3fa8144c7968fd"},
- {file = "hf_xet-1.2.0-cp37-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:d06fa97c8562fb3ee7a378dd9b51e343bc5bc8190254202c9771029152f5e08c"},
- {file = "hf_xet-1.2.0-cp37-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:4c1428c9ae73ec0939410ec73023c4f842927f39db09b063b9482dac5a3bb737"},
- {file = "hf_xet-1.2.0-cp37-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:a55558084c16b09b5ed32ab9ed38421e2d87cf3f1f89815764d1177081b99865"},
- {file = "hf_xet-1.2.0-cp37-abi3-win_amd64.whl", hash = "sha256:e6584a52253f72c9f52f9e549d5895ca7a471608495c4ecaa6cc73dba2b24d69"},
- {file = "hf_xet-1.2.0.tar.gz", hash = "sha256:a8c27070ca547293b6890c4bf389f713f80e8c478631432962bb7f4bc0bd7d7f"},
+ {file = "hf_xet-1.3.2-cp313-cp313t-macosx_10_12_x86_64.whl", hash = "sha256:335a8f36c55fd35a92d0062f4e9201b4015057e62747b7e7001ffb203c0ee1d2"},
+ {file = "hf_xet-1.3.2-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:c1ae4d3a716afc774e66922f3cac8206bfa707db13f6a7e62dfff74bfc95c9a8"},
+ {file = "hf_xet-1.3.2-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:d6dbdf231efac0b9b39adcf12a07f0c030498f9212a18e8c50224d0e84ab803d"},
+ {file = "hf_xet-1.3.2-cp313-cp313t-manylinux_2_28_aarch64.whl", hash = "sha256:c1980abfb68ecf6c1c7983379ed7b1e2b49a1aaf1a5aca9acc7d48e5e2e0a961"},
+ {file = "hf_xet-1.3.2-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:1c88fbd90ad0d27c46b77a445f0a436ebaa94e14965c581123b68b1c52f5fd30"},
+ {file = "hf_xet-1.3.2-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:35b855024ca37f2dd113ac1c08993e997fbe167b9d61f9ef66d3d4f84015e508"},
+ {file = "hf_xet-1.3.2-cp313-cp313t-win_amd64.whl", hash = "sha256:31612ba0629046e425ba50375685a2586e11fb9144270ebabd75878c3eaf6378"},
+ {file = "hf_xet-1.3.2-cp313-cp313t-win_arm64.whl", hash = "sha256:433c77c9f4e132b562f37d66c9b22c05b5479f243a1f06a120c1c06ce8b1502a"},
+ {file = "hf_xet-1.3.2-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:c34e2c7aefad15792d57067c1c89b2b02c1bbaeabd7f8456ae3d07b4bbaf4094"},
+ {file = "hf_xet-1.3.2-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:4bc995d6c41992831f762096020dc14a65fdf3963f86ffed580b596d04de32e3"},
+ {file = "hf_xet-1.3.2-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:959083c89dee30f7d6f890b36cdadda823386c4de63b1a30384a75bfd2ae995d"},
+ {file = "hf_xet-1.3.2-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:cfa760888633b08c01b398d212ce7e8c0d7adac6c86e4b20dfb2397d8acd78ee"},
+ {file = "hf_xet-1.3.2-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:3155a02e083aa21fd733a7485c7c36025e49d5975c8d6bda0453d224dd0b0ac4"},
+ {file = "hf_xet-1.3.2-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:91b1dc03c31cbf733d35dc03df7c5353686233d86af045e716f1e0ea4a2673cf"},
+ {file = "hf_xet-1.3.2-cp314-cp314t-win_amd64.whl", hash = "sha256:211f30098512d95e85ad03ae63bd7dd2c4df476558a5095d09f9e38e78cbf674"},
+ {file = "hf_xet-1.3.2-cp314-cp314t-win_arm64.whl", hash = "sha256:4a6817c41de7c48ed9270da0b02849347e089c5ece9a0e72ae4f4b3a57617f82"},
+ {file = "hf_xet-1.3.2-cp37-abi3-macosx_10_12_x86_64.whl", hash = "sha256:f93b7595f1d8fefddfede775c18b5c9256757824f7f6832930b49858483cd56f"},
+ {file = "hf_xet-1.3.2-cp37-abi3-macosx_11_0_arm64.whl", hash = "sha256:a85d3d43743174393afe27835bde0cd146e652b5fcfdbcd624602daef2ef3259"},
+ {file = "hf_xet-1.3.2-cp37-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:7c2a054a97c44e136b1f7f5a78f12b3efffdf2eed3abc6746fc5ea4b39511633"},
+ {file = "hf_xet-1.3.2-cp37-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:06b724a361f670ae557836e57801b82c75b534812e351a87a2c739f77d1e0635"},
+ {file = "hf_xet-1.3.2-cp37-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:305f5489d7241a47e0458ef49334be02411d1d0f480846363c1c8084ed9916f7"},
+ {file = "hf_xet-1.3.2-cp37-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:06cdbde243c85f39a63b28e9034321399c507bcd5e7befdd17ed2ccc06dfe14e"},
+ {file = "hf_xet-1.3.2-cp37-abi3-win_amd64.whl", hash = "sha256:9298b47cce6037b7045ae41482e703c471ce36b52e73e49f71226d2e8e5685a1"},
+ {file = "hf_xet-1.3.2-cp37-abi3-win_arm64.whl", hash = "sha256:83d8ec273136171431833a6957e8f3af496bee227a0fe47c7b8b39c106d1749a"},
+ {file = "hf_xet-1.3.2.tar.gz", hash = "sha256:e130ee08984783d12717444e538587fa2119385e5bd8fc2bb9f930419b73a7af"},
]
[[package]]
@@ -1849,7 +1872,7 @@ name = "httpcore"
version = "1.0.9"
requires_python = ">=3.8"
summary = "A minimal low-level HTTP client."
-groups = ["default"]
+groups = ["default", "mcp"]
dependencies = [
"certifi",
"h11>=0.16",
@@ -1864,7 +1887,7 @@ name = "httpx"
version = "0.28.1"
requires_python = ">=3.8"
summary = "The next generation HTTP client."
-groups = ["default"]
+groups = ["default", "mcp"]
dependencies = [
"anyio",
"certifi",
@@ -1881,7 +1904,7 @@ name = "httpx-sse"
version = "0.4.3"
requires_python = ">=3.9"
summary = "Consume Server-Sent Event (SSE) messages with HTTPX."
-groups = ["default"]
+groups = ["default", "mcp"]
files = [
{file = "httpx_sse-0.4.3-py3-none-any.whl", hash = "sha256:0ac1c9fe3c0afad2e0ebb25a934a59f4c7823b60792691f779fad2c5568830fc"},
{file = "httpx_sse-0.4.3.tar.gz", hash = "sha256:9b1ed0127459a66014aec3c56bebd93da3c1bc8bb6618c8082039a44889a755d"},
@@ -1889,25 +1912,24 @@ files = [
[[package]]
name = "huggingface-hub"
-version = "1.4.1"
+version = "1.5.0"
requires_python = ">=3.9.0"
summary = "Client library to download and publish models, datasets and other repos on the huggingface.co hub"
groups = ["default"]
dependencies = [
- "filelock",
+ "filelock>=3.10.0",
"fsspec>=2023.5.0",
"hf-xet<2.0.0,>=1.2.0; platform_machine == \"x86_64\" or platform_machine == \"amd64\" or platform_machine == \"AMD64\" or platform_machine == \"arm64\" or platform_machine == \"aarch64\"",
"httpx<1,>=0.23.0",
"packaging>=20.9",
"pyyaml>=5.1",
- "shellingham",
"tqdm>=4.42.1",
- "typer-slim",
+ "typer",
"typing-extensions>=4.1.0",
]
files = [
- {file = "huggingface_hub-1.4.1-py3-none-any.whl", hash = "sha256:9931d075fb7a79af5abc487106414ec5fba2c0ae86104c0c62fd6cae38873d18"},
- {file = "huggingface_hub-1.4.1.tar.gz", hash = "sha256:b41131ec35e631e7383ab26d6146b8d8972abc8b6309b963b306fbcca87f5ed5"},
+ {file = "huggingface_hub-1.5.0-py3-none-any.whl", hash = "sha256:c9c0b3ab95a777fc91666111f3b3ede71c0cdced3614c553a64e98920585c4ee"},
+ {file = "huggingface_hub-1.5.0.tar.gz", hash = "sha256:f281838db29265880fb543de7a23b0f81d3504675de82044307ea3c6c62f799d"},
]
[[package]]
@@ -1927,13 +1949,13 @@ files = [
[[package]]
name = "identify"
-version = "2.6.16"
+version = "2.6.17"
requires_python = ">=3.10"
summary = "File identification library for Python"
groups = ["dev"]
files = [
- {file = "identify-2.6.16-py2.py3-none-any.whl", hash = "sha256:391ee4d77741d994189522896270b787aed8670389bfd60f326d677d64a6dfb0"},
- {file = "identify-2.6.16.tar.gz", hash = "sha256:846857203b5511bbe94d5a352a48ef2359532bc8f6727b5544077a0dcfb24980"},
+ {file = "identify-2.6.17-py2.py3-none-any.whl", hash = "sha256:be5f8412d5ed4b20f2bd41a65f920990bdccaa6a4a18a08f1eefdcd0bdd885f0"},
+ {file = "identify-2.6.17.tar.gz", hash = "sha256:f816b0b596b204c9fdf076ded172322f2723cf958d02f9c3587504834c8ff04d"},
]
[[package]]
@@ -1941,7 +1963,7 @@ name = "idna"
version = "3.11"
requires_python = ">=3.8"
summary = "Internationalized Domain Names in Applications (IDNA)"
-groups = ["default", "dev"]
+groups = ["default", "dev", "mcp"]
files = [
{file = "idna-3.11-py3-none-any.whl", hash = "sha256:771a87f49d9defaf64091e6e6fe9c18d4833f140bd19464795bc32d966ca37ea"},
{file = "idna-3.11.tar.gz", hash = "sha256:795dafcc9c04ed0c1fb032c2aa73654d8e8c5023a7df64a53f39190ada629902"},
@@ -2126,6 +2148,37 @@ files = [
{file = "jsonpointer-3.0.0.tar.gz", hash = "sha256:2b2d729f2091522d61c3b31f82e11870f60b68f43fbc705cb76bf4b832af59ef"},
]
+[[package]]
+name = "jsonschema"
+version = "4.26.0"
+requires_python = ">=3.10"
+summary = "An implementation of JSON Schema validation for Python"
+groups = ["mcp"]
+dependencies = [
+ "attrs>=22.2.0",
+ "jsonschema-specifications>=2023.03.6",
+ "referencing>=0.28.4",
+ "rpds-py>=0.25.0",
+]
+files = [
+ {file = "jsonschema-4.26.0-py3-none-any.whl", hash = "sha256:d489f15263b8d200f8387e64b4c3a75f06629559fb73deb8fdfb525f2dab50ce"},
+ {file = "jsonschema-4.26.0.tar.gz", hash = "sha256:0c26707e2efad8aa1bfc5b7ce170f3fccc2e4918ff85989ba9ffa9facb2be326"},
+]
+
+[[package]]
+name = "jsonschema-specifications"
+version = "2025.9.1"
+requires_python = ">=3.9"
+summary = "The JSON Schema meta-schemas and vocabularies, exposed as a Registry"
+groups = ["mcp"]
+dependencies = [
+ "referencing>=0.31.0",
+]
+files = [
+ {file = "jsonschema_specifications-2025.9.1-py3-none-any.whl", hash = "sha256:98802fee3a11ee76ecaca44429fda8a41bff98b00a0f2838151b113f210cc6fe"},
+ {file = "jsonschema_specifications-2025.9.1.tar.gz", hash = "sha256:b540987f239e745613c7a9176f3edb72b832a4ac465cf02712288397832b5e8d"},
+]
+
[[package]]
name = "justext"
version = "3.0.2"
@@ -2268,18 +2321,18 @@ files = [
[[package]]
name = "langchain-anthropic"
-version = "1.3.3"
+version = "1.3.4"
requires_python = "<4.0.0,>=3.10.0"
summary = "Integration package connecting Claude (Anthropic) APIs and LangChain"
groups = ["default"]
dependencies = [
"anthropic<1.0.0,>=0.78.0",
- "langchain-core<2.0.0,>=1.2.11",
+ "langchain-core<2.0.0,>=1.2.15",
"pydantic<3.0.0,>=2.7.4",
]
files = [
- {file = "langchain_anthropic-1.3.3-py3-none-any.whl", hash = "sha256:8008ce5fb680268681673e09f93a9ac08eba9e304477101e5e138f06b5cd8710"},
- {file = "langchain_anthropic-1.3.3.tar.gz", hash = "sha256:37198413c9bde5a9e9829f13c7b9ed4870d7085e7fba9fd803ef4d98ef8ea220"},
+ {file = "langchain_anthropic-1.3.4-py3-none-any.whl", hash = "sha256:cd112dcc8049aef09f58b3c4338b2c9db5ee98105e08664954a4e40d8bf120b9"},
+ {file = "langchain_anthropic-1.3.4.tar.gz", hash = "sha256:000ed4c2d6fb8842b4ffeed22a74a3e84f9e9bcb63638e4abbb4a1d8ffa07211"},
]
[[package]]
@@ -2331,7 +2384,7 @@ files = [
[[package]]
name = "langchain-core"
-version = "1.2.14"
+version = "1.2.17"
requires_python = "<4.0.0,>=3.10.0"
summary = "Building applications with LLMs through composability"
groups = ["default"]
@@ -2346,8 +2399,8 @@ dependencies = [
"uuid-utils<1.0,>=0.12.0",
]
files = [
- {file = "langchain_core-1.2.14-py3-none-any.whl", hash = "sha256:b349ca28c057ac1f9b5280ea091bddb057db24d0f1c3c89bbb590713e1715838"},
- {file = "langchain_core-1.2.14.tar.gz", hash = "sha256:09549d838a2672781da3a9502f3b9c300863284b77b27e2a6dac4e6e650acfed"},
+ {file = "langchain_core-1.2.17-py3-none-any.whl", hash = "sha256:bf6bd6ce503874e9c2da1669a69383e967c3de1ea808921d19a9a6bff1a9fbbe"},
+ {file = "langchain_core-1.2.17.tar.gz", hash = "sha256:54aa267f3311e347fb2e50951fe08e53761cebfb999ab80e6748d70525bbe872"},
]
[[package]]
@@ -2424,7 +2477,7 @@ files = [
[[package]]
name = "langgraph"
-version = "1.0.9"
+version = "1.0.10"
requires_python = ">=3.10"
summary = "Building stateful, multi-actor applications with LLMs"
groups = ["default"]
@@ -2437,13 +2490,13 @@ dependencies = [
"xxhash>=3.5.0",
]
files = [
- {file = "langgraph-1.0.9-py3-none-any.whl", hash = "sha256:bce0d1f3e9a20434215a2a818395a58aedfc11c87bd6b52706c0db5c05ec44ec"},
- {file = "langgraph-1.0.9.tar.gz", hash = "sha256:feac2729faba7d3c325bef76f240d7d7f66b02d2cbf4fdb1ed7d0cc83f963651"},
+ {file = "langgraph-1.0.10-py3-none-any.whl", hash = "sha256:7c298bef4f6ea292fcf9824d6088fe41a6727e2904ad6066f240c4095af12247"},
+ {file = "langgraph-1.0.10.tar.gz", hash = "sha256:73bd10ee14a8020f31ef07e9cd4c1a70c35cc07b9c2b9cd637509a10d9d51e29"},
]
[[package]]
name = "langgraph-checkpoint"
-version = "4.0.0"
+version = "4.0.1"
requires_python = ">=3.10"
summary = "Library with base interfaces for LangGraph checkpoint savers."
groups = ["default"]
@@ -2452,8 +2505,8 @@ dependencies = [
"ormsgpack>=1.12.0",
]
files = [
- {file = "langgraph_checkpoint-4.0.0-py3-none-any.whl", hash = "sha256:3fa9b2635a7c5ac28b338f631abf6a030c3b508b7b9ce17c22611513b589c784"},
- {file = "langgraph_checkpoint-4.0.0.tar.gz", hash = "sha256:814d1bd050fac029476558d8e68d87bce9009a0262d04a2c14b918255954a624"},
+ {file = "langgraph_checkpoint-4.0.1-py3-none-any.whl", hash = "sha256:e3adcd7a0e0166f3b48b8cf508ce0ea366e7420b5a73aa81289888727769b034"},
+ {file = "langgraph_checkpoint-4.0.1.tar.gz", hash = "sha256:b433123735df11ade28829e40ce25b9be614930cd50245ff2af60629234befd9"},
]
[[package]]
@@ -2473,7 +2526,7 @@ files = [
[[package]]
name = "langgraph-sdk"
-version = "0.3.8"
+version = "0.3.9"
requires_python = ">=3.10"
summary = "SDK for interacting with LangGraph API"
groups = ["default"]
@@ -2482,13 +2535,13 @@ dependencies = [
"orjson>=3.11.5",
]
files = [
- {file = "langgraph_sdk-0.3.8-py3-none-any.whl", hash = "sha256:90436594e95c6fc1d1dafb59ac1c5eff2f8e1853eecc6082262b8e6de04233c1"},
- {file = "langgraph_sdk-0.3.8.tar.gz", hash = "sha256:e73e56e403254ebada5cab70165eb0b69155979e2360bca84da2cb63f364dfb9"},
+ {file = "langgraph_sdk-0.3.9-py3-none-any.whl", hash = "sha256:94654294250c920789b6ed0d8a70c0117fed5736b61efc24ff647157359453c5"},
+ {file = "langgraph_sdk-0.3.9.tar.gz", hash = "sha256:8be8958529b3f6d493ec248fdb46e539362efda75784654a42a7091d22504e0e"},
]
[[package]]
name = "langsmith"
-version = "0.7.6"
+version = "0.7.12"
requires_python = ">=3.10"
summary = "Client library to connect to the LangSmith Observability and Evaluation Platform."
groups = ["default"]
@@ -2504,8 +2557,8 @@ dependencies = [
"zstandard>=0.23.0",
]
files = [
- {file = "langsmith-0.7.6-py3-none-any.whl", hash = "sha256:28d256584969db723b68189a7dbb065836572728ab4d9597ec5379fe0a1e1641"},
- {file = "langsmith-0.7.6.tar.gz", hash = "sha256:e8646f8429d3c1641c7bae3c01bfdc3dfa27625994b0ef4303714d6b06fe1ef9"},
+ {file = "langsmith-0.7.12-py3-none-any.whl", hash = "sha256:ff0a3310cd0bc546752017b38715d6607d1e4f82277d3e612e7cfd249710d419"},
+ {file = "langsmith-0.7.12.tar.gz", hash = "sha256:4ad729ea1908b0b5cf1305e1cc54693320f3420a9af66ebaadff76ec6e7e103d"},
]
[[package]]
@@ -2909,7 +2962,7 @@ name = "markdown-it-py"
version = "4.0.0"
requires_python = ">=3.10"
summary = "Python port of markdown-it. Markdown parsing, done right!"
-groups = ["default", "dev"]
+groups = ["default", "dev", "mcp"]
dependencies = [
"mdurl~=0.1",
]
@@ -3074,12 +3127,56 @@ files = [
{file = "matplotlib-3.10.8.tar.gz", hash = "sha256:2299372c19d56bcd35cf05a2738308758d32b9eaed2371898d8f5bd33f084aa3"},
]
+[[package]]
+name = "mcp"
+version = "1.26.0"
+requires_python = ">=3.10"
+summary = "Model Context Protocol SDK"
+groups = ["mcp"]
+dependencies = [
+ "anyio>=4.5",
+ "httpx-sse>=0.4",
+ "httpx>=0.27.1",
+ "jsonschema>=4.20.0",
+ "pydantic-settings>=2.5.2",
+ "pydantic<3.0.0,>=2.11.0",
+ "pyjwt[crypto]>=2.10.1",
+ "python-multipart>=0.0.9",
+ "pywin32>=310; sys_platform == \"win32\"",
+ "sse-starlette>=1.6.1",
+ "starlette>=0.27",
+ "typing-extensions>=4.9.0",
+ "typing-inspection>=0.4.1",
+ "uvicorn>=0.31.1; sys_platform != \"emscripten\"",
+]
+files = [
+ {file = "mcp-1.26.0-py3-none-any.whl", hash = "sha256:904a21c33c25aa98ddbeb47273033c435e595bbacfdb177f4bd87f6dceebe1ca"},
+ {file = "mcp-1.26.0.tar.gz", hash = "sha256:db6e2ef491eecc1a0d93711a76f28dec2e05999f93afd48795da1c1137142c66"},
+]
+
+[[package]]
+name = "mcp"
+version = "1.26.0"
+extras = ["cli"]
+requires_python = ">=3.10"
+summary = "Model Context Protocol SDK"
+groups = ["mcp"]
+dependencies = [
+ "mcp==1.26.0",
+ "python-dotenv>=1.0.0",
+ "typer>=0.16.0",
+]
+files = [
+ {file = "mcp-1.26.0-py3-none-any.whl", hash = "sha256:904a21c33c25aa98ddbeb47273033c435e595bbacfdb177f4bd87f6dceebe1ca"},
+ {file = "mcp-1.26.0.tar.gz", hash = "sha256:db6e2ef491eecc1a0d93711a76f28dec2e05999f93afd48795da1c1137142c66"},
+]
+
[[package]]
name = "mdurl"
version = "0.1.2"
requires_python = ">=3.7"
summary = "Markdown URL utilities"
-groups = ["default", "dev"]
+groups = ["default", "dev", "mcp"]
files = [
{file = "mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"},
{file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"},
@@ -3304,13 +3401,13 @@ files = [
[[package]]
name = "narwhals"
-version = "2.16.0"
+version = "2.17.0"
requires_python = ">=3.9"
summary = "Extremely lightweight compatibility layer between dataframe libraries"
groups = ["default"]
files = [
- {file = "narwhals-2.16.0-py3-none-any.whl", hash = "sha256:846f1fd7093ac69d63526e50732033e86c30ea0026a44d9b23991010c7d1485d"},
- {file = "narwhals-2.16.0.tar.gz", hash = "sha256:155bb45132b370941ba0396d123cf9ed192bf25f39c4cea726f2da422ca4e145"},
+ {file = "narwhals-2.17.0-py3-none-any.whl", hash = "sha256:2ac5307b7c2b275a7d66eeda906b8605e3d7a760951e188dcfff86e8ebe083dd"},
+ {file = "narwhals-2.17.0.tar.gz", hash = "sha256:ebd5bc95bcfa2f8e89a8ac09e2765a63055162837208e67b42d6eeb6651d5e67"},
]
[[package]]
@@ -3538,7 +3635,7 @@ files = [
[[package]]
name = "openai"
-version = "2.21.0"
+version = "2.24.0"
requires_python = ">=3.9"
summary = "The official Python library for the openai API"
groups = ["default"]
@@ -3553,8 +3650,8 @@ dependencies = [
"typing-extensions<5,>=4.11",
]
files = [
- {file = "openai-2.21.0-py3-none-any.whl", hash = "sha256:0bc1c775e5b1536c294eded39ee08f8407656537ccc71b1004104fe1602e267c"},
- {file = "openai-2.21.0.tar.gz", hash = "sha256:81b48ce4b8bbb2cc3af02047ceb19561f7b1dc0d4e52d1de7f02abfd15aa59b7"},
+ {file = "openai-2.24.0-py3-none-any.whl", hash = "sha256:fed30480d7d6c884303287bde864980a4b137b60553ffbcf9ab4a233b7a73d94"},
+ {file = "openai-2.24.0.tar.gz", hash = "sha256:1e5769f540dbd01cb33bc4716a23e67b9d695161a734aff9c5f925e2bf99a673"},
]
[[package]]
@@ -3948,7 +4045,7 @@ files = [
[[package]]
name = "plotly"
-version = "6.5.2"
+version = "6.6.0"
requires_python = ">=3.8"
summary = "An open-source interactive data visualization library for Python"
groups = ["default"]
@@ -3957,8 +4054,8 @@ dependencies = [
"packaging",
]
files = [
- {file = "plotly-6.5.2-py3-none-any.whl", hash = "sha256:91757653bd9c550eeea2fa2404dba6b85d1e366d54804c340b2c874e5a7eb4a4"},
- {file = "plotly-6.5.2.tar.gz", hash = "sha256:7478555be0198562d1435dee4c308268187553cc15516a2f4dd034453699e393"},
+ {file = "plotly-6.6.0-py3-none-any.whl", hash = "sha256:8d6daf0f87412e0c0bfe72e809d615217ab57cc715899a1e5145135a7800d1d0"},
+ {file = "plotly-6.6.0.tar.gz", hash = "sha256:b897f15f3b02028d69f755f236be890ba950d0a42d7dfc619b44e2d8cea8748c"},
]
[[package]]
@@ -3992,42 +4089,42 @@ files = [
[[package]]
name = "primp"
-version = "1.0.0"
+version = "1.1.2"
requires_python = ">=3.10"
-summary = "HTTP client that can impersonate web browsers, mimicking their headers and `TLS/JA3/JA4/HTTP2` fingerprints"
-groups = ["default"]
-files = [
- {file = "primp-1.0.0-cp310-abi3-macosx_10_12_x86_64.whl", hash = "sha256:6af2343ac655d409ec70c3eeb7c2283de509b663aeb6b3e34e39e1331c82daf6"},
- {file = "primp-1.0.0-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:25f21400ff236b0e1db5d4db7db66965f63b64898103384e916ecef575ab3395"},
- {file = "primp-1.0.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:abd09660db079903031be91e04af2dcf42457bd739e6f328c7b2364e38061876"},
- {file = "primp-1.0.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:6e756480c9dd585b20927c2a0c1d0c42cbcb5866ed1e741a8f93163e6f905e6c"},
- {file = "primp-1.0.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b75a10ead2872dee9be9c60c07e8fce5328c88ed251e3fdbd29a7d2d73ab512a"},
- {file = "primp-1.0.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2ea1a0b1d4c2a65efd5f22bc42bc0133ebf359f70dd155847cbebf8015fb05a1"},
- {file = "primp-1.0.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1abd58a2bf0a2f062edc51a3684f8b9d0170348a96afdd3915f02f498c661228"},
- {file = "primp-1.0.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:52506249b8132eb386e90349f9fbbcf6b39e36523d61f92a0e8c557e32f71ef2"},
- {file = "primp-1.0.0-cp310-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:b7f24c3a67aab0517ba4f6e743dfced331198062ff8e31df692381e60a17b775"},
- {file = "primp-1.0.0-cp310-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:0cf76f39d5820a2607a2dd25c074ceb8efa741bc311552218156c53b1002ec25"},
- {file = "primp-1.0.0-cp310-abi3-musllinux_1_2_i686.whl", hash = "sha256:3414a4bbe37e909a45c0fea04104bd23165d81b94f3d68bfe9a11ba18c462b39"},
- {file = "primp-1.0.0-cp310-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:3487e5269dc6d840035d59a8e5afbba99b5736da848664b71356681a837c3a8b"},
- {file = "primp-1.0.0-cp310-abi3-win32.whl", hash = "sha256:0c44e8dccfcd2dd3fb3467d44836445039a013704ea869340bf67a444cbf3f36"},
- {file = "primp-1.0.0-cp310-abi3-win_amd64.whl", hash = "sha256:705fb755f5461b551925de7546f3fea5b657fc44fee136498bed492bf5051864"},
- {file = "primp-1.0.0-cp310-abi3-win_arm64.whl", hash = "sha256:4e080ad054df4c325c434acf613d9cae54278e8141fa116452ec18bf576672a8"},
- {file = "primp-1.0.0-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:6853b719f511ed09dc3673e54cd489b4ed35b0f769428dc79b3c54c446aafd22"},
- {file = "primp-1.0.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:3d072d1e3c84068b5727426500210e33241ef97844fe781d9817094fdfc6b128"},
- {file = "primp-1.0.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7ef28f8d6b89c5daf651dc7c7560b4914647bfe73b9a3847e2ae5ed0ff7d8bcf"},
- {file = "primp-1.0.0-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:04a0d9d88cdce7ab685b4657cfe07d603a85118ec48a09015fa66eadad156c44"},
- {file = "primp-1.0.0-cp314-cp314t-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d0ad2255403b155d93cf5cb7f6e807e26dc10c49071e0bac888c2c0e14801b82"},
- {file = "primp-1.0.0-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c3e7ccbe4746163f14b984523ac49ce3eed923fbe672c4c08480fa13217c2357"},
- {file = "primp-1.0.0-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:63a1d34732c2e6282e5e30f5d425eaa28ca417d74accda92908fdb8c944ff319"},
- {file = "primp-1.0.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d90e61f173e661ed8e21d8cd6534c586ad1d25565a0bac539a6a2d5e990439e0"},
- {file = "primp-1.0.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:fcb28e07bc250b8c4762312e952bd84b6b983554fba6cd067f83018bd39a0488"},
- {file = "primp-1.0.0-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:8e5b8fa46130d3db33192784d4935fc3f9574f030d0e78d281e90c37cf2507ee"},
- {file = "primp-1.0.0-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:984ab730449fd2e5f794fd6fad37fed3596432a24435ce2d0363b454503b7846"},
- {file = "primp-1.0.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:2abd6d47ca60028bcc33dc47dd33f355237be80d7889518e44cc4d730c9e45e0"},
- {file = "primp-1.0.0-cp314-cp314t-win32.whl", hash = "sha256:39c27d84fd597a43bb291b6928fbaa46d4a7aff0c31ae1a361dccbbd109118a1"},
- {file = "primp-1.0.0-cp314-cp314t-win_amd64.whl", hash = "sha256:bc8bac0288fb7ed541c8db4be46c5f2779e4c1b023bf01e46fe4c1405150dbeb"},
- {file = "primp-1.0.0-cp314-cp314t-win_arm64.whl", hash = "sha256:117d3eb9c556fe88c8ed0533be80c2495922671e977e3e0e78a6b841014380eb"},
- {file = "primp-1.0.0.tar.gz", hash = "sha256:09fc1ff6009220247d723792794e514782e1ab7e9ba5e2547272a07afed5ca86"},
+summary = "HTTP client that can impersonate web browsers"
+groups = ["default"]
+files = [
+ {file = "primp-1.1.2-cp310-abi3-macosx_10_12_x86_64.whl", hash = "sha256:181bb9a6d5544e0483592f693f33f5874a60726ea0da1f41685aa2267f084a4d"},
+ {file = "primp-1.1.2-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:f362424ffa83e1de55a7573300a416fa71dc5516829526a9bf77dc0cfa42256b"},
+ {file = "primp-1.1.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:736820326eb1ed19c6b0e971f852316c049c36bdd251a03757056a74182796df"},
+ {file = "primp-1.1.2-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ed37d1bc89fa8cad8b60481c81ea7b3bd42dc757868009ad3bb0b1e74c17fd22"},
+ {file = "primp-1.1.2-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:78e78355b1c495bc7e3d92121067760c7e7a1d419519542ed9dd88688ce43aab"},
+ {file = "primp-1.1.2-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4c4c560d018dad4e3a3f17b07f9f5d894941e3acbbb5b566f6b6baf42786012f"},
+ {file = "primp-1.1.2-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2494b52cf3056d3e41c0746a11cbeca7f2f882a92a09d87383646cd75e2f3d8c"},
+ {file = "primp-1.1.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c424a46f48ccd8fd309215a15bc098b47198b8f779c43ed8d95b3f53a382ffa8"},
+ {file = "primp-1.1.2-cp310-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:ba51cf19f17fd4bab4567d96b4cd7dcb6a4e0f0d4721819180b46af9794ae310"},
+ {file = "primp-1.1.2-cp310-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:77ebae43c6735328051beb08e7e2360b6cf79d50f6cef77629beba880c99222d"},
+ {file = "primp-1.1.2-cp310-abi3-musllinux_1_2_i686.whl", hash = "sha256:5f3252d47e9d0f4a567990c79cd388be43353fc7c78efea2a6a5734e8a425598"},
+ {file = "primp-1.1.2-cp310-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:9e094417825df9748e179a1104b2df4459c3dbd1eea994f05a136860b847f0e1"},
+ {file = "primp-1.1.2-cp310-abi3-win32.whl", hash = "sha256:bc67112b61a8dc1d40ddcc81ff5c47a1cb7b620954fee01a529e28bebb359e20"},
+ {file = "primp-1.1.2-cp310-abi3-win_amd64.whl", hash = "sha256:4509850301c669c04e124762e953946ed10fe9039f059ec40b818c085697d9a4"},
+ {file = "primp-1.1.2-cp310-abi3-win_arm64.whl", hash = "sha256:de5958dc7ce78ce107dd776056a58f9da7a7164a912e908cb9b66b84f87967f6"},
+ {file = "primp-1.1.2-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:c3bbece26e8312e3e0df2ec222b954f9ac9f279422ffbbf47a6cad31ef8736cd"},
+ {file = "primp-1.1.2-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:78acdf43b57d984170e986be5fcae0a1537a245fafda970e92056dae42cd9545"},
+ {file = "primp-1.1.2-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:89a2641441732f81e1876db2e18490d3210a8302290e4844b7f04159e02033d4"},
+ {file = "primp-1.1.2-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a1df66deacb539efbca5730d0fc3dea19cd83c33422fa05445bbddc17aef3f71"},
+ {file = "primp-1.1.2-cp314-cp314t-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:78ea1f56dd3ac52f2d5375a084c7f31ce6ad274811bdb5d17ecaca6b4ddb8b6d"},
+ {file = "primp-1.1.2-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3c980527bd46c034ab9e06dca75b6237cea8d5b3fe1f5691904a2c35d92d143c"},
+ {file = "primp-1.1.2-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0c0b4006a9a25c5f89a968f3bf67221fc19183890b8a1304873132d703697816"},
+ {file = "primp-1.1.2-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e2851bedc1598ed72f6a2016e391012744259c523dc5d27f2f02e3ae5ef020d4"},
+ {file = "primp-1.1.2-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:f7340e34023dda2660bd02cb92ac8ed441f13a1afdc00487581d8b8b473f890b"},
+ {file = "primp-1.1.2-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:618a027bb45ac44e9b6c35d5758547ce5e73607de4fb54b52bb9d0dc896f11fa"},
+ {file = "primp-1.1.2-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:37e30ce1435142dd010f2ee1dd909f1e6e3a8cd3e32c8e22f3bb6703bf618209"},
+ {file = "primp-1.1.2-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:9b5d335d28eae65543b20c75911d71c5f89882a4598efade47abe92389f6da7f"},
+ {file = "primp-1.1.2-cp314-cp314t-win32.whl", hash = "sha256:b938cc2d033ac56be90c617836a60fb468f33ab630d3eacab2b36651b7ce106e"},
+ {file = "primp-1.1.2-cp314-cp314t-win_amd64.whl", hash = "sha256:6378d55bbe8b722e7b39b6c0df1e46a1b767d2e4e8a7c1e60d9f8ec238bf48c4"},
+ {file = "primp-1.1.2-cp314-cp314t-win_arm64.whl", hash = "sha256:2431104658b86e7cf9bedbadabe6d2c4705c1c10b54f17ad0094cc927577adea"},
+ {file = "primp-1.1.2.tar.gz", hash = "sha256:c4707ab374a77c0cbead3d9a65605919fa4997fa910ef06e37b65df42a1d4d04"},
]
[[package]]
@@ -4218,7 +4315,7 @@ name = "pycparser"
version = "3.0"
requires_python = ">=3.10"
summary = "C parser in Python"
-groups = ["default"]
+groups = ["default", "mcp"]
marker = "implementation_name != \"PyPy\""
files = [
{file = "pycparser-3.0-py3-none-any.whl", hash = "sha256:b727414169a36b7d524c1c3e31839a521725078d7b2ff038656844266160a992"},
@@ -4230,7 +4327,7 @@ name = "pydantic"
version = "2.12.5"
requires_python = ">=3.9"
summary = "Data validation using Python type hints"
-groups = ["default"]
+groups = ["default", "mcp"]
dependencies = [
"annotated-types>=0.6.0",
"pydantic-core==2.41.5",
@@ -4247,7 +4344,7 @@ name = "pydantic-core"
version = "2.41.5"
requires_python = ">=3.9"
summary = "Core functionality for Pydantic validation and serialization"
-groups = ["default"]
+groups = ["default", "mcp"]
dependencies = [
"typing-extensions>=4.14.1",
]
@@ -4338,7 +4435,7 @@ name = "pydantic-settings"
version = "2.13.1"
requires_python = ">=3.10"
summary = "Settings management using Pydantic"
-groups = ["default"]
+groups = ["default", "mcp"]
dependencies = [
"pydantic>=2.7.0",
"python-dotenv>=0.21.0",
@@ -4379,12 +4476,39 @@ name = "pygments"
version = "2.19.2"
requires_python = ">=3.8"
summary = "Pygments is a syntax highlighting package written in Python."
-groups = ["default", "dev"]
+groups = ["default", "dev", "mcp"]
files = [
{file = "pygments-2.19.2-py3-none-any.whl", hash = "sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b"},
{file = "pygments-2.19.2.tar.gz", hash = "sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887"},
]
+[[package]]
+name = "pyjwt"
+version = "2.11.0"
+requires_python = ">=3.9"
+summary = "JSON Web Token implementation in Python"
+groups = ["mcp"]
+files = [
+ {file = "pyjwt-2.11.0-py3-none-any.whl", hash = "sha256:94a6bde30eb5c8e04fee991062b534071fd1439ef58d2adc9ccb823e7bcd0469"},
+ {file = "pyjwt-2.11.0.tar.gz", hash = "sha256:35f95c1f0fbe5d5ba6e43f00271c275f7a1a4db1dab27bf708073b75318ea623"},
+]
+
+[[package]]
+name = "pyjwt"
+version = "2.11.0"
+extras = ["crypto"]
+requires_python = ">=3.9"
+summary = "JSON Web Token implementation in Python"
+groups = ["mcp"]
+dependencies = [
+ "cryptography>=3.4.0",
+ "pyjwt==2.11.0",
+]
+files = [
+ {file = "pyjwt-2.11.0-py3-none-any.whl", hash = "sha256:94a6bde30eb5c8e04fee991062b534071fd1439ef58d2adc9ccb823e7bcd0469"},
+ {file = "pyjwt-2.11.0.tar.gz", hash = "sha256:35f95c1f0fbe5d5ba6e43f00271c275f7a1a4db1dab27bf708073b75318ea623"},
+]
+
[[package]]
name = "pypandoc-binary"
version = "1.16.2"
@@ -4579,13 +4703,13 @@ files = [
[[package]]
name = "python-dotenv"
-version = "1.2.1"
-requires_python = ">=3.9"
+version = "1.2.2"
+requires_python = ">=3.10"
summary = "Read key-value pairs from a .env file and set them as environment variables"
-groups = ["default"]
+groups = ["default", "mcp"]
files = [
- {file = "python_dotenv-1.2.1-py3-none-any.whl", hash = "sha256:b81ee9561e9ca4004139c6cbba3a238c32b03e4894671e181b671e8cb8425d61"},
- {file = "python_dotenv-1.2.1.tar.gz", hash = "sha256:42667e897e16ab0d66954af0e60a9caa94f0fd4ecf3aaf6d2d260eec1aa36ad6"},
+ {file = "python_dotenv-1.2.2-py3-none-any.whl", hash = "sha256:1d8214789a24de455a8b8bd8ae6fe3c6b69a5e3d64aa8a8e5d68e694bbcb285a"},
+ {file = "python_dotenv-1.2.2.tar.gz", hash = "sha256:2c371a91fbd7ba082c2c1dc1f8bf89ca22564a087c2c287cd9b662adde799cf3"},
]
[[package]]
@@ -4624,6 +4748,17 @@ files = [
{file = "python_magic-0.4.27-py2.py3-none-any.whl", hash = "sha256:c212960ad306f700aa0d01e5d7a325d20548ff97eb9920dcd29513174f0294d3"},
]
+[[package]]
+name = "python-multipart"
+version = "0.0.22"
+requires_python = ">=3.10"
+summary = "A streaming multipart parser for Python"
+groups = ["mcp"]
+files = [
+ {file = "python_multipart-0.0.22-py3-none-any.whl", hash = "sha256:2b2cd894c83d21bf49d702499531c7bafd057d730c201782048f7945d82de155"},
+ {file = "python_multipart-0.0.22.tar.gz", hash = "sha256:7340bef99a7e0032613f56dc36027b959fd3b30a787ed62d310e951f7c3a3a58"},
+]
+
[[package]]
name = "python-oxmsg"
version = "0.0.2"
@@ -4669,6 +4804,27 @@ files = [
{file = "python_socketio-5.16.1.tar.gz", hash = "sha256:f863f98eacce81ceea2e742f6388e10ca3cdd0764be21d30d5196470edf5ea89"},
]
+[[package]]
+name = "pywin32"
+version = "311"
+summary = "Python for Window Extensions"
+groups = ["mcp"]
+marker = "sys_platform == \"win32\""
+files = [
+ {file = "pywin32-311-cp311-cp311-win32.whl", hash = "sha256:184eb5e436dea364dcd3d2316d577d625c0351bf237c4e9a5fabbcfa5a58b151"},
+ {file = "pywin32-311-cp311-cp311-win_amd64.whl", hash = "sha256:3ce80b34b22b17ccbd937a6e78e7225d80c52f5ab9940fe0506a1a16f3dab503"},
+ {file = "pywin32-311-cp311-cp311-win_arm64.whl", hash = "sha256:a733f1388e1a842abb67ffa8e7aad0e70ac519e09b0f6a784e65a136ec7cefd2"},
+ {file = "pywin32-311-cp312-cp312-win32.whl", hash = "sha256:750ec6e621af2b948540032557b10a2d43b0cee2ae9758c54154d711cc852d31"},
+ {file = "pywin32-311-cp312-cp312-win_amd64.whl", hash = "sha256:b8c095edad5c211ff31c05223658e71bf7116daa0ecf3ad85f3201ea3190d067"},
+ {file = "pywin32-311-cp312-cp312-win_arm64.whl", hash = "sha256:e286f46a9a39c4a18b319c28f59b61de793654af2f395c102b4f819e584b5852"},
+ {file = "pywin32-311-cp313-cp313-win32.whl", hash = "sha256:f95ba5a847cba10dd8c4d8fefa9f2a6cf283b8b88ed6178fa8a6c1ab16054d0d"},
+ {file = "pywin32-311-cp313-cp313-win_amd64.whl", hash = "sha256:718a38f7e5b058e76aee1c56ddd06908116d35147e133427e59a3983f703a20d"},
+ {file = "pywin32-311-cp313-cp313-win_arm64.whl", hash = "sha256:7b4075d959648406202d92a2310cb990fea19b535c7f4a78d3f5e10b926eeb8a"},
+ {file = "pywin32-311-cp314-cp314-win32.whl", hash = "sha256:b7a2c10b93f8986666d0c803ee19b5990885872a7de910fc460f9b0c2fbf92ee"},
+ {file = "pywin32-311-cp314-cp314-win_amd64.whl", hash = "sha256:3aca44c046bd2ed8c90de9cb8427f581c479e594e99b5c0bb19b29c10fd6cb87"},
+ {file = "pywin32-311-cp314-cp314-win_arm64.whl", hash = "sha256:a508e2d9025764a8270f93111a970e1d0fbfc33f4153b388bb649b7eec4f9b42"},
+]
+
[[package]]
name = "pyyaml"
version = "6.0.3"
@@ -4807,110 +4963,126 @@ files = [
{file = "rapidfuzz-3.14.3.tar.gz", hash = "sha256:2491937177868bc4b1e469087601d53f925e8d270ccc21e07404b4b5814b7b5f"},
]
+[[package]]
+name = "referencing"
+version = "0.37.0"
+requires_python = ">=3.10"
+summary = "JSON Referencing + Python"
+groups = ["mcp"]
+dependencies = [
+ "attrs>=22.2.0",
+ "rpds-py>=0.7.0",
+ "typing-extensions>=4.4.0; python_version < \"3.13\"",
+]
+files = [
+ {file = "referencing-0.37.0-py3-none-any.whl", hash = "sha256:381329a9f99628c9069361716891d34ad94af76e461dcb0335825aecc7692231"},
+ {file = "referencing-0.37.0.tar.gz", hash = "sha256:44aefc3142c5b842538163acb373e24cce6632bd54bdb01b21ad5863489f50d8"},
+]
+
[[package]]
name = "regex"
-version = "2026.2.19"
+version = "2026.2.28"
requires_python = ">=3.10"
summary = "Alternative regular expression module, to replace re."
groups = ["default"]
files = [
- {file = "regex-2026.2.19-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:93b16a18cadb938f0f2306267161d57eb33081a861cee9ffcd71e60941eb5dfc"},
- {file = "regex-2026.2.19-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:78af1e499cab704131f6f4e2f155b7f54ce396ca2acb6ef21a49507e4752e0be"},
- {file = "regex-2026.2.19-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:eb20c11aa4c3793c9ad04c19a972078cdadb261b8429380364be28e867a843f2"},
- {file = "regex-2026.2.19-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:db5fd91eec71e7b08de10011a2223d0faa20448d4e1380b9daa179fa7bf58906"},
- {file = "regex-2026.2.19-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:fdbade8acba71bb45057c2b72f477f0b527c4895f9c83e6cfc30d4a006c21726"},
- {file = "regex-2026.2.19-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:31a5f561eb111d6aae14202e7043fb0b406d3c8dddbbb9e60851725c9b38ab1d"},
- {file = "regex-2026.2.19-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4584a3ee5f257b71e4b693cc9be3a5104249399f4116fe518c3f79b0c6fc7083"},
- {file = "regex-2026.2.19-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:196553ba2a2f47904e5dc272d948a746352e2644005627467e055be19d73b39e"},
- {file = "regex-2026.2.19-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:0c10869d18abb759a3317c757746cc913d6324ce128b8bcec99350df10419f18"},
- {file = "regex-2026.2.19-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:e689fed279cbe797a6b570bd18ff535b284d057202692c73420cb93cca41aa32"},
- {file = "regex-2026.2.19-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:0782bd983f19ac7594039c9277cd6f75c89598c1d72f417e4d30d874105eb0c7"},
- {file = "regex-2026.2.19-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:dbb240c81cfed5d4a67cb86d7676d9f7ec9c3f186310bec37d8a1415210e111e"},
- {file = "regex-2026.2.19-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:80d31c3f1fe7e4c6cd1831cd4478a0609903044dfcdc4660abfe6fb307add7f0"},
- {file = "regex-2026.2.19-cp311-cp311-win32.whl", hash = "sha256:66e6a43225ff1064f8926adbafe0922b370d381c3330edaf9891cade52daa790"},
- {file = "regex-2026.2.19-cp311-cp311-win_amd64.whl", hash = "sha256:59a7a5216485a1896c5800e9feb8ff9213e11967b482633b6195d7da11450013"},
- {file = "regex-2026.2.19-cp311-cp311-win_arm64.whl", hash = "sha256:ec661807ffc14c8d14bb0b8c1bb3d5906e476bc96f98b565b709d03962ee4dd4"},
- {file = "regex-2026.2.19-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:c1665138776e4ac1aa75146669236f7a8a696433ec4e525abf092ca9189247cc"},
- {file = "regex-2026.2.19-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:d792b84709021945597e05656aac059526df4e0c9ef60a0eaebb306f8fafcaa8"},
- {file = "regex-2026.2.19-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:db970bcce4d63b37b3f9eb8c893f0db980bbf1d404a1d8d2b17aa8189de92c53"},
- {file = "regex-2026.2.19-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:03d706fbe7dfec503c8c3cb76f9352b3e3b53b623672aa49f18a251a6c71b8e6"},
- {file = "regex-2026.2.19-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:8dbff048c042beef60aa1848961384572c5afb9e8b290b0f1203a5c42cf5af65"},
- {file = "regex-2026.2.19-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:ccaaf9b907ea6b4223d5cbf5fa5dff5f33dc66f4907a25b967b8a81339a6e332"},
- {file = "regex-2026.2.19-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:75472631eee7898e16a8a20998d15106cb31cfde21cdf96ab40b432a7082af06"},
- {file = "regex-2026.2.19-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:d89f85a5ccc0cec125c24be75610d433d65295827ebaf0d884cbe56df82d4774"},
- {file = "regex-2026.2.19-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:0d9f81806abdca3234c3dd582b8a97492e93de3602c8772013cb4affa12d1668"},
- {file = "regex-2026.2.19-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:9dadc10d1c2bbb1326e572a226d2ec56474ab8aab26fdb8cf19419b372c349a9"},
- {file = "regex-2026.2.19-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:6bc25d7e15f80c9dc7853cbb490b91c1ec7310808b09d56bd278fe03d776f4f6"},
- {file = "regex-2026.2.19-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:965d59792f5037d9138da6fed50ba943162160443b43d4895b182551805aff9c"},
- {file = "regex-2026.2.19-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:38d88c6ed4a09ed61403dbdf515d969ccba34669af3961ceb7311ecd0cef504a"},
- {file = "regex-2026.2.19-cp312-cp312-win32.whl", hash = "sha256:5df947cabab4b643d4791af5e28aecf6bf62e6160e525651a12eba3d03755e6b"},
- {file = "regex-2026.2.19-cp312-cp312-win_amd64.whl", hash = "sha256:4146dc576ea99634ae9c15587d0c43273b4023a10702998edf0fa68ccb60237a"},
- {file = "regex-2026.2.19-cp312-cp312-win_arm64.whl", hash = "sha256:cdc0a80f679353bd68450d2a42996090c30b2e15ca90ded6156c31f1a3b63f3b"},
- {file = "regex-2026.2.19-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:8df08decd339e8b3f6a2eb5c05c687fe9d963ae91f352bc57beb05f5b2ac6879"},
- {file = "regex-2026.2.19-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:3aa0944f1dc6e92f91f3b306ba7f851e1009398c84bfd370633182ee4fc26a64"},
- {file = "regex-2026.2.19-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:c13228fbecb03eadbfd8f521732c5fda09ef761af02e920a3148e18ad0e09968"},
- {file = "regex-2026.2.19-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0d0e72703c60d68b18b27cde7cdb65ed2570ae29fb37231aa3076bfb6b1d1c13"},
- {file = "regex-2026.2.19-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:46e69a4bf552e30e74a8aa73f473c87efcb7f6e8c8ece60d9fd7bf13d5c86f02"},
- {file = "regex-2026.2.19-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:8edda06079bd770f7f0cf7f3bba1a0b447b96b4a543c91fe0c142d034c166161"},
- {file = "regex-2026.2.19-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9cbc69eae834afbf634f7c902fc72ff3e993f1c699156dd1af1adab5d06b7fe7"},
- {file = "regex-2026.2.19-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:bcf57d30659996ee5c7937999874504c11b5a068edc9515e6a59221cc2744dd1"},
- {file = "regex-2026.2.19-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:8e6e77cd92216eb489e21e5652a11b186afe9bdefca8a2db739fd6b205a9e0a4"},
- {file = "regex-2026.2.19-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:b9ab8dec42afefa6314ea9b31b188259ffdd93f433d77cad454cd0b8d235ce1c"},
- {file = "regex-2026.2.19-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:294c0fb2e87c6bcc5f577c8f609210f5700b993151913352ed6c6af42f30f95f"},
- {file = "regex-2026.2.19-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:c0924c64b082d4512b923ac016d6e1dcf647a3560b8a4c7e55cbbd13656cb4ed"},
- {file = "regex-2026.2.19-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:790dbf87b0361606cb0d79b393c3e8f4436a14ee56568a7463014565d97da02a"},
- {file = "regex-2026.2.19-cp313-cp313-win32.whl", hash = "sha256:43cdde87006271be6963896ed816733b10967baaf0e271d529c82e93da66675b"},
- {file = "regex-2026.2.19-cp313-cp313-win_amd64.whl", hash = "sha256:127ea69273485348a126ebbf3d6052604d3c7da284f797bba781f364c0947d47"},
- {file = "regex-2026.2.19-cp313-cp313-win_arm64.whl", hash = "sha256:5e56c669535ac59cbf96ca1ece0ef26cb66809990cda4fa45e1e32c3b146599e"},
- {file = "regex-2026.2.19-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:93d881cab5afdc41a005dba1524a40947d6f7a525057aa64aaf16065cf62faa9"},
- {file = "regex-2026.2.19-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:80caaa1ddcc942ec7be18427354f9d58a79cee82dea2a6b3d4fd83302e1240d7"},
- {file = "regex-2026.2.19-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:d793c5b4d2b4c668524cd1651404cfc798d40694c759aec997e196fe9729ec60"},
- {file = "regex-2026.2.19-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b5100acb20648d9efd3f4e7e91f51187f95f22a741dcd719548a6cf4e1b34b3f"},
- {file = "regex-2026.2.19-cp313-cp313t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:5e3a31e94d10e52a896adaa3adf3621bd526ad2b45b8c2d23d1bbe74c7423007"},
- {file = "regex-2026.2.19-cp313-cp313t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:8497421099b981f67c99eba4154cf0dfd8e47159431427a11cfb6487f7791d9e"},
- {file = "regex-2026.2.19-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1e7a08622f7d51d7a068f7e4052a38739c412a3e74f55817073d2e2418149619"},
- {file = "regex-2026.2.19-cp313-cp313t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:8abe671cf0f15c26b1ad389bf4043b068ce7d3b1c5d9313e12895f57d6738555"},
- {file = "regex-2026.2.19-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:5a8f28dd32a4ce9c41758d43b5b9115c1c497b4b1f50c457602c1d571fa98ce1"},
- {file = "regex-2026.2.19-cp313-cp313t-musllinux_1_2_ppc64le.whl", hash = "sha256:654dc41a5ba9b8cc8432b3f1aa8906d8b45f3e9502442a07c2f27f6c63f85db5"},
- {file = "regex-2026.2.19-cp313-cp313t-musllinux_1_2_riscv64.whl", hash = "sha256:4a02faea614e7fdd6ba8b3bec6c8e79529d356b100381cec76e638f45d12ca04"},
- {file = "regex-2026.2.19-cp313-cp313t-musllinux_1_2_s390x.whl", hash = "sha256:d96162140bb819814428800934c7b71b7bffe81fb6da2d6abc1dcca31741eca3"},
- {file = "regex-2026.2.19-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:c227f2922153ee42bbeb355fd6d009f8c81d9d7bdd666e2276ce41f53ed9a743"},
- {file = "regex-2026.2.19-cp313-cp313t-win32.whl", hash = "sha256:a178df8ec03011153fbcd2c70cb961bc98cbbd9694b28f706c318bee8927c3db"},
- {file = "regex-2026.2.19-cp313-cp313t-win_amd64.whl", hash = "sha256:2c1693ca6f444d554aa246b592355b5cec030ace5a2729eae1b04ab6e853e768"},
- {file = "regex-2026.2.19-cp313-cp313t-win_arm64.whl", hash = "sha256:c0761d7ae8d65773e01515ebb0b304df1bf37a0a79546caad9cbe79a42c12af7"},
- {file = "regex-2026.2.19-cp314-cp314-macosx_10_13_universal2.whl", hash = "sha256:03d191a9bcf94d31af56d2575210cb0d0c6a054dbcad2ea9e00aa4c42903b919"},
- {file = "regex-2026.2.19-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:516ee067c6c721d0d0bfb80a2004edbd060fffd07e456d4e1669e38fe82f922e"},
- {file = "regex-2026.2.19-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:997862c619994c4a356cb7c3592502cbd50c2ab98da5f61c5c871f10f22de7e5"},
- {file = "regex-2026.2.19-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:02b9e1b8a7ebe2807cd7bbdf662510c8e43053a23262b9f46ad4fc2dfc9d204e"},
- {file = "regex-2026.2.19-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:6c8fb3b19652e425ff24169dad3ee07f99afa7996caa9dfbb3a9106cd726f49a"},
- {file = "regex-2026.2.19-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:50f1ee9488dd7a9fda850ec7c68cad7a32fa49fd19733f5403a3f92b451dcf73"},
- {file = "regex-2026.2.19-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ab780092b1424d13200aa5a62996e95f65ee3db8509be366437439cdc0af1a9f"},
- {file = "regex-2026.2.19-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:17648e1a88e72d88641b12635e70e6c71c5136ba14edba29bf8fc6834005a265"},
- {file = "regex-2026.2.19-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:2f914ae8c804c8a8a562fe216100bc156bfb51338c1f8d55fe32cf407774359a"},
- {file = "regex-2026.2.19-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:c7e121a918bbee3f12ac300ce0a0d2f2c979cf208fb071ed8df5a6323281915c"},
- {file = "regex-2026.2.19-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:2fedd459c791da24914ecc474feecd94cf7845efb262ac3134fe27cbd7eda799"},
- {file = "regex-2026.2.19-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:ea8dfc99689240e61fb21b5fc2828f68b90abf7777d057b62d3166b7c1543c4c"},
- {file = "regex-2026.2.19-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:9fff45852160960f29e184ec8a5be5ab4063cfd0b168d439d1fc4ac3744bf29e"},
- {file = "regex-2026.2.19-cp314-cp314-win32.whl", hash = "sha256:5390b130cce14a7d1db226a3896273b7b35be10af35e69f1cca843b6e5d2bb2d"},
- {file = "regex-2026.2.19-cp314-cp314-win_amd64.whl", hash = "sha256:e581f75d5c0b15669139ca1c2d3e23a65bb90e3c06ba9d9ea194c377c726a904"},
- {file = "regex-2026.2.19-cp314-cp314-win_arm64.whl", hash = "sha256:7187fdee1be0896c1499a991e9bf7c78e4b56b7863e7405d7bb687888ac10c4b"},
- {file = "regex-2026.2.19-cp314-cp314t-macosx_10_13_universal2.whl", hash = "sha256:5ec1d7c080832fdd4e150c6f5621fe674c70c63b3ae5a4454cebd7796263b175"},
- {file = "regex-2026.2.19-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:8457c1bc10ee9b29cdfd897ccda41dce6bde0e9abd514bcfef7bcd05e254d411"},
- {file = "regex-2026.2.19-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:cce8027010d1ffa3eb89a0b19621cdc78ae548ea2b49fea1f7bfb3ea77064c2b"},
- {file = "regex-2026.2.19-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:11c138febb40546ff9e026dbbc41dc9fb8b29e61013fa5848ccfe045f5b23b83"},
- {file = "regex-2026.2.19-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:74ff212aa61532246bb3036b3dfea62233414b0154b8bc3676975da78383cac3"},
- {file = "regex-2026.2.19-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:d00c95a2b6bfeb3ea1cb68d1751b1dfce2b05adc2a72c488d77a780db06ab867"},
- {file = "regex-2026.2.19-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:311fcccb76af31be4c588d5a17f8f1a059ae8f4b097192896ebffc95612f223a"},
- {file = "regex-2026.2.19-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:77cfd6b5e7c4e8bf7a39d243ea05882acf5e3c7002b0ef4756de6606893b0ecd"},
- {file = "regex-2026.2.19-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:6380f29ff212ec922b6efb56100c089251940e0526a0d05aa7c2d9b571ddf2fe"},
- {file = "regex-2026.2.19-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:655f553a1fa3ab8a7fd570eca793408b8d26a80bfd89ed24d116baaf13a38969"},
- {file = "regex-2026.2.19-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:015088b8558502f1f0bccd58754835aa154a7a5b0bd9d4c9b7b96ff4ae9ba876"},
- {file = "regex-2026.2.19-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:9e6693b8567a59459b5dda19104c4a4dbbd4a1c78833eacc758796f2cfef1854"},
- {file = "regex-2026.2.19-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:4071209fd4376ab5ceec72ad3507e9d3517c59e38a889079b98916477a871868"},
- {file = "regex-2026.2.19-cp314-cp314t-win32.whl", hash = "sha256:2905ff4a97fad42f2d0834d8b1ea3c2f856ec209837e458d71a061a7d05f9f01"},
- {file = "regex-2026.2.19-cp314-cp314t-win_amd64.whl", hash = "sha256:64128549b600987e0f335c2365879895f860a9161f283b14207c800a6ed623d3"},
- {file = "regex-2026.2.19-cp314-cp314t-win_arm64.whl", hash = "sha256:a09ae430e94c049dc6957f6baa35ee3418a3a77f3c12b6e02883bd80a2b679b0"},
- {file = "regex-2026.2.19.tar.gz", hash = "sha256:6fb8cb09b10e38f3ae17cc6dc04a1df77762bd0351b6ba9041438e7cc85ec310"},
+ {file = "regex-2026.2.28-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:e621fb7c8dc147419b28e1702f58a0177ff8308a76fa295c71f3e7827849f5d9"},
+ {file = "regex-2026.2.28-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:0d5bef2031cbf38757a0b0bc4298bb4824b6332d28edc16b39247228fbdbad97"},
+ {file = "regex-2026.2.28-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:bcb399ed84eabf4282587ba151f2732ad8168e66f1d3f85b1d038868fe547703"},
+ {file = "regex-2026.2.28-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:7c1b34dfa72f826f535b20712afa9bb3ba580020e834f3c69866c5bddbf10098"},
+ {file = "regex-2026.2.28-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:851fa70df44325e1e4cdb79c5e676e91a78147b1b543db2aec8734d2add30ec2"},
+ {file = "regex-2026.2.28-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:516604edd17b1c2c3e579cf4e9b25a53bf8fa6e7cedddf1127804d3e0140ca64"},
+ {file = "regex-2026.2.28-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e7ce83654d1ab701cb619285a18a8e5a889c1216d746ddc710c914ca5fd71022"},
+ {file = "regex-2026.2.28-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:f2791948f7c70bb9335a9102df45e93d428f4b8128020d85920223925d73b9e1"},
+ {file = "regex-2026.2.28-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:03a83cc26aa2acda6b8b9dfe748cf9e84cbd390c424a1de34fdcef58961a297a"},
+ {file = "regex-2026.2.28-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:ec6f5674c5dc836994f50f1186dd1fafde4be0666aae201ae2fcc3d29d8adf27"},
+ {file = "regex-2026.2.28-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:50c2fc924749543e0eacc93ada6aeeb3ea5f6715825624baa0dccaec771668ae"},
+ {file = "regex-2026.2.28-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:ba55c50f408fb5c346a3a02d2ce0ebc839784e24f7c9684fde328ff063c3cdea"},
+ {file = "regex-2026.2.28-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:edb1b1b3a5576c56f08ac46f108c40333f222ebfd5cf63afdfa3aab0791ebe5b"},
+ {file = "regex-2026.2.28-cp311-cp311-win32.whl", hash = "sha256:948c12ef30ecedb128903c2c2678b339746eb7c689c5c21957c4a23950c96d15"},
+ {file = "regex-2026.2.28-cp311-cp311-win_amd64.whl", hash = "sha256:fd63453f10d29097cc3dc62d070746523973fb5aa1c66d25f8558bebd47fed61"},
+ {file = "regex-2026.2.28-cp311-cp311-win_arm64.whl", hash = "sha256:00f2b8d9615aa165fdff0a13f1a92049bfad555ee91e20d246a51aa0b556c60a"},
+ {file = "regex-2026.2.28-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:fcf26c3c6d0da98fada8ae4ef0aa1c3405a431c0a77eb17306d38a89b02adcd7"},
+ {file = "regex-2026.2.28-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:02473c954af35dd2defeb07e44182f5705b30ea3f351a7cbffa9177beb14da5d"},
+ {file = "regex-2026.2.28-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:9b65d33a17101569f86d9c5966a8b1d7fbf8afdda5a8aa219301b0a80f58cf7d"},
+ {file = "regex-2026.2.28-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e71dcecaa113eebcc96622c17692672c2d104b1d71ddf7adeda90da7ddeb26fc"},
+ {file = "regex-2026.2.28-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:481df4623fa4969c8b11f3433ed7d5e3dc9cec0f008356c3212b3933fb77e3d8"},
+ {file = "regex-2026.2.28-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:64e7c6ad614573e0640f271e811a408d79a9e1fe62a46adb602f598df42a818d"},
+ {file = "regex-2026.2.28-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d6b08a06976ff4fb0d83077022fde3eca06c55432bb997d8c0495b9a4e9872f4"},
+ {file = "regex-2026.2.28-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:864cdd1a2ef5716b0ab468af40139e62ede1b3a53386b375ec0786bb6783fc05"},
+ {file = "regex-2026.2.28-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:511f7419f7afab475fd4d639d4aedfc54205bcb0800066753ef68a59f0f330b5"},
+ {file = "regex-2026.2.28-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:b42f7466e32bf15a961cf09f35fa6323cc72e64d3d2c990b10de1274a5da0a59"},
+ {file = "regex-2026.2.28-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:8710d61737b0c0ce6836b1da7109f20d495e49b3809f30e27e9560be67a257bf"},
+ {file = "regex-2026.2.28-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:4390c365fd2d45278f45afd4673cb90f7285f5701607e3ad4274df08e36140ae"},
+ {file = "regex-2026.2.28-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:cb3b1db8ff6c7b8bf838ab05583ea15230cb2f678e569ab0e3a24d1e8320940b"},
+ {file = "regex-2026.2.28-cp312-cp312-win32.whl", hash = "sha256:f8ed9a5d4612df9d4de15878f0bc6aa7a268afbe5af21a3fdd97fa19516e978c"},
+ {file = "regex-2026.2.28-cp312-cp312-win_amd64.whl", hash = "sha256:01d65fd24206c8e1e97e2e31b286c59009636c022eb5d003f52760b0f42155d4"},
+ {file = "regex-2026.2.28-cp312-cp312-win_arm64.whl", hash = "sha256:c0b5ccbb8ffb433939d248707d4a8b31993cb76ab1a0187ca886bf50e96df952"},
+ {file = "regex-2026.2.28-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:6d63a07e5ec8ce7184452cb00c41c37b49e67dc4f73b2955b5b8e782ea970784"},
+ {file = "regex-2026.2.28-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:e59bc8f30414d283ae8ee1617b13d8112e7135cb92830f0ec3688cb29152585a"},
+ {file = "regex-2026.2.28-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:de0cf053139f96219ccfabb4a8dd2d217c8c82cb206c91d9f109f3f552d6b43d"},
+ {file = "regex-2026.2.28-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:fb4db2f17e6484904f986c5a657cec85574c76b5c5e61c7aae9ffa1bc6224f95"},
+ {file = "regex-2026.2.28-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:52b017b35ac2214d0db5f4f90e303634dc44e4aba4bd6235a27f97ecbe5b0472"},
+ {file = "regex-2026.2.28-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:69fc560ccbf08a09dc9b52ab69cacfae51e0ed80dc5693078bdc97db2f91ae96"},
+ {file = "regex-2026.2.28-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e61eea47230eba62a31f3e8a0e3164d0f37ef9f40529fb2c79361bc6b53d2a92"},
+ {file = "regex-2026.2.28-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:4f5c0b182ad4269e7381b7c27fdb0408399881f7a92a4624fd5487f2971dfc11"},
+ {file = "regex-2026.2.28-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:96f6269a2882fbb0ee76967116b83679dc628e68eaea44e90884b8d53d833881"},
+ {file = "regex-2026.2.28-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:b5acd4b6a95f37c3c3828e5d053a7d4edaedb85de551db0153754924cb7c83e3"},
+ {file = "regex-2026.2.28-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:2234059cfe33d9813a3677ef7667999caea9eeaa83fef98eb6ce15c6cf9e0215"},
+ {file = "regex-2026.2.28-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:c15af43c72a7fb0c97cbc66fa36a43546eddc5c06a662b64a0cbf30d6ac40944"},
+ {file = "regex-2026.2.28-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:9185cc63359862a6e80fe97f696e04b0ad9a11c4ac0a4a927f979f611bfe3768"},
+ {file = "regex-2026.2.28-cp313-cp313-win32.whl", hash = "sha256:fb66e5245db9652abd7196ace599b04d9c0e4aa7c8f0e2803938377835780081"},
+ {file = "regex-2026.2.28-cp313-cp313-win_amd64.whl", hash = "sha256:71a911098be38c859ceb3f9a9ce43f4ed9f4c6720ad8684a066ea246b76ad9ff"},
+ {file = "regex-2026.2.28-cp313-cp313-win_arm64.whl", hash = "sha256:39bb5727650b9a0275c6a6690f9bb3fe693a7e6cc5c3155b1240aedf8926423e"},
+ {file = "regex-2026.2.28-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:97054c55db06ab020342cc0d35d6f62a465fa7662871190175f1ad6c655c028f"},
+ {file = "regex-2026.2.28-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:0d25a10811de831c2baa6aef3c0be91622f44dd8d31dd12e69f6398efb15e48b"},
+ {file = "regex-2026.2.28-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:d6cfe798d8da41bb1862ed6e0cba14003d387c3c0c4a5d45591076ae9f0ce2f8"},
+ {file = "regex-2026.2.28-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:fd0ce43e71d825b7c0661f9c54d4d74bd97c56c3fd102a8985bcfea48236bacb"},
+ {file = "regex-2026.2.28-cp313-cp313t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:00945d007fd74a9084d2ab79b695b595c6b7ba3698972fadd43e23230c6979c1"},
+ {file = "regex-2026.2.28-cp313-cp313t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:bec23c11cbbf09a4df32fe50d57cbdd777bc442269b6e39a1775654f1c95dee2"},
+ {file = "regex-2026.2.28-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5cdcc17d935c8f9d3f4db5c2ebe2640c332e3822ad5d23c2f8e0228e6947943a"},
+ {file = "regex-2026.2.28-cp313-cp313t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:a448af01e3d8031c89c5d902040b124a5e921a25c4e5e07a861ca591ce429341"},
+ {file = "regex-2026.2.28-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:10d28e19bd4888e4abf43bd3925f3c134c52fdf7259219003588a42e24c2aa25"},
+ {file = "regex-2026.2.28-cp313-cp313t-musllinux_1_2_ppc64le.whl", hash = "sha256:99985a2c277dcb9ccb63f937451af5d65177af1efdeb8173ac55b61095a0a05c"},
+ {file = "regex-2026.2.28-cp313-cp313t-musllinux_1_2_riscv64.whl", hash = "sha256:e1e7b24cb3ae9953a560c563045d1ba56ee4749fbd05cf21ba571069bd7be81b"},
+ {file = "regex-2026.2.28-cp313-cp313t-musllinux_1_2_s390x.whl", hash = "sha256:d8511a01d0e4ee1992eb3ba19e09bc1866fe03f05129c3aec3fdc4cbc77aad3f"},
+ {file = "regex-2026.2.28-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:aaffaecffcd2479ce87aa1e74076c221700b7c804e48e98e62500ee748f0f550"},
+ {file = "regex-2026.2.28-cp313-cp313t-win32.whl", hash = "sha256:ef77bdde9c9eba3f7fa5b58084b29bbcc74bcf55fdbeaa67c102a35b5bd7e7cc"},
+ {file = "regex-2026.2.28-cp313-cp313t-win_amd64.whl", hash = "sha256:98adf340100cbe6fbaf8e6dc75e28f2c191b1be50ffefe292fb0e6f6eefdb0d8"},
+ {file = "regex-2026.2.28-cp313-cp313t-win_arm64.whl", hash = "sha256:2fb950ac1d88e6b6a9414381f403797b236f9fa17e1eee07683af72b1634207b"},
+ {file = "regex-2026.2.28-cp314-cp314-macosx_10_13_universal2.whl", hash = "sha256:78454178c7df31372ea737996fb7f36b3c2c92cccc641d251e072478afb4babc"},
+ {file = "regex-2026.2.28-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:5d10303dd18cedfd4d095543998404df656088240bcfd3cd20a8f95b861f74bd"},
+ {file = "regex-2026.2.28-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:19a9c9e0a8f24f39d575a6a854d516b48ffe4cbdcb9de55cb0570a032556ecff"},
+ {file = "regex-2026.2.28-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:09500be324f49b470d907b3ef8af9afe857f5cca486f853853f7945ddbf75911"},
+ {file = "regex-2026.2.28-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:fb1c4ff62277d87a7335f2c1ea4e0387b8f2b3ad88a64efd9943906aafad4f33"},
+ {file = "regex-2026.2.28-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:b8b3f1be1738feadc69f62daa250c933e85c6f34fa378f54a7ff43807c1b9117"},
+ {file = "regex-2026.2.28-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:dc8ed8c3f41c27acb83f7b6a9eb727a73fc6663441890c5cb3426a5f6a91ce7d"},
+ {file = "regex-2026.2.28-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:fa539be029844c0ce1114762d2952ab6cfdd7c7c9bd72e0db26b94c3c36dcc5a"},
+ {file = "regex-2026.2.28-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:7900157786428a79615a8264dac1f12c9b02957c473c8110c6b1f972dcecaddf"},
+ {file = "regex-2026.2.28-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:0b1d2b07614d95fa2bf8a63fd1e98bd8fa2b4848dc91b1efbc8ba219fdd73952"},
+ {file = "regex-2026.2.28-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:b389c61aa28a79c2e0527ac36da579869c2e235a5b208a12c5b5318cda2501d8"},
+ {file = "regex-2026.2.28-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:f467cb602f03fbd1ab1908f68b53c649ce393fde056628dc8c7e634dab6bfc07"},
+ {file = "regex-2026.2.28-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:e8c8cb2deba42f5ec1ede46374e990f8adc5e6456a57ac1a261b19be6f28e4e6"},
+ {file = "regex-2026.2.28-cp314-cp314-win32.whl", hash = "sha256:9036b400b20e4858d56d117108d7813ed07bb7803e3eed766675862131135ca6"},
+ {file = "regex-2026.2.28-cp314-cp314-win_amd64.whl", hash = "sha256:1d367257cd86c1cbb97ea94e77b373a0bbc2224976e247f173d19e8f18b4afa7"},
+ {file = "regex-2026.2.28-cp314-cp314-win_arm64.whl", hash = "sha256:5e68192bb3a1d6fb2836da24aa494e413ea65853a21505e142e5b1064a595f3d"},
+ {file = "regex-2026.2.28-cp314-cp314t-macosx_10_13_universal2.whl", hash = "sha256:a5dac14d0872eeb35260a8e30bac07ddf22adc1e3a0635b52b02e180d17c9c7e"},
+ {file = "regex-2026.2.28-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:ec0c608b7a7465ffadb344ed7c987ff2f11ee03f6a130b569aa74d8a70e8333c"},
+ {file = "regex-2026.2.28-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:c7815afb0ca45456613fdaf60ea9c993715511c8d53a83bc468305cbc0ee23c7"},
+ {file = "regex-2026.2.28-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b059e71ec363968671693a78c5053bd9cb2fe410f9b8e4657e88377ebd603a2e"},
+ {file = "regex-2026.2.28-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:b8cf76f1a29f0e99dcfd7aef1551a9827588aae5a737fe31442021165f1920dc"},
+ {file = "regex-2026.2.28-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:180e08a435a0319e6a4821c3468da18dc7001987e1c17ae1335488dfe7518dd8"},
+ {file = "regex-2026.2.28-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1e496956106fd59ba6322a8ea17141a27c5040e5ee8f9433ae92d4e5204462a0"},
+ {file = "regex-2026.2.28-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:bba2b18d70eeb7b79950f12f633beeecd923f7c9ad6f6bae28e59b4cb3ab046b"},
+ {file = "regex-2026.2.28-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:6db7bfae0f8a2793ff1f7021468ea55e2699d0790eb58ee6ab36ae43aa00bc5b"},
+ {file = "regex-2026.2.28-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:d0b02e8b7e5874b48ae0f077ecca61c1a6a9f9895e9c6dfb191b55b242862033"},
+ {file = "regex-2026.2.28-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:25b6eb660c5cf4b8c3407a1ed462abba26a926cc9965e164268a3267bcc06a43"},
+ {file = "regex-2026.2.28-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:5a932ea8ad5d0430351ff9c76c8db34db0d9f53c1d78f06022a21f4e290c5c18"},
+ {file = "regex-2026.2.28-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:1c2c95e1a2b0f89d01e821ff4de1be4b5d73d1f4b0bf679fa27c1ad8d2327f1a"},
+ {file = "regex-2026.2.28-cp314-cp314t-win32.whl", hash = "sha256:bbb882061f742eb5d46f2f1bd5304055be0a66b783576de3d7eef1bed4778a6e"},
+ {file = "regex-2026.2.28-cp314-cp314t-win_amd64.whl", hash = "sha256:6591f281cb44dc13de9585b552cec6fc6cf47fb2fe7a48892295ee9bc4a612f9"},
+ {file = "regex-2026.2.28-cp314-cp314t-win_arm64.whl", hash = "sha256:dee50f1be42222f89767b64b283283ef963189da0dda4a515aa54a5563c62dec"},
+ {file = "regex-2026.2.28.tar.gz", hash = "sha256:a729e47d418ea11d03469f321aaf67cdee8954cde3ff2cf8403ab87951ad10f2"},
]
[[package]]
@@ -4964,7 +5136,7 @@ name = "rich"
version = "14.3.3"
requires_python = ">=3.8.0"
summary = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal"
-groups = ["default", "dev"]
+groups = ["default", "dev", "mcp"]
dependencies = [
"markdown-it-py>=2.2.0",
"pygments<3.0.0,>=2.13.0",
@@ -4974,31 +5146,141 @@ files = [
{file = "rich-14.3.3.tar.gz", hash = "sha256:b8daa0b9e4eef54dd8cf7c86c03713f53241884e814f4e2f5fb342fe520f639b"},
]
+[[package]]
+name = "rpds-py"
+version = "0.30.0"
+requires_python = ">=3.10"
+summary = "Python bindings to Rust's persistent data structures (rpds)"
+groups = ["mcp"]
+files = [
+ {file = "rpds_py-0.30.0-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:a2bffea6a4ca9f01b3f8e548302470306689684e61602aa3d141e34da06cf425"},
+ {file = "rpds_py-0.30.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:dc4f992dfe1e2bc3ebc7444f6c7051b4bc13cd8e33e43511e8ffd13bf407010d"},
+ {file = "rpds_py-0.30.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:422c3cb9856d80b09d30d2eb255d0754b23e090034e1deb4083f8004bd0761e4"},
+ {file = "rpds_py-0.30.0-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:07ae8a593e1c3c6b82ca3292efbe73c30b61332fd612e05abee07c79359f292f"},
+ {file = "rpds_py-0.30.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:12f90dd7557b6bd57f40abe7747e81e0c0b119bef015ea7726e69fe550e394a4"},
+ {file = "rpds_py-0.30.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:99b47d6ad9a6da00bec6aabe5a6279ecd3c06a329d4aa4771034a21e335c3a97"},
+ {file = "rpds_py-0.30.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:33f559f3104504506a44bb666b93a33f5d33133765b0c216a5bf2f1e1503af89"},
+ {file = "rpds_py-0.30.0-cp311-cp311-manylinux_2_31_riscv64.whl", hash = "sha256:946fe926af6e44f3697abbc305ea168c2c31d3e3ef1058cf68f379bf0335a78d"},
+ {file = "rpds_py-0.30.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:495aeca4b93d465efde585977365187149e75383ad2684f81519f504f5c13038"},
+ {file = "rpds_py-0.30.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:d9a0ca5da0386dee0655b4ccdf46119df60e0f10da268d04fe7cc87886872ba7"},
+ {file = "rpds_py-0.30.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:8d6d1cc13664ec13c1b84241204ff3b12f9bb82464b8ad6e7a5d3486975c2eed"},
+ {file = "rpds_py-0.30.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:3896fa1be39912cf0757753826bc8bdc8ca331a28a7c4ae46b7a21280b06bb85"},
+ {file = "rpds_py-0.30.0-cp311-cp311-win32.whl", hash = "sha256:55f66022632205940f1827effeff17c4fa7ae1953d2b74a8581baaefb7d16f8c"},
+ {file = "rpds_py-0.30.0-cp311-cp311-win_amd64.whl", hash = "sha256:a51033ff701fca756439d641c0ad09a41d9242fa69121c7d8769604a0a629825"},
+ {file = "rpds_py-0.30.0-cp311-cp311-win_arm64.whl", hash = "sha256:47b0ef6231c58f506ef0b74d44e330405caa8428e770fec25329ed2cb971a229"},
+ {file = "rpds_py-0.30.0-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:a161f20d9a43006833cd7068375a94d035714d73a172b681d8881820600abfad"},
+ {file = "rpds_py-0.30.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:6abc8880d9d036ecaafe709079969f56e876fcf107f7a8e9920ba6d5a3878d05"},
+ {file = "rpds_py-0.30.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ca28829ae5f5d569bb62a79512c842a03a12576375d5ece7d2cadf8abe96ec28"},
+ {file = "rpds_py-0.30.0-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a1010ed9524c73b94d15919ca4d41d8780980e1765babf85f9a2f90d247153dd"},
+ {file = "rpds_py-0.30.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f8d1736cfb49381ba528cd5baa46f82fdc65c06e843dab24dd70b63d09121b3f"},
+ {file = "rpds_py-0.30.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d948b135c4693daff7bc2dcfc4ec57237a29bd37e60c2fabf5aff2bbacf3e2f1"},
+ {file = "rpds_py-0.30.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:47f236970bccb2233267d89173d3ad2703cd36a0e2a6e92d0560d333871a3d23"},
+ {file = "rpds_py-0.30.0-cp312-cp312-manylinux_2_31_riscv64.whl", hash = "sha256:2e6ecb5a5bcacf59c3f912155044479af1d0b6681280048b338b28e364aca1f6"},
+ {file = "rpds_py-0.30.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:a8fa71a2e078c527c3e9dc9fc5a98c9db40bcc8a92b4e8858e36d329f8684b51"},
+ {file = "rpds_py-0.30.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:73c67f2db7bc334e518d097c6d1e6fed021bbc9b7d678d6cc433478365d1d5f5"},
+ {file = "rpds_py-0.30.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:5ba103fb455be00f3b1c2076c9d4264bfcb037c976167a6047ed82f23153f02e"},
+ {file = "rpds_py-0.30.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:7cee9c752c0364588353e627da8a7e808a66873672bcb5f52890c33fd965b394"},
+ {file = "rpds_py-0.30.0-cp312-cp312-win32.whl", hash = "sha256:1ab5b83dbcf55acc8b08fc62b796ef672c457b17dbd7820a11d6c52c06839bdf"},
+ {file = "rpds_py-0.30.0-cp312-cp312-win_amd64.whl", hash = "sha256:a090322ca841abd453d43456ac34db46e8b05fd9b3b4ac0c78bcde8b089f959b"},
+ {file = "rpds_py-0.30.0-cp312-cp312-win_arm64.whl", hash = "sha256:669b1805bd639dd2989b281be2cfd951c6121b65e729d9b843e9639ef1fd555e"},
+ {file = "rpds_py-0.30.0-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:f83424d738204d9770830d35290ff3273fbb02b41f919870479fab14b9d303b2"},
+ {file = "rpds_py-0.30.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:e7536cd91353c5273434b4e003cbda89034d67e7710eab8761fd918ec6c69cf8"},
+ {file = "rpds_py-0.30.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2771c6c15973347f50fece41fc447c054b7ac2ae0502388ce3b6738cd366e3d4"},
+ {file = "rpds_py-0.30.0-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:0a59119fc6e3f460315fe9d08149f8102aa322299deaa5cab5b40092345c2136"},
+ {file = "rpds_py-0.30.0-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:76fec018282b4ead0364022e3c54b60bf368b9d926877957a8624b58419169b7"},
+ {file = "rpds_py-0.30.0-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:692bef75a5525db97318e8cd061542b5a79812d711ea03dbc1f6f8dbb0c5f0d2"},
+ {file = "rpds_py-0.30.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9027da1ce107104c50c81383cae773ef5c24d296dd11c99e2629dbd7967a20c6"},
+ {file = "rpds_py-0.30.0-cp313-cp313-manylinux_2_31_riscv64.whl", hash = "sha256:9cf69cdda1f5968a30a359aba2f7f9aa648a9ce4b580d6826437f2b291cfc86e"},
+ {file = "rpds_py-0.30.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:a4796a717bf12b9da9d3ad002519a86063dcac8988b030e405704ef7d74d2d9d"},
+ {file = "rpds_py-0.30.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:5d4c2aa7c50ad4728a094ebd5eb46c452e9cb7edbfdb18f9e1221f597a73e1e7"},
+ {file = "rpds_py-0.30.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:ba81a9203d07805435eb06f536d95a266c21e5b2dfbf6517748ca40c98d19e31"},
+ {file = "rpds_py-0.30.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:945dccface01af02675628334f7cf49c2af4c1c904748efc5cf7bbdf0b579f95"},
+ {file = "rpds_py-0.30.0-cp313-cp313-win32.whl", hash = "sha256:b40fb160a2db369a194cb27943582b38f79fc4887291417685f3ad693c5a1d5d"},
+ {file = "rpds_py-0.30.0-cp313-cp313-win_amd64.whl", hash = "sha256:806f36b1b605e2d6a72716f321f20036b9489d29c51c91f4dd29a3e3afb73b15"},
+ {file = "rpds_py-0.30.0-cp313-cp313-win_arm64.whl", hash = "sha256:d96c2086587c7c30d44f31f42eae4eac89b60dabbac18c7669be3700f13c3ce1"},
+ {file = "rpds_py-0.30.0-cp313-cp313t-macosx_10_12_x86_64.whl", hash = "sha256:eb0b93f2e5c2189ee831ee43f156ed34e2a89a78a66b98cadad955972548be5a"},
+ {file = "rpds_py-0.30.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:922e10f31f303c7c920da8981051ff6d8c1a56207dbdf330d9047f6d30b70e5e"},
+ {file = "rpds_py-0.30.0-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cdc62c8286ba9bf7f47befdcea13ea0e26bf294bda99758fd90535cbaf408000"},
+ {file = "rpds_py-0.30.0-cp313-cp313t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:47f9a91efc418b54fb8190a6b4aa7813a23fb79c51f4bb84e418f5476c38b8db"},
+ {file = "rpds_py-0.30.0-cp313-cp313t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1f3587eb9b17f3789ad50824084fa6f81921bbf9a795826570bda82cb3ed91f2"},
+ {file = "rpds_py-0.30.0-cp313-cp313t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:39c02563fc592411c2c61d26b6c5fe1e51eaa44a75aa2c8735ca88b0d9599daa"},
+ {file = "rpds_py-0.30.0-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:51a1234d8febafdfd33a42d97da7a43f5dcb120c1060e352a3fbc0c6d36e2083"},
+ {file = "rpds_py-0.30.0-cp313-cp313t-manylinux_2_31_riscv64.whl", hash = "sha256:eb2c4071ab598733724c08221091e8d80e89064cd472819285a9ab0f24bcedb9"},
+ {file = "rpds_py-0.30.0-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:6bdfdb946967d816e6adf9a3d8201bfad269c67efe6cefd7093ef959683c8de0"},
+ {file = "rpds_py-0.30.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:c77afbd5f5250bf27bf516c7c4a016813eb2d3e116139aed0096940c5982da94"},
+ {file = "rpds_py-0.30.0-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:61046904275472a76c8c90c9ccee9013d70a6d0f73eecefd38c1ae7c39045a08"},
+ {file = "rpds_py-0.30.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:4c5f36a861bc4b7da6516dbdf302c55313afa09b81931e8280361a4f6c9a2d27"},
+ {file = "rpds_py-0.30.0-cp313-cp313t-win32.whl", hash = "sha256:3d4a69de7a3e50ffc214ae16d79d8fbb0922972da0356dcf4d0fdca2878559c6"},
+ {file = "rpds_py-0.30.0-cp313-cp313t-win_amd64.whl", hash = "sha256:f14fc5df50a716f7ece6a80b6c78bb35ea2ca47c499e422aa4463455dd96d56d"},
+ {file = "rpds_py-0.30.0-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:68f19c879420aa08f61203801423f6cd5ac5f0ac4ac82a2368a9fcd6a9a075e0"},
+ {file = "rpds_py-0.30.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:ec7c4490c672c1a0389d319b3a9cfcd098dcdc4783991553c332a15acf7249be"},
+ {file = "rpds_py-0.30.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f251c812357a3fed308d684a5079ddfb9d933860fc6de89f2b7ab00da481e65f"},
+ {file = "rpds_py-0.30.0-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ac98b175585ecf4c0348fd7b29c3864bda53b805c773cbf7bfdaffc8070c976f"},
+ {file = "rpds_py-0.30.0-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3e62880792319dbeb7eb866547f2e35973289e7d5696c6e295476448f5b63c87"},
+ {file = "rpds_py-0.30.0-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4e7fc54e0900ab35d041b0601431b0a0eb495f0851a0639b6ef90f7741b39a18"},
+ {file = "rpds_py-0.30.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:47e77dc9822d3ad616c3d5759ea5631a75e5809d5a28707744ef79d7a1bcfcad"},
+ {file = "rpds_py-0.30.0-cp314-cp314-manylinux_2_31_riscv64.whl", hash = "sha256:b4dc1a6ff022ff85ecafef7979a2c6eb423430e05f1165d6688234e62ba99a07"},
+ {file = "rpds_py-0.30.0-cp314-cp314-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:4559c972db3a360808309e06a74628b95eaccbf961c335c8fe0d590cf587456f"},
+ {file = "rpds_py-0.30.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:0ed177ed9bded28f8deb6ab40c183cd1192aa0de40c12f38be4d59cd33cb5c65"},
+ {file = "rpds_py-0.30.0-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:ad1fa8db769b76ea911cb4e10f049d80bf518c104f15b3edb2371cc65375c46f"},
+ {file = "rpds_py-0.30.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:46e83c697b1f1c72b50e5ee5adb4353eef7406fb3f2043d64c33f20ad1c2fc53"},
+ {file = "rpds_py-0.30.0-cp314-cp314-win32.whl", hash = "sha256:ee454b2a007d57363c2dfd5b6ca4a5d7e2c518938f8ed3b706e37e5d470801ed"},
+ {file = "rpds_py-0.30.0-cp314-cp314-win_amd64.whl", hash = "sha256:95f0802447ac2d10bcc69f6dc28fe95fdf17940367b21d34e34c737870758950"},
+ {file = "rpds_py-0.30.0-cp314-cp314-win_arm64.whl", hash = "sha256:613aa4771c99f03346e54c3f038e4cc574ac09a3ddfb0e8878487335e96dead6"},
+ {file = "rpds_py-0.30.0-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:7e6ecfcb62edfd632e56983964e6884851786443739dbfe3582947e87274f7cb"},
+ {file = "rpds_py-0.30.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:a1d0bc22a7cdc173fedebb73ef81e07faef93692b8c1ad3733b67e31e1b6e1b8"},
+ {file = "rpds_py-0.30.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0d08f00679177226c4cb8c5265012eea897c8ca3b93f429e546600c971bcbae7"},
+ {file = "rpds_py-0.30.0-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5965af57d5848192c13534f90f9dd16464f3c37aaf166cc1da1cae1fd5a34898"},
+ {file = "rpds_py-0.30.0-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9a4e86e34e9ab6b667c27f3211ca48f73dba7cd3d90f8d5b11be56e5dbc3fb4e"},
+ {file = "rpds_py-0.30.0-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e5d3e6b26f2c785d65cc25ef1e5267ccbe1b069c5c21b8cc724efee290554419"},
+ {file = "rpds_py-0.30.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:626a7433c34566535b6e56a1b39a7b17ba961e97ce3b80ec62e6f1312c025551"},
+ {file = "rpds_py-0.30.0-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:acd7eb3f4471577b9b5a41baf02a978e8bdeb08b4b355273994f8b87032000a8"},
+ {file = "rpds_py-0.30.0-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:fe5fa731a1fa8a0a56b0977413f8cacac1768dad38d16b3a296712709476fbd5"},
+ {file = "rpds_py-0.30.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:74a3243a411126362712ee1524dfc90c650a503502f135d54d1b352bd01f2404"},
+ {file = "rpds_py-0.30.0-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:3e8eeb0544f2eb0d2581774be4c3410356eba189529a6b3e36bbbf9696175856"},
+ {file = "rpds_py-0.30.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:dbd936cde57abfee19ab3213cf9c26be06d60750e60a8e4dd85d1ab12c8b1f40"},
+ {file = "rpds_py-0.30.0-cp314-cp314t-win32.whl", hash = "sha256:dc824125c72246d924f7f796b4f63c1e9dc810c7d9e2355864b3c3a73d59ade0"},
+ {file = "rpds_py-0.30.0-cp314-cp314t-win_amd64.whl", hash = "sha256:27f4b0e92de5bfbc6f86e43959e6edd1425c33b5e69aab0984a72047f2bcf1e3"},
+ {file = "rpds_py-0.30.0-pp311-pypy311_pp73-macosx_10_12_x86_64.whl", hash = "sha256:c2262bdba0ad4fc6fb5545660673925c2d2a5d9e2e0fb603aad545427be0fc58"},
+ {file = "rpds_py-0.30.0-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:ee6af14263f25eedc3bb918a3c04245106a42dfd4f5c2285ea6f997b1fc3f89a"},
+ {file = "rpds_py-0.30.0-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3adbb8179ce342d235c31ab8ec511e66c73faa27a47e076ccc92421add53e2bb"},
+ {file = "rpds_py-0.30.0-pp311-pypy311_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:250fa00e9543ac9b97ac258bd37367ff5256666122c2d0f2bc97577c60a1818c"},
+ {file = "rpds_py-0.30.0-pp311-pypy311_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9854cf4f488b3d57b9aaeb105f06d78e5529d3145b1e4a41750167e8c213c6d3"},
+ {file = "rpds_py-0.30.0-pp311-pypy311_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:993914b8e560023bc0a8bf742c5f303551992dcb85e247b1e5c7f4a7d145bda5"},
+ {file = "rpds_py-0.30.0-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:58edca431fb9b29950807e301826586e5bbf24163677732429770a697ffe6738"},
+ {file = "rpds_py-0.30.0-pp311-pypy311_pp73-manylinux_2_31_riscv64.whl", hash = "sha256:dea5b552272a944763b34394d04577cf0f9bd013207bc32323b5a89a53cf9c2f"},
+ {file = "rpds_py-0.30.0-pp311-pypy311_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:ba3af48635eb83d03f6c9735dfb21785303e73d22ad03d489e88adae6eab8877"},
+ {file = "rpds_py-0.30.0-pp311-pypy311_pp73-musllinux_1_2_aarch64.whl", hash = "sha256:dff13836529b921e22f15cb099751209a60009731a68519630a24d61f0b1b30a"},
+ {file = "rpds_py-0.30.0-pp311-pypy311_pp73-musllinux_1_2_i686.whl", hash = "sha256:1b151685b23929ab7beec71080a8889d4d6d9fa9a983d213f07121205d48e2c4"},
+ {file = "rpds_py-0.30.0-pp311-pypy311_pp73-musllinux_1_2_x86_64.whl", hash = "sha256:ac37f9f516c51e5753f27dfdef11a88330f04de2d564be3991384b2f3535d02e"},
+ {file = "rpds_py-0.30.0.tar.gz", hash = "sha256:dd8ff7cf90014af0c0f787eea34794ebf6415242ee1d6fa91eaba725cc441e84"},
+]
+
[[package]]
name = "ruff"
-version = "0.15.2"
+version = "0.15.4"
requires_python = ">=3.7"
summary = "An extremely fast Python linter and code formatter, written in Rust."
groups = ["dev"]
files = [
- {file = "ruff-0.15.2-py3-none-linux_armv6l.whl", hash = "sha256:120691a6fdae2f16d65435648160f5b81a9625288f75544dc40637436b5d3c0d"},
- {file = "ruff-0.15.2-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:a89056d831256099658b6bba4037ac6dd06f49d194199215befe2bb10457ea5e"},
- {file = "ruff-0.15.2-py3-none-macosx_11_0_arm64.whl", hash = "sha256:e36dee3a64be0ebd23c86ffa3aa3fd3ac9a712ff295e192243f814a830b6bd87"},
- {file = "ruff-0.15.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a9fb47b6d9764677f8c0a193c0943ce9a05d6763523f132325af8a858eadc2b9"},
- {file = "ruff-0.15.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f376990f9d0d6442ea9014b19621d8f2aaf2b8e39fdbfc79220b7f0c596c9b80"},
- {file = "ruff-0.15.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2dcc987551952d73cbf5c88d9fdee815618d497e4df86cd4c4824cc59d5dd75f"},
- {file = "ruff-0.15.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:42a47fd785cbe8c01b9ff45031af875d101b040ad8f4de7bbb716487c74c9a77"},
- {file = "ruff-0.15.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cbe9f49354866e575b4c6943856989f966421870e85cd2ac94dccb0a9dcb2fea"},
- {file = "ruff-0.15.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b7a672c82b5f9887576087d97be5ce439f04bbaf548ee987b92d3a7dede41d3a"},
- {file = "ruff-0.15.2-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:72ecc64f46f7019e2bcc3cdc05d4a7da958b629a5ab7033195e11a438403d956"},
- {file = "ruff-0.15.2-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:8dcf243b15b561c655c1ef2f2b0050e5d50db37fe90115507f6ff37d865dc8b4"},
- {file = "ruff-0.15.2-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:dab6941c862c05739774677c6273166d2510d254dac0695c0e3f5efa1b5585de"},
- {file = "ruff-0.15.2-py3-none-musllinux_1_2_i686.whl", hash = "sha256:1b9164f57fc36058e9a6806eb92af185b0697c9fe4c7c52caa431c6554521e5c"},
- {file = "ruff-0.15.2-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:80d24fcae24d42659db7e335b9e1531697a7102c19185b8dc4a028b952865fd8"},
- {file = "ruff-0.15.2-py3-none-win32.whl", hash = "sha256:fd5ff9e5f519a7e1bd99cbe8daa324010a74f5e2ebc97c6242c08f26f3714f6f"},
- {file = "ruff-0.15.2-py3-none-win_amd64.whl", hash = "sha256:d20014e3dfa400f3ff84830dfb5755ece2de45ab62ecea4af6b7262d0fb4f7c5"},
- {file = "ruff-0.15.2-py3-none-win_arm64.whl", hash = "sha256:cabddc5822acdc8f7b5527b36ceac55cc51eec7b1946e60181de8fe83ca8876e"},
- {file = "ruff-0.15.2.tar.gz", hash = "sha256:14b965afee0969e68bb871eba625343b8673375f457af4abe98553e8bbb98342"},
+ {file = "ruff-0.15.4-py3-none-linux_armv6l.whl", hash = "sha256:a1810931c41606c686bae8b5b9a8072adac2f611bb433c0ba476acba17a332e0"},
+ {file = "ruff-0.15.4-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:5a1632c66672b8b4d3e1d1782859e98d6e0b4e70829530666644286600a33992"},
+ {file = "ruff-0.15.4-py3-none-macosx_11_0_arm64.whl", hash = "sha256:a4386ba2cd6c0f4ff75252845906acc7c7c8e1ac567b7bc3d373686ac8c222ba"},
+ {file = "ruff-0.15.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b2496488bdfd3732747558b6f95ae427ff066d1fcd054daf75f5a50674411e75"},
+ {file = "ruff-0.15.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:3f1c4893841ff2d54cbda1b2860fa3260173df5ddd7b95d370186f8a5e66a4ac"},
+ {file = "ruff-0.15.4-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:820b8766bd65503b6c30aaa6331e8ef3a6e564f7999c844e9a547c40179e440a"},
+ {file = "ruff-0.15.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c9fb74bab47139c1751f900f857fa503987253c3ef89129b24ed375e72873e85"},
+ {file = "ruff-0.15.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f80c98765949c518142b3a50a5db89343aa90f2c2bf7799de9986498ae6176db"},
+ {file = "ruff-0.15.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:451a2e224151729b3b6c9ffb36aed9091b2996fe4bdbd11f47e27d8f2e8888ec"},
+ {file = "ruff-0.15.4-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:a8f157f2e583c513c4f5f896163a93198297371f34c04220daf40d133fdd4f7f"},
+ {file = "ruff-0.15.4-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:917cc68503357021f541e69b35361c99387cdbbf99bd0ea4aa6f28ca99ff5338"},
+ {file = "ruff-0.15.4-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:e9737c8161da79fd7cfec19f1e35620375bd8b2a50c3e77fa3d2c16f574105cc"},
+ {file = "ruff-0.15.4-py3-none-musllinux_1_2_i686.whl", hash = "sha256:291258c917539e18f6ba40482fe31d6f5ac023994ee11d7bdafd716f2aab8a68"},
+ {file = "ruff-0.15.4-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:3f83c45911da6f2cd5936c436cf86b9f09f09165f033a99dcf7477e34041cbc3"},
+ {file = "ruff-0.15.4-py3-none-win32.whl", hash = "sha256:65594a2d557d4ee9f02834fcdf0a28daa8b3b9f6cb2cb93846025a36db47ef22"},
+ {file = "ruff-0.15.4-py3-none-win_amd64.whl", hash = "sha256:04196ad44f0df220c2ece5b0e959c2f37c777375ec744397d21d15b50a75264f"},
+ {file = "ruff-0.15.4-py3-none-win_arm64.whl", hash = "sha256:60d5177e8cfc70e51b9c5fad936c634872a74209f934c1e79107d11787ad5453"},
+ {file = "ruff-0.15.4.tar.gz", hash = "sha256:3412195319e42d634470cc97aa9803d07e9d5c9223b99bcb1518f0c725f26ae1"},
]
[[package]]
@@ -5079,7 +5361,7 @@ files = [
[[package]]
name = "scipy"
-version = "1.17.0"
+version = "1.17.1"
requires_python = ">=3.11"
summary = "Fundamental algorithms for scientific computing in Python"
groups = ["default"]
@@ -5087,67 +5369,67 @@ dependencies = [
"numpy<2.7,>=1.26.4",
]
files = [
- {file = "scipy-1.17.0-cp311-cp311-macosx_10_14_x86_64.whl", hash = "sha256:2abd71643797bd8a106dff97894ff7869eeeb0af0f7a5ce02e4227c6a2e9d6fd"},
- {file = "scipy-1.17.0-cp311-cp311-macosx_12_0_arm64.whl", hash = "sha256:ef28d815f4d2686503e5f4f00edc387ae58dfd7a2f42e348bb53359538f01558"},
- {file = "scipy-1.17.0-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:272a9f16d6bb4667e8b50d25d71eddcc2158a214df1b566319298de0939d2ab7"},
- {file = "scipy-1.17.0-cp311-cp311-macosx_14_0_x86_64.whl", hash = "sha256:7204fddcbec2fe6598f1c5fdf027e9f259106d05202a959a9f1aecf036adc9f6"},
- {file = "scipy-1.17.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:fc02c37a5639ee67d8fb646ffded6d793c06c5622d36b35cfa8fe5ececb8f042"},
- {file = "scipy-1.17.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:dac97a27520d66c12a34fd90a4fe65f43766c18c0d6e1c0a80f114d2260080e4"},
- {file = "scipy-1.17.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:ebb7446a39b3ae0fe8f416a9a3fdc6fba3f11c634f680f16a239c5187bc487c0"},
- {file = "scipy-1.17.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:474da16199f6af66601a01546144922ce402cb17362e07d82f5a6cf8f963e449"},
- {file = "scipy-1.17.0-cp311-cp311-win_amd64.whl", hash = "sha256:255c0da161bd7b32a6c898e7891509e8a9289f0b1c6c7d96142ee0d2b114c2ea"},
- {file = "scipy-1.17.0-cp311-cp311-win_arm64.whl", hash = "sha256:85b0ac3ad17fa3be50abd7e69d583d98792d7edc08367e01445a1e2076005379"},
- {file = "scipy-1.17.0-cp312-cp312-macosx_10_14_x86_64.whl", hash = "sha256:0d5018a57c24cb1dd828bcf51d7b10e65986d549f52ef5adb6b4d1ded3e32a57"},
- {file = "scipy-1.17.0-cp312-cp312-macosx_12_0_arm64.whl", hash = "sha256:88c22af9e5d5a4f9e027e26772cc7b5922fab8bcc839edb3ae33de404feebd9e"},
- {file = "scipy-1.17.0-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:f3cd947f20fe17013d401b64e857c6b2da83cae567adbb75b9dcba865abc66d8"},
- {file = "scipy-1.17.0-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:e8c0b331c2c1f531eb51f1b4fc9ba709521a712cce58f1aa627bc007421a5306"},
- {file = "scipy-1.17.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5194c445d0a1c7a6c1a4a4681b6b7c71baad98ff66d96b949097e7513c9d6742"},
- {file = "scipy-1.17.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9eeb9b5f5997f75507814ed9d298ab23f62cf79f5a3ef90031b1ee2506abdb5b"},
- {file = "scipy-1.17.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:40052543f7bbe921df4408f46003d6f01c6af109b9e2c8a66dd1cf6cf57f7d5d"},
- {file = "scipy-1.17.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:0cf46c8013fec9d3694dc572f0b54100c28405d55d3e2cb15e2895b25057996e"},
- {file = "scipy-1.17.0-cp312-cp312-win_amd64.whl", hash = "sha256:0937a0b0d8d593a198cededd4c439a0ea216a3f36653901ea1f3e4be949056f8"},
- {file = "scipy-1.17.0-cp312-cp312-win_arm64.whl", hash = "sha256:f603d8a5518c7426414d1d8f82e253e454471de682ce5e39c29adb0df1efb86b"},
- {file = "scipy-1.17.0-cp313-cp313-macosx_10_14_x86_64.whl", hash = "sha256:65ec32f3d32dfc48c72df4291345dae4f048749bc8d5203ee0a3f347f96c5ce6"},
- {file = "scipy-1.17.0-cp313-cp313-macosx_12_0_arm64.whl", hash = "sha256:1f9586a58039d7229ce77b52f8472c972448cded5736eaf102d5658bbac4c269"},
- {file = "scipy-1.17.0-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:9fad7d3578c877d606b1150135c2639e9de9cecd3705caa37b66862977cc3e72"},
- {file = "scipy-1.17.0-cp313-cp313-macosx_14_0_x86_64.whl", hash = "sha256:423ca1f6584fc03936972b5f7c06961670dbba9f234e71676a7c7ccf938a0d61"},
- {file = "scipy-1.17.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:fe508b5690e9eaaa9467fc047f833af58f1152ae51a0d0aed67aa5801f4dd7d6"},
- {file = "scipy-1.17.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6680f2dfd4f6182e7d6db161344537da644d1cf85cf293f015c60a17ecf08752"},
- {file = "scipy-1.17.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:eec3842ec9ac9de5917899b277428886042a93db0b227ebbe3a333b64ec7643d"},
- {file = "scipy-1.17.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:d7425fcafbc09a03731e1bc05581f5fad988e48c6a861f441b7ab729a49a55ea"},
- {file = "scipy-1.17.0-cp313-cp313-win_amd64.whl", hash = "sha256:87b411e42b425b84777718cc41516b8a7e0795abfa8e8e1d573bf0ef014f0812"},
- {file = "scipy-1.17.0-cp313-cp313-win_arm64.whl", hash = "sha256:357ca001c6e37601066092e7c89cca2f1ce74e2a520ca78d063a6d2201101df2"},
- {file = "scipy-1.17.0-cp313-cp313t-macosx_10_14_x86_64.whl", hash = "sha256:ec0827aa4d36cb79ff1b81de898e948a51ac0b9b1c43e4a372c0508c38c0f9a3"},
- {file = "scipy-1.17.0-cp313-cp313t-macosx_12_0_arm64.whl", hash = "sha256:819fc26862b4b3c73a60d486dbb919202f3d6d98c87cf20c223511429f2d1a97"},
- {file = "scipy-1.17.0-cp313-cp313t-macosx_14_0_arm64.whl", hash = "sha256:363ad4ae2853d88ebcde3ae6ec46ccca903ea9835ee8ba543f12f575e7b07e4e"},
- {file = "scipy-1.17.0-cp313-cp313t-macosx_14_0_x86_64.whl", hash = "sha256:979c3a0ff8e5ba254d45d59ebd38cde48fce4f10b5125c680c7a4bfe177aab07"},
- {file = "scipy-1.17.0-cp313-cp313t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:130d12926ae34399d157de777472bf82e9061c60cc081372b3118edacafe1d00"},
- {file = "scipy-1.17.0-cp313-cp313t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6e886000eb4919eae3a44f035e63f0fd8b651234117e8f6f29bad1cd26e7bc45"},
- {file = "scipy-1.17.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:13c4096ac6bc31d706018f06a49abe0485f96499deb82066b94d19b02f664209"},
- {file = "scipy-1.17.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:cacbaddd91fcffde703934897c5cd2c7cb0371fac195d383f4e1f1c5d3f3bd04"},
- {file = "scipy-1.17.0-cp313-cp313t-win_amd64.whl", hash = "sha256:edce1a1cf66298cccdc48a1bdf8fb10a3bf58e8b58d6c3883dd1530e103f87c0"},
- {file = "scipy-1.17.0-cp313-cp313t-win_arm64.whl", hash = "sha256:30509da9dbec1c2ed8f168b8d8aa853bc6723fede1dbc23c7d43a56f5ab72a67"},
- {file = "scipy-1.17.0-cp314-cp314-macosx_10_14_x86_64.whl", hash = "sha256:c17514d11b78be8f7e6331b983a65a7f5ca1fd037b95e27b280921fe5606286a"},
- {file = "scipy-1.17.0-cp314-cp314-macosx_12_0_arm64.whl", hash = "sha256:4e00562e519c09da34c31685f6acc3aa384d4d50604db0f245c14e1b4488bfa2"},
- {file = "scipy-1.17.0-cp314-cp314-macosx_14_0_arm64.whl", hash = "sha256:f7df7941d71314e60a481e02d5ebcb3f0185b8d799c70d03d8258f6c80f3d467"},
- {file = "scipy-1.17.0-cp314-cp314-macosx_14_0_x86_64.whl", hash = "sha256:aabf057c632798832f071a8dde013c2e26284043934f53b00489f1773b33527e"},
- {file = "scipy-1.17.0-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a38c3337e00be6fd8a95b4ed66b5d988bac4ec888fd922c2ea9fe5fb1603dd67"},
- {file = "scipy-1.17.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:00fb5f8ec8398ad90215008d8b6009c9db9fa924fd4c7d6be307c6f945f9cd73"},
- {file = "scipy-1.17.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:f2a4942b0f5f7c23c7cd641a0ca1955e2ae83dedcff537e3a0259096635e186b"},
- {file = "scipy-1.17.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:dbf133ced83889583156566d2bdf7a07ff89228fe0c0cb727f777de92092ec6b"},
- {file = "scipy-1.17.0-cp314-cp314-win_amd64.whl", hash = "sha256:3625c631a7acd7cfd929e4e31d2582cf00f42fcf06011f59281271746d77e061"},
- {file = "scipy-1.17.0-cp314-cp314-win_arm64.whl", hash = "sha256:9244608d27eafe02b20558523ba57f15c689357c85bdcfe920b1828750aa26eb"},
- {file = "scipy-1.17.0-cp314-cp314t-macosx_10_14_x86_64.whl", hash = "sha256:2b531f57e09c946f56ad0b4a3b2abee778789097871fc541e267d2eca081cff1"},
- {file = "scipy-1.17.0-cp314-cp314t-macosx_12_0_arm64.whl", hash = "sha256:13e861634a2c480bd237deb69333ac79ea1941b94568d4b0efa5db5e263d4fd1"},
- {file = "scipy-1.17.0-cp314-cp314t-macosx_14_0_arm64.whl", hash = "sha256:eb2651271135154aa24f6481cbae5cc8af1f0dd46e6533fb7b56aa9727b6a232"},
- {file = "scipy-1.17.0-cp314-cp314t-macosx_14_0_x86_64.whl", hash = "sha256:c5e8647f60679790c2f5c76be17e2e9247dc6b98ad0d3b065861e082c56e078d"},
- {file = "scipy-1.17.0-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5fb10d17e649e1446410895639f3385fd2bf4c3c7dfc9bea937bddcbc3d7b9ba"},
- {file = "scipy-1.17.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8547e7c57f932e7354a2319fab613981cde910631979f74c9b542bb167a8b9db"},
- {file = "scipy-1.17.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:33af70d040e8af9d5e7a38b5ed3b772adddd281e3062ff23fec49e49681c38cf"},
- {file = "scipy-1.17.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:f9eb55bb97d00f8b7ab95cb64f873eb0bf54d9446264d9f3609130381233483f"},
- {file = "scipy-1.17.0-cp314-cp314t-win_amd64.whl", hash = "sha256:1ff269abf702f6c7e67a4b7aad981d42871a11b9dd83c58d2d2ea624efbd1088"},
- {file = "scipy-1.17.0-cp314-cp314t-win_arm64.whl", hash = "sha256:031121914e295d9791319a1875444d55079885bbae5bdc9c5e0f2ee5f09d34ff"},
- {file = "scipy-1.17.0.tar.gz", hash = "sha256:2591060c8e648d8b96439e111ac41fd8342fdeff1876be2e19dea3fe8930454e"},
+ {file = "scipy-1.17.1-cp311-cp311-macosx_10_14_x86_64.whl", hash = "sha256:1f95b894f13729334fb990162e911c9e5dc1ab390c58aa6cbecb389c5b5e28ec"},
+ {file = "scipy-1.17.1-cp311-cp311-macosx_12_0_arm64.whl", hash = "sha256:e18f12c6b0bc5a592ed23d3f7b891f68fd7f8241d69b7883769eb5d5dfb52696"},
+ {file = "scipy-1.17.1-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:a3472cfbca0a54177d0faa68f697d8ba4c80bbdc19908c3465556d9f7efce9ee"},
+ {file = "scipy-1.17.1-cp311-cp311-macosx_14_0_x86_64.whl", hash = "sha256:766e0dc5a616d026a3a1cffa379af959671729083882f50307e18175797b3dfd"},
+ {file = "scipy-1.17.1-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:744b2bf3640d907b79f3fd7874efe432d1cf171ee721243e350f55234b4cec4c"},
+ {file = "scipy-1.17.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:43af8d1f3bea642559019edfe64e9b11192a8978efbd1539d7bc2aaa23d92de4"},
+ {file = "scipy-1.17.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:cd96a1898c0a47be4520327e01f874acfd61fb48a9420f8aa9f6483412ffa444"},
+ {file = "scipy-1.17.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:4eb6c25dd62ee8d5edf68a8e1c171dd71c292fdae95d8aeb3dd7d7de4c364082"},
+ {file = "scipy-1.17.1-cp311-cp311-win_amd64.whl", hash = "sha256:d30e57c72013c2a4fe441c2fcb8e77b14e152ad48b5464858e07e2ad9fbfceff"},
+ {file = "scipy-1.17.1-cp311-cp311-win_arm64.whl", hash = "sha256:9ecb4efb1cd6e8c4afea0daa91a87fbddbce1b99d2895d151596716c0b2e859d"},
+ {file = "scipy-1.17.1-cp312-cp312-macosx_10_14_x86_64.whl", hash = "sha256:35c3a56d2ef83efc372eaec584314bd0ef2e2f0d2adb21c55e6ad5b344c0dcb8"},
+ {file = "scipy-1.17.1-cp312-cp312-macosx_12_0_arm64.whl", hash = "sha256:fcb310ddb270a06114bb64bbe53c94926b943f5b7f0842194d585c65eb4edd76"},
+ {file = "scipy-1.17.1-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:cc90d2e9c7e5c7f1a482c9875007c095c3194b1cfedca3c2f3291cdc2bc7c086"},
+ {file = "scipy-1.17.1-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:c80be5ede8f3f8eded4eff73cc99a25c388ce98e555b17d31da05287015ffa5b"},
+ {file = "scipy-1.17.1-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e19ebea31758fac5893a2ac360fedd00116cbb7628e650842a6691ba7ca28a21"},
+ {file = "scipy-1.17.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:02ae3b274fde71c5e92ac4d54bc06c42d80e399fec704383dcd99b301df37458"},
+ {file = "scipy-1.17.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:8a604bae87c6195d8b1045eddece0514d041604b14f2727bbc2b3020172045eb"},
+ {file = "scipy-1.17.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:f590cd684941912d10becc07325a3eeb77886fe981415660d9265c4c418d0bea"},
+ {file = "scipy-1.17.1-cp312-cp312-win_amd64.whl", hash = "sha256:41b71f4a3a4cab9d366cd9065b288efc4d4f3c0b37a91a8e0947fb5bd7f31d87"},
+ {file = "scipy-1.17.1-cp312-cp312-win_arm64.whl", hash = "sha256:f4115102802df98b2b0db3cce5cb9b92572633a1197c77b7553e5203f284a5b3"},
+ {file = "scipy-1.17.1-cp313-cp313-macosx_10_14_x86_64.whl", hash = "sha256:5e3c5c011904115f88a39308379c17f91546f77c1667cea98739fe0fccea804c"},
+ {file = "scipy-1.17.1-cp313-cp313-macosx_12_0_arm64.whl", hash = "sha256:6fac755ca3d2c3edcb22f479fceaa241704111414831ddd3bc6056e18516892f"},
+ {file = "scipy-1.17.1-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:7ff200bf9d24f2e4d5dc6ee8c3ac64d739d3a89e2326ba68aaf6c4a2b838fd7d"},
+ {file = "scipy-1.17.1-cp313-cp313-macosx_14_0_x86_64.whl", hash = "sha256:4b400bdc6f79fa02a4d86640310dde87a21fba0c979efff5248908c6f15fad1b"},
+ {file = "scipy-1.17.1-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:2b64ca7d4aee0102a97f3ba22124052b4bd2152522355073580bf4845e2550b6"},
+ {file = "scipy-1.17.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:581b2264fc0aa555f3f435a5944da7504ea3a065d7029ad60e7c3d1ae09c5464"},
+ {file = "scipy-1.17.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:beeda3d4ae615106d7094f7e7cef6218392e4465cc95d25f900bebabfded0950"},
+ {file = "scipy-1.17.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:6609bc224e9568f65064cfa72edc0f24ee6655b47575954ec6339534b2798369"},
+ {file = "scipy-1.17.1-cp313-cp313-win_amd64.whl", hash = "sha256:37425bc9175607b0268f493d79a292c39f9d001a357bebb6b88fdfaff13f6448"},
+ {file = "scipy-1.17.1-cp313-cp313-win_arm64.whl", hash = "sha256:5cf36e801231b6a2059bf354720274b7558746f3b1a4efb43fcf557ccd484a87"},
+ {file = "scipy-1.17.1-cp313-cp313t-macosx_10_14_x86_64.whl", hash = "sha256:d59c30000a16d8edc7e64152e30220bfbd724c9bbb08368c054e24c651314f0a"},
+ {file = "scipy-1.17.1-cp313-cp313t-macosx_12_0_arm64.whl", hash = "sha256:010f4333c96c9bb1a4516269e33cb5917b08ef2166d5556ca2fd9f082a9e6ea0"},
+ {file = "scipy-1.17.1-cp313-cp313t-macosx_14_0_arm64.whl", hash = "sha256:2ceb2d3e01c5f1d83c4189737a42d9cb2fc38a6eeed225e7515eef71ad301dce"},
+ {file = "scipy-1.17.1-cp313-cp313t-macosx_14_0_x86_64.whl", hash = "sha256:844e165636711ef41f80b4103ed234181646b98a53c8f05da12ca5ca289134f6"},
+ {file = "scipy-1.17.1-cp313-cp313t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:158dd96d2207e21c966063e1635b1063cd7787b627b6f07305315dd73d9c679e"},
+ {file = "scipy-1.17.1-cp313-cp313t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:74cbb80d93260fe2ffa334efa24cb8f2f0f622a9b9febf8b483c0b865bfb3475"},
+ {file = "scipy-1.17.1-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:dbc12c9f3d185f5c737d801da555fb74b3dcfa1a50b66a1a93e09190f41fab50"},
+ {file = "scipy-1.17.1-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:94055a11dfebe37c656e70317e1996dc197e1a15bbcc351bcdd4610e128fe1ca"},
+ {file = "scipy-1.17.1-cp313-cp313t-win_amd64.whl", hash = "sha256:e30bdeaa5deed6bc27b4cc490823cd0347d7dae09119b8803ae576ea0ce52e4c"},
+ {file = "scipy-1.17.1-cp313-cp313t-win_arm64.whl", hash = "sha256:a720477885a9d2411f94a93d16f9d89bad0f28ca23c3f8daa521e2dcc3f44d49"},
+ {file = "scipy-1.17.1-cp314-cp314-macosx_10_14_x86_64.whl", hash = "sha256:a48a72c77a310327f6a3a920092fa2b8fd03d7deaa60f093038f22d98e096717"},
+ {file = "scipy-1.17.1-cp314-cp314-macosx_12_0_arm64.whl", hash = "sha256:45abad819184f07240d8a696117a7aacd39787af9e0b719d00285549ed19a1e9"},
+ {file = "scipy-1.17.1-cp314-cp314-macosx_14_0_arm64.whl", hash = "sha256:3fd1fcdab3ea951b610dc4cef356d416d5802991e7e32b5254828d342f7b7e0b"},
+ {file = "scipy-1.17.1-cp314-cp314-macosx_14_0_x86_64.whl", hash = "sha256:7bdf2da170b67fdf10bca777614b1c7d96ae3ca5794fd9587dce41eb2966e866"},
+ {file = "scipy-1.17.1-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:adb2642e060a6549c343603a3851ba76ef0b74cc8c079a9a58121c7ec9fe2350"},
+ {file = "scipy-1.17.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:eee2cfda04c00a857206a4330f0c5e3e56535494e30ca445eb19ec624ae75118"},
+ {file = "scipy-1.17.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:d2650c1fb97e184d12d8ba010493ee7b322864f7d3d00d3f9bb97d9c21de4068"},
+ {file = "scipy-1.17.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:08b900519463543aa604a06bec02461558a6e1cef8fdbb8098f77a48a83c8118"},
+ {file = "scipy-1.17.1-cp314-cp314-win_amd64.whl", hash = "sha256:3877ac408e14da24a6196de0ddcace62092bfc12a83823e92e49e40747e52c19"},
+ {file = "scipy-1.17.1-cp314-cp314-win_arm64.whl", hash = "sha256:f8885db0bc2bffa59d5c1b72fad7a6a92d3e80e7257f967dd81abb553a90d293"},
+ {file = "scipy-1.17.1-cp314-cp314t-macosx_10_14_x86_64.whl", hash = "sha256:1cc682cea2ae55524432f3cdff9e9a3be743d52a7443d0cba9017c23c87ae2f6"},
+ {file = "scipy-1.17.1-cp314-cp314t-macosx_12_0_arm64.whl", hash = "sha256:2040ad4d1795a0ae89bfc7e8429677f365d45aa9fd5e4587cf1ea737f927b4a1"},
+ {file = "scipy-1.17.1-cp314-cp314t-macosx_14_0_arm64.whl", hash = "sha256:131f5aaea57602008f9822e2115029b55d4b5f7c070287699fe45c661d051e39"},
+ {file = "scipy-1.17.1-cp314-cp314t-macosx_14_0_x86_64.whl", hash = "sha256:9cdc1a2fcfd5c52cfb3045feb399f7b3ce822abdde3a193a6b9a60b3cb5854ca"},
+ {file = "scipy-1.17.1-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6e3dcd57ab780c741fde8dc68619de988b966db759a3c3152e8e9142c26295ad"},
+ {file = "scipy-1.17.1-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a9956e4d4f4a301ebf6cde39850333a6b6110799d470dbbb1e25326ac447f52a"},
+ {file = "scipy-1.17.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:a4328d245944d09fd639771de275701ccadf5f781ba0ff092ad141e017eccda4"},
+ {file = "scipy-1.17.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:a77cbd07b940d326d39a1d1b37817e2ee4d79cb30e7338f3d0cddffae70fcaa2"},
+ {file = "scipy-1.17.1-cp314-cp314t-win_amd64.whl", hash = "sha256:eb092099205ef62cd1782b006658db09e2fed75bffcae7cc0d44052d8aa0f484"},
+ {file = "scipy-1.17.1-cp314-cp314t-win_arm64.whl", hash = "sha256:200e1050faffacc162be6a486a984a0497866ec54149a01270adc8a59b7c7d21"},
+ {file = "scipy-1.17.1.tar.gz", hash = "sha256:95d8e012d8cb8816c226aef832200b1d45109ed4464303e997c5b13122b297c0"},
]
[[package]]
@@ -5196,7 +5478,7 @@ name = "shellingham"
version = "1.5.4"
requires_python = ">=3.7"
summary = "Tool to Detect Surrounding Shell"
-groups = ["default"]
+groups = ["default", "mcp"]
files = [
{file = "shellingham-1.5.4-py2.py3-none-any.whl", hash = "sha256:7ecfff8f2fd72616f7481040475a65b2bf8af90a56c89140852d1120324e8686"},
{file = "shellingham-1.5.4.tar.gz", hash = "sha256:8dbca0739d487e5bd35ab3ca4b36e11c4078f3a234bfce294b0a0291363404de"},
@@ -5311,7 +5593,7 @@ files = [
[[package]]
name = "sqlalchemy"
-version = "2.0.46"
+version = "2.0.48"
requires_python = ">=3.7"
summary = "Database Abstraction Library"
groups = ["default", "dev"]
@@ -5321,44 +5603,48 @@ dependencies = [
"typing-extensions>=4.6.0",
]
files = [
- {file = "sqlalchemy-2.0.46-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:261c4b1f101b4a411154f1da2b76497d73abbfc42740029205d4d01fa1052684"},
- {file = "sqlalchemy-2.0.46-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:181903fe8c1b9082995325f1b2e84ac078b1189e2819380c2303a5f90e114a62"},
- {file = "sqlalchemy-2.0.46-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:590be24e20e2424a4c3c1b0835e9405fa3d0af5823a1a9fc02e5dff56471515f"},
- {file = "sqlalchemy-2.0.46-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:7568fe771f974abadce52669ef3a03150ff03186d8eb82613bc8adc435a03f01"},
- {file = "sqlalchemy-2.0.46-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:ebf7e1e78af38047e08836d33502c7a278915698b7c2145d045f780201679999"},
- {file = "sqlalchemy-2.0.46-cp311-cp311-win32.whl", hash = "sha256:9d80ea2ac519c364a7286e8d765d6cd08648f5b21ca855a8017d9871f075542d"},
- {file = "sqlalchemy-2.0.46-cp311-cp311-win_amd64.whl", hash = "sha256:585af6afe518732d9ccd3aea33af2edaae4a7aa881af5d8f6f4fe3a368699597"},
- {file = "sqlalchemy-2.0.46-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:3a9a72b0da8387f15d5810f1facca8f879de9b85af8c645138cba61ea147968c"},
- {file = "sqlalchemy-2.0.46-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:2347c3f0efc4de367ba00218e0ae5c4ba2306e47216ef80d6e31761ac97cb0b9"},
- {file = "sqlalchemy-2.0.46-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9094c8b3197db12aa6f05c51c05daaad0a92b8c9af5388569847b03b1007fb1b"},
- {file = "sqlalchemy-2.0.46-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:37fee2164cf21417478b6a906adc1a91d69ae9aba8f9533e67ce882f4bb1de53"},
- {file = "sqlalchemy-2.0.46-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:b1e14b2f6965a685c7128bd315e27387205429c2e339eeec55cb75ca4ab0ea2e"},
- {file = "sqlalchemy-2.0.46-cp312-cp312-win32.whl", hash = "sha256:412f26bb4ba942d52016edc8d12fb15d91d3cd46b0047ba46e424213ad407bcb"},
- {file = "sqlalchemy-2.0.46-cp312-cp312-win_amd64.whl", hash = "sha256:ea3cd46b6713a10216323cda3333514944e510aa691c945334713fca6b5279ff"},
- {file = "sqlalchemy-2.0.46-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:93a12da97cca70cea10d4b4fc602589c4511f96c1f8f6c11817620c021d21d00"},
- {file = "sqlalchemy-2.0.46-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:af865c18752d416798dae13f83f38927c52f085c52e2f32b8ab0fef46fdd02c2"},
- {file = "sqlalchemy-2.0.46-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8d679b5f318423eacb61f933a9a0f75535bfca7056daeadbf6bd5bcee6183aee"},
- {file = "sqlalchemy-2.0.46-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:64901e08c33462acc9ec3bad27fc7a5c2b6491665f2aa57564e57a4f5d7c52ad"},
- {file = "sqlalchemy-2.0.46-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:e8ac45e8f4eaac0f9f8043ea0e224158855c6a4329fd4ee37c45c61e3beb518e"},
- {file = "sqlalchemy-2.0.46-cp313-cp313-win32.whl", hash = "sha256:8d3b44b3d0ab2f1319d71d9863d76eeb46766f8cf9e921ac293511804d39813f"},
- {file = "sqlalchemy-2.0.46-cp313-cp313-win_amd64.whl", hash = "sha256:77f8071d8fbcbb2dd11b7fd40dedd04e8ebe2eb80497916efedba844298065ef"},
- {file = "sqlalchemy-2.0.46-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a1e8cc6cc01da346dc92d9509a63033b9b1bda4fed7a7a7807ed385c7dccdc10"},
- {file = "sqlalchemy-2.0.46-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:96c7cca1a4babaaf3bfff3e4e606e38578856917e52f0384635a95b226c87764"},
- {file = "sqlalchemy-2.0.46-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:b2a9f9aee38039cf4755891a1e50e1effcc42ea6ba053743f452c372c3152b1b"},
- {file = "sqlalchemy-2.0.46-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:db23b1bf8cfe1f7fda19018e7207b20cdb5168f83c437ff7e95d19e39289c447"},
- {file = "sqlalchemy-2.0.46-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:56bdd261bfd0895452006d5316cbf35739c53b9bb71a170a331fa0ea560b2ada"},
- {file = "sqlalchemy-2.0.46-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:33e462154edb9493f6c3ad2125931e273bbd0be8ae53f3ecd1c161ea9a1dd366"},
- {file = "sqlalchemy-2.0.46-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9bcdce05f056622a632f1d44bb47dbdb677f58cad393612280406ce37530eb6d"},
- {file = "sqlalchemy-2.0.46-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:8e84b09a9b0f19accedcbeff5c2caf36e0dd537341a33aad8d680336152dc34e"},
- {file = "sqlalchemy-2.0.46-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:4f52f7291a92381e9b4de9050b0a65ce5d6a763333406861e33906b8aa4906bf"},
- {file = "sqlalchemy-2.0.46-cp314-cp314-win32.whl", hash = "sha256:70ed2830b169a9960193f4d4322d22be5c0925357d82cbf485b3369893350908"},
- {file = "sqlalchemy-2.0.46-cp314-cp314-win_amd64.whl", hash = "sha256:3c32e993bc57be6d177f7d5d31edb93f30726d798ad86ff9066d75d9bf2e0b6b"},
- {file = "sqlalchemy-2.0.46-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4dafb537740eef640c4d6a7c254611dca2df87eaf6d14d6a5fca9d1f4c3fc0fa"},
- {file = "sqlalchemy-2.0.46-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:42a1643dc5427b69aca967dae540a90b0fbf57eaf248f13a90ea5930e0966863"},
- {file = "sqlalchemy-2.0.46-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:ff33c6e6ad006bbc0f34f5faf941cfc62c45841c64c0a058ac38c799f15b5ede"},
- {file = "sqlalchemy-2.0.46-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:82ec52100ec1e6ec671563bbd02d7c7c8d0b9e71a0723c72f22ecf52d1755330"},
- {file = "sqlalchemy-2.0.46-py3-none-any.whl", hash = "sha256:f9c11766e7e7c0a2767dda5acb006a118640c9fc0a4104214b96269bfb78399e"},
- {file = "sqlalchemy-2.0.46.tar.gz", hash = "sha256:cf36851ee7219c170bb0793dbc3da3e80c582e04a5437bc601bfe8c85c9216d7"},
+ {file = "sqlalchemy-2.0.48-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:1b4c575df7368b3b13e0cebf01d4679f9a28ed2ae6c1cd0b1d5beffb6b2007dc"},
+ {file = "sqlalchemy-2.0.48-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e83e3f959aaa1c9df95c22c528096d94848a1bc819f5d0ebf7ee3df0ca63db6c"},
+ {file = "sqlalchemy-2.0.48-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6f7b7243850edd0b8b97043f04748f31de50cf426e939def5c16bedb540698f7"},
+ {file = "sqlalchemy-2.0.48-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:82745b03b4043e04600a6b665cb98697c4339b24e34d74b0a2ac0a2488b6f94d"},
+ {file = "sqlalchemy-2.0.48-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:e5e088bf43f6ee6fec7dbf1ef7ff7774a616c236b5c0cb3e00662dd71a56b571"},
+ {file = "sqlalchemy-2.0.48-cp311-cp311-win32.whl", hash = "sha256:9c7d0a77e36b5f4b01ca398482230ab792061d243d715299b44a0b55c89fe617"},
+ {file = "sqlalchemy-2.0.48-cp311-cp311-win_amd64.whl", hash = "sha256:583849c743e0e3c9bb7446f5b5addeacedc168d657a69b418063dfdb2d90081c"},
+ {file = "sqlalchemy-2.0.48-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:348174f228b99f33ca1f773e85510e08927620caa59ffe7803b37170df30332b"},
+ {file = "sqlalchemy-2.0.48-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:53667b5f668991e279d21f94ccfa6e45b4e3f4500e7591ae59a8012d0f010dcb"},
+ {file = "sqlalchemy-2.0.48-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:34634e196f620c7a61d18d5cf7dc841ca6daa7961aed75d532b7e58b309ac894"},
+ {file = "sqlalchemy-2.0.48-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:546572a1793cc35857a2ffa1fe0e58571af1779bcc1ffa7c9fb0839885ed69a9"},
+ {file = "sqlalchemy-2.0.48-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:07edba08061bc277bfdc772dd2a1a43978f5a45994dd3ede26391b405c15221e"},
+ {file = "sqlalchemy-2.0.48-cp312-cp312-win32.whl", hash = "sha256:908a3fa6908716f803b86896a09a2c4dde5f5ce2bb07aacc71ffebb57986ce99"},
+ {file = "sqlalchemy-2.0.48-cp312-cp312-win_amd64.whl", hash = "sha256:68549c403f79a8e25984376480959975212a670405e3913830614432b5daa07a"},
+ {file = "sqlalchemy-2.0.48-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:e3070c03701037aa418b55d36532ecb8f8446ed0135acb71c678dbdf12f5b6e4"},
+ {file = "sqlalchemy-2.0.48-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:2645b7d8a738763b664a12a1542c89c940daa55196e8d73e55b169cc5c99f65f"},
+ {file = "sqlalchemy-2.0.48-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b19151e76620a412c2ac1c6f977ab1b9fa7ad43140178345136456d5265b32ed"},
+ {file = "sqlalchemy-2.0.48-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:5b193a7e29fd9fa56e502920dca47dffe60f97c863494946bd698c6058a55658"},
+ {file = "sqlalchemy-2.0.48-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:36ac4ddc3d33e852da9cb00ffb08cea62ca05c39711dc67062ca2bb1fae35fd8"},
+ {file = "sqlalchemy-2.0.48-cp313-cp313-win32.whl", hash = "sha256:389b984139278f97757ea9b08993e7b9d1142912e046ab7d82b3fbaeb0209131"},
+ {file = "sqlalchemy-2.0.48-cp313-cp313-win_amd64.whl", hash = "sha256:d612c976cbc2d17edfcc4c006874b764e85e990c29ce9bd411f926bbfb02b9a2"},
+ {file = "sqlalchemy-2.0.48-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:69f5bc24904d3bc3640961cddd2523e361257ef68585d6e364166dfbe8c78fae"},
+ {file = "sqlalchemy-2.0.48-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:fd08b90d211c086181caed76931ecfa2bdfc83eea3cfccdb0f82abc6c4b876cb"},
+ {file = "sqlalchemy-2.0.48-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:1ccd42229aaac2df431562117ac7e667d702e8e44afdb6cf0e50fa3f18160f0b"},
+ {file = "sqlalchemy-2.0.48-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:f0dcbc588cd5b725162c076eb9119342f6579c7f7f55057bb7e3c6ff27e13121"},
+ {file = "sqlalchemy-2.0.48-cp313-cp313t-win32.whl", hash = "sha256:9764014ef5e58aab76220c5664abb5d47d5bc858d9debf821e55cfdd0f128485"},
+ {file = "sqlalchemy-2.0.48-cp313-cp313t-win_amd64.whl", hash = "sha256:e2f35b4cccd9ed286ad62e0a3c3ac21e06c02abc60e20aa51a3e305a30f5fa79"},
+ {file = "sqlalchemy-2.0.48-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:e2d0d88686e3d35a76f3e15a34e8c12d73fc94c1dea1cd55782e695cc14086dd"},
+ {file = "sqlalchemy-2.0.48-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:49b7bddc1eebf011ea5ab722fdbe67a401caa34a350d278cc7733c0e88fecb1f"},
+ {file = "sqlalchemy-2.0.48-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:426c5ca86415d9b8945c7073597e10de9644802e2ff502b8e1f11a7a2642856b"},
+ {file = "sqlalchemy-2.0.48-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:288937433bd44e3990e7da2402fabc44a3c6c25d3704da066b85b89a85474ae0"},
+ {file = "sqlalchemy-2.0.48-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:8183dc57ae7d9edc1346e007e840a9f3d6aa7b7f165203a99e16f447150140d2"},
+ {file = "sqlalchemy-2.0.48-cp314-cp314-win32.whl", hash = "sha256:1182437cb2d97988cfea04cf6cdc0b0bb9c74f4d56ec3d08b81e23d621a28cc6"},
+ {file = "sqlalchemy-2.0.48-cp314-cp314-win_amd64.whl", hash = "sha256:144921da96c08feb9e2b052c5c5c1d0d151a292c6135623c6b2c041f2a45f9e0"},
+ {file = "sqlalchemy-2.0.48-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5aee45fd2c6c0f2b9cdddf48c48535e7471e42d6fb81adfde801da0bd5b93241"},
+ {file = "sqlalchemy-2.0.48-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7cddca31edf8b0653090cbb54562ca027c421c58ddde2c0685f49ff56a1690e0"},
+ {file = "sqlalchemy-2.0.48-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:7a936f1bb23d370b7c8cc079d5fce4c7d18da87a33c6744e51a93b0f9e97e9b3"},
+ {file = "sqlalchemy-2.0.48-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:e004aa9248e8cb0a5f9b96d003ca7c1c0a5da8decd1066e7b53f59eb8ce7c62b"},
+ {file = "sqlalchemy-2.0.48-cp314-cp314t-win32.whl", hash = "sha256:b8438ec5594980d405251451c5b7ea9aa58dda38eb7ac35fb7e4c696712ee24f"},
+ {file = "sqlalchemy-2.0.48-cp314-cp314t-win_amd64.whl", hash = "sha256:d854b3970067297f3a7fbd7a4683587134aa9b3877ee15aa29eea478dc68f933"},
+ {file = "sqlalchemy-2.0.48-py3-none-any.whl", hash = "sha256:a66fe406437dd65cacd96a72689a3aaaecaebbcd62d81c5ac1c0fdbeac835096"},
+ {file = "sqlalchemy-2.0.48.tar.gz", hash = "sha256:5ca74f37f3369b45e1f6b7b06afb182af1fd5dde009e4ffd831830d98cbe5fe7"},
]
[[package]]
@@ -5454,6 +5740,36 @@ files = [
{file = "sqlcipher3_binary-0.6.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:f9bccb9e942a04bbf920714940c8f9e00134cd655b11ba4c6f1306bcc3504d6c"},
]
+[[package]]
+name = "sse-starlette"
+version = "3.3.2"
+requires_python = ">=3.10"
+summary = "SSE plugin for Starlette"
+groups = ["mcp"]
+dependencies = [
+ "anyio>=4.7.0",
+ "starlette>=0.49.1",
+]
+files = [
+ {file = "sse_starlette-3.3.2-py3-none-any.whl", hash = "sha256:5c3ea3dad425c601236726af2f27689b74494643f57017cafcb6f8c9acfbb862"},
+ {file = "sse_starlette-3.3.2.tar.gz", hash = "sha256:678fca55a1945c734d8472a6cad186a55ab02840b4f6786f5ee8770970579dcd"},
+]
+
+[[package]]
+name = "starlette"
+version = "0.52.1"
+requires_python = ">=3.10"
+summary = "The little ASGI library that shines."
+groups = ["mcp"]
+dependencies = [
+ "anyio<5,>=3.6.2",
+ "typing-extensions>=4.10.0; python_version < \"3.13\"",
+]
+files = [
+ {file = "starlette-0.52.1-py3-none-any.whl", hash = "sha256:0029d43eb3d273bc4f83a08720b4912ea4b071087a3b48db01b7c839f7954d74"},
+ {file = "starlette-0.52.1.tar.gz", hash = "sha256:834edd1b0a23167694292e94f597773bc3f89f362be6effee198165a35d62933"},
+]
+
[[package]]
name = "sympy"
version = "1.14.0"
@@ -5703,7 +6019,7 @@ files = [
[[package]]
name = "transformers"
-version = "5.2.0"
+version = "5.3.0"
requires_python = ">=3.10.0"
summary = "Transformers: the model-definition framework for state-of-the-art machine learning models in text, vision, audio, and multimodal models, for both inference and training."
groups = ["default"]
@@ -5716,11 +6032,11 @@ dependencies = [
"safetensors>=0.4.3",
"tokenizers<=0.23.0,>=0.22.0",
"tqdm>=4.27",
- "typer-slim",
+ "typer",
]
files = [
- {file = "transformers-5.2.0-py3-none-any.whl", hash = "sha256:9ecaf243dc45bee11a7d93f8caf03746accc0cb069181bbf4ad8566c53e854b4"},
- {file = "transformers-5.2.0.tar.gz", hash = "sha256:0088b8b46ccc9eff1a1dca72b5d618a5ee3b1befc3e418c9512b35dea9f9a650"},
+ {file = "transformers-5.3.0-py3-none-any.whl", hash = "sha256:50ac8c89c3c7033444fb3f9f53138096b997ebb70d4b5e50a2e810bf12d3d29a"},
+ {file = "transformers-5.3.0.tar.gz", hash = "sha256:009555b364029da9e2946d41f1c5de9f15e6b1df46b189b7293f33a161b9c557"},
]
[[package]]
@@ -5728,7 +6044,7 @@ name = "typer"
version = "0.24.1"
requires_python = ">=3.10"
summary = "Typer, build great CLIs. Easy to code. Based on Python type hints."
-groups = ["default"]
+groups = ["default", "mcp"]
dependencies = [
"annotated-doc>=0.0.2",
"click>=8.2.1",
@@ -5740,20 +6056,6 @@ files = [
{file = "typer-0.24.1.tar.gz", hash = "sha256:e39b4732d65fbdcde189ae76cf7cd48aeae72919dea1fdfc16593be016256b45"},
]
-[[package]]
-name = "typer-slim"
-version = "0.24.0"
-requires_python = ">=3.10"
-summary = "Typer, build great CLIs. Easy to code. Based on Python type hints."
-groups = ["default"]
-dependencies = [
- "typer>=0.24.0",
-]
-files = [
- {file = "typer_slim-0.24.0-py3-none-any.whl", hash = "sha256:d5d7ee1ee2834d5020c7c616ed5e0d0f29b9a4b1dd283bdebae198ec09778d0e"},
- {file = "typer_slim-0.24.0.tar.gz", hash = "sha256:f0ed36127183f52ae6ced2ecb2521789995992c521a46083bfcdbb652d22ad34"},
-]
-
[[package]]
name = "types-click"
version = "7.1.8"
@@ -5853,7 +6155,7 @@ name = "typing-extensions"
version = "4.15.0"
requires_python = ">=3.9"
summary = "Backported and Experimental Type Hints for Python 3.9+"
-groups = ["default", "dev"]
+groups = ["default", "dev", "mcp"]
files = [
{file = "typing_extensions-4.15.0-py3-none-any.whl", hash = "sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548"},
{file = "typing_extensions-4.15.0.tar.gz", hash = "sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466"},
@@ -5879,7 +6181,7 @@ name = "typing-inspection"
version = "0.4.2"
requires_python = ">=3.9"
summary = "Runtime typing introspection tools"
-groups = ["default"]
+groups = ["default", "mcp"]
dependencies = [
"typing-extensions>=4.12.0",
]
@@ -5894,7 +6196,7 @@ version = "2025.3"
requires_python = ">=2"
summary = "Provider of IANA time zone data"
groups = ["default", "dev"]
-marker = "sys_platform == \"emscripten\" or sys_platform == \"win32\" or platform_system == \"Windows\" or python_version >= \"3.9\""
+marker = "sys_platform == \"win32\" or sys_platform == \"emscripten\" or platform_system == \"Windows\" or python_version >= \"3.9\""
files = [
{file = "tzdata-2025.3-py2.py3-none-any.whl", hash = "sha256:06a47e5700f3081aab02b2e513160914ff0694bce9947d6b76ebd6bf57cfc5d1"},
{file = "tzdata-2025.3.tar.gz", hash = "sha256:de39c2ca5dc7b0344f2eba86f49d614019d29f060fc4ebc8a417896a620b56a7"},
@@ -6012,9 +6314,26 @@ files = [
{file = "uuid_utils-0.14.1.tar.gz", hash = "sha256:9bfc95f64af80ccf129c604fb6b8ca66c6f256451e32bc4570f760e4309c9b69"},
]
+[[package]]
+name = "uvicorn"
+version = "0.41.0"
+requires_python = ">=3.10"
+summary = "The lightning-fast ASGI server."
+groups = ["mcp"]
+marker = "sys_platform != \"emscripten\""
+dependencies = [
+ "click>=7.0",
+ "h11>=0.8",
+ "typing-extensions>=4.0; python_version < \"3.11\"",
+]
+files = [
+ {file = "uvicorn-0.41.0-py3-none-any.whl", hash = "sha256:29e35b1d2c36a04b9e180d4007ede3bcb32a85fbdfd6c6aeb3f26839de088187"},
+ {file = "uvicorn-0.41.0.tar.gz", hash = "sha256:09d11cf7008da33113824ee5a1c6422d89fbc2ff476540d69a34c87fab8b571a"},
+]
+
[[package]]
name = "virtualenv"
-version = "20.38.0"
+version = "20.39.1"
requires_python = ">=3.8"
summary = "Virtual Python Environment builder"
groups = ["dev"]
@@ -6027,22 +6346,22 @@ dependencies = [
"typing-extensions>=4.13.2; python_version < \"3.11\"",
]
files = [
- {file = "virtualenv-20.38.0-py3-none-any.whl", hash = "sha256:d6e78e5889de3a4742df2d3d44e779366325a90cf356f15621fddace82431794"},
- {file = "virtualenv-20.38.0.tar.gz", hash = "sha256:94f39b1abaea5185bf7ea5a46702b56f1d0c9aa2f41a6c2b8b0af4ddc74c10a7"},
+ {file = "virtualenv-20.39.1-py3-none-any.whl", hash = "sha256:a00332e0b089ba64edefbf94ef34e6db33f45fe5184df0652cf0b754dcd36190"},
+ {file = "virtualenv-20.39.1.tar.gz", hash = "sha256:c551ea1072d7717a273dd9a4a0adad8f45571af134b0f63a12430e85f6ac1c08"},
]
[[package]]
name = "vulture"
-version = "2.14"
-requires_python = ">=3.8"
+version = "2.15"
+requires_python = ">=3.9"
summary = "Find dead code"
groups = ["dev"]
dependencies = [
"tomli>=1.1.0; python_version < \"3.11\"",
]
files = [
- {file = "vulture-2.14-py2.py3-none-any.whl", hash = "sha256:d9a90dba89607489548a49d557f8bac8112bd25d3cbc8aeef23e860811bd5ed9"},
- {file = "vulture-2.14.tar.gz", hash = "sha256:cb8277902a1138deeab796ec5bef7076a6e0248ca3607a3f3dee0b6d9e9b8415"},
+ {file = "vulture-2.15-py3-none-any.whl", hash = "sha256:a3d8ebef918694326620eb128fa783486c8d285b23381c2b457d864ac056ef8d"},
+ {file = "vulture-2.15.tar.gz", hash = "sha256:f9d8b4ce29c69950d323f21dceab4a4d6c694403dffbed7713c4691057e561fe"},
]
[[package]]
@@ -6341,8 +6660,8 @@ files = [
[[package]]
name = "yarl"
-version = "1.22.0"
-requires_python = ">=3.9"
+version = "1.23.0"
+requires_python = ">=3.10"
summary = "Yet another URL library"
groups = ["default"]
dependencies = [
@@ -6351,104 +6670,116 @@ dependencies = [
"propcache>=0.2.1",
]
files = [
- {file = "yarl-1.22.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:1ab72135b1f2db3fed3997d7e7dc1b80573c67138023852b6efb336a5eae6511"},
- {file = "yarl-1.22.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:669930400e375570189492dc8d8341301578e8493aec04aebc20d4717f899dd6"},
- {file = "yarl-1.22.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:792a2af6d58177ef7c19cbf0097aba92ca1b9cb3ffdd9c7470e156c8f9b5e028"},
- {file = "yarl-1.22.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:3ea66b1c11c9150f1372f69afb6b8116f2dd7286f38e14ea71a44eee9ec51b9d"},
- {file = "yarl-1.22.0-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:3e2daa88dc91870215961e96a039ec73e4937da13cf77ce17f9cad0c18df3503"},
- {file = "yarl-1.22.0-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:ba440ae430c00eee41509353628600212112cd5018d5def7e9b05ea7ac34eb65"},
- {file = "yarl-1.22.0-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:e6438cc8f23a9c1478633d216b16104a586b9761db62bfacb6425bac0a36679e"},
- {file = "yarl-1.22.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4c52a6e78aef5cf47a98ef8e934755abf53953379b7d53e68b15ff4420e6683d"},
- {file = "yarl-1.22.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:3b06bcadaac49c70f4c88af4ffcfbe3dc155aab3163e75777818092478bcbbe7"},
- {file = "yarl-1.22.0-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:6944b2dc72c4d7f7052683487e3677456050ff77fcf5e6204e98caf785ad1967"},
- {file = "yarl-1.22.0-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:d5372ca1df0f91a86b047d1277c2aaf1edb32d78bbcefffc81b40ffd18f027ed"},
- {file = "yarl-1.22.0-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:51af598701f5299012b8416486b40fceef8c26fc87dc6d7d1f6fc30609ea0aa6"},
- {file = "yarl-1.22.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:b266bd01fedeffeeac01a79ae181719ff848a5a13ce10075adbefc8f1daee70e"},
- {file = "yarl-1.22.0-cp311-cp311-win32.whl", hash = "sha256:a9b1ba5610a4e20f655258d5a1fdc7ebe3d837bb0e45b581398b99eb98b1f5ca"},
- {file = "yarl-1.22.0-cp311-cp311-win_amd64.whl", hash = "sha256:078278b9b0b11568937d9509b589ee83ef98ed6d561dfe2020e24a9fd08eaa2b"},
- {file = "yarl-1.22.0-cp311-cp311-win_arm64.whl", hash = "sha256:b6a6f620cfe13ccec221fa312139135166e47ae169f8253f72a0abc0dae94376"},
- {file = "yarl-1.22.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:e340382d1afa5d32b892b3ff062436d592ec3d692aeea3bef3a5cfe11bbf8c6f"},
- {file = "yarl-1.22.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:f1e09112a2c31ffe8d80be1b0988fa6a18c5d5cad92a9ffbb1c04c91bfe52ad2"},
- {file = "yarl-1.22.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:939fe60db294c786f6b7c2d2e121576628468f65453d86b0fe36cb52f987bd74"},
- {file = "yarl-1.22.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e1651bf8e0398574646744c1885a41198eba53dc8a9312b954073f845c90a8df"},
- {file = "yarl-1.22.0-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:b8a0588521a26bf92a57a1705b77b8b59044cdceccac7151bd8d229e66b8dedb"},
- {file = "yarl-1.22.0-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:42188e6a615c1a75bcaa6e150c3fe8f3e8680471a6b10150c5f7e83f47cc34d2"},
- {file = "yarl-1.22.0-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:f6d2cb59377d99718913ad9a151030d6f83ef420a2b8f521d94609ecc106ee82"},
- {file = "yarl-1.22.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:50678a3b71c751d58d7908edc96d332af328839eea883bb554a43f539101277a"},
- {file = "yarl-1.22.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:1e8fbaa7cec507aa24ea27a01456e8dd4b6fab829059b69844bd348f2d467124"},
- {file = "yarl-1.22.0-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:433885ab5431bc3d3d4f2f9bd15bfa1614c522b0f1405d62c4f926ccd69d04fa"},
- {file = "yarl-1.22.0-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:b790b39c7e9a4192dc2e201a282109ed2985a1ddbd5ac08dc56d0e121400a8f7"},
- {file = "yarl-1.22.0-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:31f0b53913220599446872d757257be5898019c85e7971599065bc55065dc99d"},
- {file = "yarl-1.22.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:a49370e8f711daec68d09b821a34e1167792ee2d24d405cbc2387be4f158b520"},
- {file = "yarl-1.22.0-cp312-cp312-win32.whl", hash = "sha256:70dfd4f241c04bd9239d53b17f11e6ab672b9f1420364af63e8531198e3f5fe8"},
- {file = "yarl-1.22.0-cp312-cp312-win_amd64.whl", hash = "sha256:8884d8b332a5e9b88e23f60bb166890009429391864c685e17bd73a9eda9105c"},
- {file = "yarl-1.22.0-cp312-cp312-win_arm64.whl", hash = "sha256:ea70f61a47f3cc93bdf8b2f368ed359ef02a01ca6393916bc8ff877427181e74"},
- {file = "yarl-1.22.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:8dee9c25c74997f6a750cd317b8ca63545169c098faee42c84aa5e506c819b53"},
- {file = "yarl-1.22.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:01e73b85a5434f89fc4fe27dcda2aff08ddf35e4d47bbbea3bdcd25321af538a"},
- {file = "yarl-1.22.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:22965c2af250d20c873cdbee8ff958fb809940aeb2e74ba5f20aaf6b7ac8c70c"},
- {file = "yarl-1.22.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b4f15793aa49793ec8d1c708ab7f9eded1aa72edc5174cae703651555ed1b601"},
- {file = "yarl-1.22.0-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:e5542339dcf2747135c5c85f68680353d5cb9ffd741c0f2e8d832d054d41f35a"},
- {file = "yarl-1.22.0-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:5c401e05ad47a75869c3ab3e35137f8468b846770587e70d71e11de797d113df"},
- {file = "yarl-1.22.0-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:243dda95d901c733f5b59214d28b0120893d91777cb8aa043e6ef059d3cddfe2"},
- {file = "yarl-1.22.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bec03d0d388060058f5d291a813f21c011041938a441c593374da6077fe21b1b"},
- {file = "yarl-1.22.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:b0748275abb8c1e1e09301ee3cf90c8a99678a4e92e4373705f2a2570d581273"},
- {file = "yarl-1.22.0-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:47fdb18187e2a4e18fda2c25c05d8251a9e4a521edaed757fef033e7d8498d9a"},
- {file = "yarl-1.22.0-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:c7044802eec4524fde550afc28edda0dd5784c4c45f0be151a2d3ba017daca7d"},
- {file = "yarl-1.22.0-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:139718f35149ff544caba20fce6e8a2f71f1e39b92c700d8438a0b1d2a631a02"},
- {file = "yarl-1.22.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:e1b51bebd221006d3d2f95fbe124b22b247136647ae5dcc8c7acafba66e5ee67"},
- {file = "yarl-1.22.0-cp313-cp313-win32.whl", hash = "sha256:d3e32536234a95f513bd374e93d717cf6b2231a791758de6c509e3653f234c95"},
- {file = "yarl-1.22.0-cp313-cp313-win_amd64.whl", hash = "sha256:47743b82b76d89a1d20b83e60d5c20314cbd5ba2befc9cda8f28300c4a08ed4d"},
- {file = "yarl-1.22.0-cp313-cp313-win_arm64.whl", hash = "sha256:5d0fcda9608875f7d052eff120c7a5da474a6796fe4d83e152e0e4d42f6d1a9b"},
- {file = "yarl-1.22.0-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:719ae08b6972befcba4310e49edb1161a88cdd331e3a694b84466bd938a6ab10"},
- {file = "yarl-1.22.0-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:47d8a5c446df1c4db9d21b49619ffdba90e77c89ec6e283f453856c74b50b9e3"},
- {file = "yarl-1.22.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:cfebc0ac8333520d2d0423cbbe43ae43c8838862ddb898f5ca68565e395516e9"},
- {file = "yarl-1.22.0-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4398557cbf484207df000309235979c79c4356518fd5c99158c7d38203c4da4f"},
- {file = "yarl-1.22.0-cp313-cp313t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:2ca6fd72a8cd803be290d42f2dec5cdcd5299eeb93c2d929bf060ad9efaf5de0"},
- {file = "yarl-1.22.0-cp313-cp313t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:ca1f59c4e1ab6e72f0a23c13fca5430f889634166be85dbf1013683e49e3278e"},
- {file = "yarl-1.22.0-cp313-cp313t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:6c5010a52015e7c70f86eb967db0f37f3c8bd503a695a49f8d45700144667708"},
- {file = "yarl-1.22.0-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9d7672ecf7557476642c88497c2f8d8542f8e36596e928e9bcba0e42e1e7d71f"},
- {file = "yarl-1.22.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:3b7c88eeef021579d600e50363e0b6ee4f7f6f728cd3486b9d0f3ee7b946398d"},
- {file = "yarl-1.22.0-cp313-cp313t-musllinux_1_2_armv7l.whl", hash = "sha256:f4afb5c34f2c6fecdcc182dfcfc6af6cccf1aa923eed4d6a12e9d96904e1a0d8"},
- {file = "yarl-1.22.0-cp313-cp313t-musllinux_1_2_ppc64le.whl", hash = "sha256:59c189e3e99a59cf8d83cbb31d4db02d66cda5a1a4374e8a012b51255341abf5"},
- {file = "yarl-1.22.0-cp313-cp313t-musllinux_1_2_s390x.whl", hash = "sha256:5a3bf7f62a289fa90f1990422dc8dff5a458469ea71d1624585ec3a4c8d6960f"},
- {file = "yarl-1.22.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:de6b9a04c606978fdfe72666fa216ffcf2d1a9f6a381058d4378f8d7b1e5de62"},
- {file = "yarl-1.22.0-cp313-cp313t-win32.whl", hash = "sha256:1834bb90991cc2999f10f97f5f01317f99b143284766d197e43cd5b45eb18d03"},
- {file = "yarl-1.22.0-cp313-cp313t-win_amd64.whl", hash = "sha256:ff86011bd159a9d2dfc89c34cfd8aff12875980e3bd6a39ff097887520e60249"},
- {file = "yarl-1.22.0-cp313-cp313t-win_arm64.whl", hash = "sha256:7861058d0582b847bc4e3a4a4c46828a410bca738673f35a29ba3ca5db0b473b"},
- {file = "yarl-1.22.0-cp314-cp314-macosx_10_13_universal2.whl", hash = "sha256:34b36c2c57124530884d89d50ed2c1478697ad7473efd59cfd479945c95650e4"},
- {file = "yarl-1.22.0-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:0dd9a702591ca2e543631c2a017e4a547e38a5c0f29eece37d9097e04a7ac683"},
- {file = "yarl-1.22.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:594fcab1032e2d2cc3321bb2e51271e7cd2b516c7d9aee780ece81b07ff8244b"},
- {file = "yarl-1.22.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f3d7a87a78d46a2e3d5b72587ac14b4c16952dd0887dbb051451eceac774411e"},
- {file = "yarl-1.22.0-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:852863707010316c973162e703bddabec35e8757e67fcb8ad58829de1ebc8590"},
- {file = "yarl-1.22.0-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:131a085a53bfe839a477c0845acf21efc77457ba2bcf5899618136d64f3303a2"},
- {file = "yarl-1.22.0-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:078a8aefd263f4d4f923a9677b942b445a2be970ca24548a8102689a3a8ab8da"},
- {file = "yarl-1.22.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bca03b91c323036913993ff5c738d0842fc9c60c4648e5c8d98331526df89784"},
- {file = "yarl-1.22.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:68986a61557d37bb90d3051a45b91fa3d5c516d177dfc6dd6f2f436a07ff2b6b"},
- {file = "yarl-1.22.0-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:4792b262d585ff0dff6bcb787f8492e40698443ec982a3568c2096433660c694"},
- {file = "yarl-1.22.0-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:ebd4549b108d732dba1d4ace67614b9545b21ece30937a63a65dd34efa19732d"},
- {file = "yarl-1.22.0-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:f87ac53513d22240c7d59203f25cc3beac1e574c6cd681bbfd321987b69f95fd"},
- {file = "yarl-1.22.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:22b029f2881599e2f1b06f8f1db2ee63bd309e2293ba2d566e008ba12778b8da"},
- {file = "yarl-1.22.0-cp314-cp314-win32.whl", hash = "sha256:6a635ea45ba4ea8238463b4f7d0e721bad669f80878b7bfd1f89266e2ae63da2"},
- {file = "yarl-1.22.0-cp314-cp314-win_amd64.whl", hash = "sha256:0d6e6885777af0f110b0e5d7e5dda8b704efed3894da26220b7f3d887b839a79"},
- {file = "yarl-1.22.0-cp314-cp314-win_arm64.whl", hash = "sha256:8218f4e98d3c10d683584cb40f0424f4b9fd6e95610232dd75e13743b070ee33"},
- {file = "yarl-1.22.0-cp314-cp314t-macosx_10_13_universal2.whl", hash = "sha256:45c2842ff0e0d1b35a6bf1cd6c690939dacb617a70827f715232b2e0494d55d1"},
- {file = "yarl-1.22.0-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:d947071e6ebcf2e2bee8fce76e10faca8f7a14808ca36a910263acaacef08eca"},
- {file = "yarl-1.22.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:334b8721303e61b00019474cc103bdac3d7b1f65e91f0bfedeec2d56dfe74b53"},
- {file = "yarl-1.22.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1e7ce67c34138a058fd092f67d07a72b8e31ff0c9236e751957465a24b28910c"},
- {file = "yarl-1.22.0-cp314-cp314t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:d77e1b2c6d04711478cb1c4ab90db07f1609ccf06a287d5607fcd90dc9863acf"},
- {file = "yarl-1.22.0-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:c4647674b6150d2cae088fc07de2738a84b8bcedebef29802cf0b0a82ab6face"},
- {file = "yarl-1.22.0-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:efb07073be061c8f79d03d04139a80ba33cbd390ca8f0297aae9cce6411e4c6b"},
- {file = "yarl-1.22.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e51ac5435758ba97ad69617e13233da53908beccc6cfcd6c34bbed8dcbede486"},
- {file = "yarl-1.22.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:33e32a0dd0c8205efa8e83d04fc9f19313772b78522d1bdc7d9aed706bfd6138"},
- {file = "yarl-1.22.0-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:bf4a21e58b9cde0e401e683ebd00f6ed30a06d14e93f7c8fd059f8b6e8f87b6a"},
- {file = "yarl-1.22.0-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:e4b582bab49ac33c8deb97e058cd67c2c50dac0dd134874106d9c774fd272529"},
- {file = "yarl-1.22.0-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:0b5bcc1a9c4839e7e30b7b30dd47fe5e7e44fb7054ec29b5bb8d526aa1041093"},
- {file = "yarl-1.22.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:c0232bce2170103ec23c454e54a57008a9a72b5d1c3105dc2496750da8cfa47c"},
- {file = "yarl-1.22.0-cp314-cp314t-win32.whl", hash = "sha256:8009b3173bcd637be650922ac455946197d858b3630b6d8787aa9e5c4564533e"},
- {file = "yarl-1.22.0-cp314-cp314t-win_amd64.whl", hash = "sha256:9fb17ea16e972c63d25d4a97f016d235c78dd2344820eb35bc034bc32012ee27"},
- {file = "yarl-1.22.0-cp314-cp314t-win_arm64.whl", hash = "sha256:9f6d73c1436b934e3f01df1e1b21ff765cd1d28c77dfb9ace207f746d4610ee1"},
- {file = "yarl-1.22.0-py3-none-any.whl", hash = "sha256:1380560bdba02b6b6c90de54133c81c9f2a453dee9912fe58c1dcced1edb7cff"},
- {file = "yarl-1.22.0.tar.gz", hash = "sha256:bebf8557577d4401ba8bd9ff33906f1376c877aa78d1fe216ad01b4d6745af71"},
+ {file = "yarl-1.23.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:b35d13d549077713e4414f927cdc388d62e543987c572baee613bf82f11a4b99"},
+ {file = "yarl-1.23.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:cbb0fef01f0c6b38cb0f39b1f78fc90b807e0e3c86a7ff3ce74ad77ce5c7880c"},
+ {file = "yarl-1.23.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:dc52310451fc7c629e13c4e061cbe2dd01684d91f2f8ee2821b083c58bd72432"},
+ {file = "yarl-1.23.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b2c6b50c7b0464165472b56b42d4c76a7b864597007d9c085e8b63e185cf4a7a"},
+ {file = "yarl-1.23.0-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:aafe5dcfda86c8af00386d7781d4c2181b5011b7be3f2add5e99899ea925df05"},
+ {file = "yarl-1.23.0-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:9ee33b875f0b390564c1fb7bc528abf18c8ee6073b201c6ae8524aca778e2d83"},
+ {file = "yarl-1.23.0-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:4c41e021bc6d7affb3364dc1e1e5fa9582b470f283748784bd6ea0558f87f42c"},
+ {file = "yarl-1.23.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:99c8a9ed30f4164bc4c14b37a90208836cbf50d4ce2a57c71d0f52c7fb4f7598"},
+ {file = "yarl-1.23.0-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:f2af5c81a1f124609d5f33507082fc3f739959d4719b56877ab1ee7e7b3d602b"},
+ {file = "yarl-1.23.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:6b41389c19b07c760c7e427a3462e8ab83c4bb087d127f0e854c706ce1b9215c"},
+ {file = "yarl-1.23.0-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:1dc702e42d0684f42d6519c8d581e49c96cefaaab16691f03566d30658ee8788"},
+ {file = "yarl-1.23.0-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:0e40111274f340d32ebcc0a5668d54d2b552a6cca84c9475859d364b380e3222"},
+ {file = "yarl-1.23.0-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:4764a6a7588561a9aef92f65bda2c4fb58fe7c675c0883862e6df97559de0bfb"},
+ {file = "yarl-1.23.0-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:03214408cfa590df47728b84c679ae4ef00be2428e11630277be0727eba2d7cc"},
+ {file = "yarl-1.23.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:170e26584b060879e29fac213e4228ef063f39128723807a312e5c7fec28eff2"},
+ {file = "yarl-1.23.0-cp311-cp311-win32.whl", hash = "sha256:51430653db848d258336cfa0244427b17d12db63d42603a55f0d4546f50f25b5"},
+ {file = "yarl-1.23.0-cp311-cp311-win_amd64.whl", hash = "sha256:bf49a3ae946a87083ef3a34c8f677ae4243f5b824bfc4c69672e72b3d6719d46"},
+ {file = "yarl-1.23.0-cp311-cp311-win_arm64.whl", hash = "sha256:b39cb32a6582750b6cc77bfb3c49c0f8760dc18dc96ec9fb55fbb0f04e08b928"},
+ {file = "yarl-1.23.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:1932b6b8bba8d0160a9d1078aae5838a66039e8832d41d2992daa9a3a08f7860"},
+ {file = "yarl-1.23.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:411225bae281f114067578891bc75534cfb3d92a3b4dfef7a6ca78ba354e6069"},
+ {file = "yarl-1.23.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:13a563739ae600a631c36ce096615fe307f131344588b0bc0daec108cdb47b25"},
+ {file = "yarl-1.23.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9cbf44c5cb4a7633d078788e1b56387e3d3cf2b8139a3be38040b22d6c3221c8"},
+ {file = "yarl-1.23.0-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:53ad387048f6f09a8969631e4de3f1bf70c50e93545d64af4f751b2498755072"},
+ {file = "yarl-1.23.0-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:4a59ba56f340334766f3a4442e0efd0af895fae9e2b204741ef885c446b3a1a8"},
+ {file = "yarl-1.23.0-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:803a3c3ce4acc62eaf01eaca1208dcf0783025ef27572c3336502b9c232005e7"},
+ {file = "yarl-1.23.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a3d2bff8f37f8d0f96c7ec554d16945050d54462d6e95414babaa18bfafc7f51"},
+ {file = "yarl-1.23.0-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:c75eb09e8d55bceb4367e83496ff8ef2bc7ea6960efb38e978e8073ea59ecb67"},
+ {file = "yarl-1.23.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:877b0738624280e34c55680d6054a307aa94f7d52fa0e3034a9cc6e790871da7"},
+ {file = "yarl-1.23.0-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:b5405bb8f0e783a988172993cfc627e4d9d00432d6bbac65a923041edacf997d"},
+ {file = "yarl-1.23.0-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:1c3a3598a832590c5a3ce56ab5576361b5688c12cb1d39429cf5dba30b510760"},
+ {file = "yarl-1.23.0-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:8419ebd326430d1cbb7efb5292330a2cf39114e82df5cc3d83c9a0d5ebeaf2f2"},
+ {file = "yarl-1.23.0-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:be61f6fff406ca40e3b1d84716fde398fc08bc63dd96d15f3a14230a0973ed86"},
+ {file = "yarl-1.23.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:3ceb13c5c858d01321b5d9bb65e4cf37a92169ea470b70fec6f236b2c9dd7e34"},
+ {file = "yarl-1.23.0-cp312-cp312-win32.whl", hash = "sha256:fffc45637bcd6538de8b85f51e3df3223e4ad89bccbfca0481c08c7fc8b7ed7d"},
+ {file = "yarl-1.23.0-cp312-cp312-win_amd64.whl", hash = "sha256:f69f57305656a4852f2a7203efc661d8c042e6cc67f7acd97d8667fb448a426e"},
+ {file = "yarl-1.23.0-cp312-cp312-win_arm64.whl", hash = "sha256:6e87a6e8735b44816e7db0b2fbc9686932df473c826b0d9743148432e10bb9b9"},
+ {file = "yarl-1.23.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:16c6994ac35c3e74fb0ae93323bf8b9c2a9088d55946109489667c510a7d010e"},
+ {file = "yarl-1.23.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:4a42e651629dafb64fd5b0286a3580613702b5809ad3f24934ea87595804f2c5"},
+ {file = "yarl-1.23.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:7c6b9461a2a8b47c65eef63bb1c76a4f1c119618ffa99ea79bc5bb1e46c5821b"},
+ {file = "yarl-1.23.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:2569b67d616eab450d262ca7cb9f9e19d2f718c70a8b88712859359d0ab17035"},
+ {file = "yarl-1.23.0-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:e9d9a4d06d3481eab79803beb4d9bd6f6a8e781ec078ac70d7ef2dcc29d1bea5"},
+ {file = "yarl-1.23.0-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:f514f6474e04179d3d33175ed3f3e31434d3130d42ec153540d5b157deefd735"},
+ {file = "yarl-1.23.0-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:fda207c815b253e34f7e1909840fd14299567b1c0eb4908f8c2ce01a41265401"},
+ {file = "yarl-1.23.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:34b6cf500e61c90f305094911f9acc9c86da1a05a7a3f5be9f68817043f486e4"},
+ {file = "yarl-1.23.0-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:d7504f2b476d21653e4d143f44a175f7f751cd41233525312696c76aa3dbb23f"},
+ {file = "yarl-1.23.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:578110dd426f0d209d1509244e6d4a3f1a3e9077655d98c5f22583d63252a08a"},
+ {file = "yarl-1.23.0-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:609d3614d78d74ebe35f54953c5bbd2ac647a7ddb9c30a5d877580f5e86b22f2"},
+ {file = "yarl-1.23.0-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:4966242ec68afc74c122f8459abd597afd7d8a60dc93d695c1334c5fd25f762f"},
+ {file = "yarl-1.23.0-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:e0fd068364a6759bc794459f0a735ab151d11304346332489c7972bacbe9e72b"},
+ {file = "yarl-1.23.0-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:39004f0ad156da43e86aa71f44e033de68a44e5a31fc53507b36dd253970054a"},
+ {file = "yarl-1.23.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:e5723c01a56c5028c807c701aa66722916d2747ad737a046853f6c46f4875543"},
+ {file = "yarl-1.23.0-cp313-cp313-win32.whl", hash = "sha256:1b6b572edd95b4fa8df75de10b04bc81acc87c1c7d16bcdd2035b09d30acc957"},
+ {file = "yarl-1.23.0-cp313-cp313-win_amd64.whl", hash = "sha256:baaf55442359053c7d62f6f8413a62adba3205119bcb6f49594894d8be47e5e3"},
+ {file = "yarl-1.23.0-cp313-cp313-win_arm64.whl", hash = "sha256:fb4948814a2a98e3912505f09c9e7493b1506226afb1f881825368d6fb776ee3"},
+ {file = "yarl-1.23.0-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:aecfed0b41aa72b7881712c65cf764e39ce2ec352324f5e0837c7048d9e6daaa"},
+ {file = "yarl-1.23.0-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:a41bcf68efd19073376eb8cf948b8d9be0af26256403e512bb18f3966f1f9120"},
+ {file = "yarl-1.23.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:cde9a2ecd91668bcb7f077c4966d8ceddb60af01b52e6e3e2680e4cf00ad1a59"},
+ {file = "yarl-1.23.0-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5023346c4ee7992febc0068e7593de5fa2bf611848c08404b35ebbb76b1b0512"},
+ {file = "yarl-1.23.0-cp313-cp313t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:d1009abedb49ae95b136a8904a3f71b342f849ffeced2d3747bf29caeda218c4"},
+ {file = "yarl-1.23.0-cp313-cp313t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:a8d00f29b42f534cc8aa3931cfe773b13b23e561e10d2b26f27a8d309b0e82a1"},
+ {file = "yarl-1.23.0-cp313-cp313t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:95451e6ce06c3e104556d73b559f5da6c34a069b6b62946d3ad66afcd51642ea"},
+ {file = "yarl-1.23.0-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:531ef597132086b6cf96faa7c6c1dcd0361dd5f1694e5cc30375907b9b7d3ea9"},
+ {file = "yarl-1.23.0-cp313-cp313t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:88f9fb0116fbfcefcab70f85cf4b74a2b6ce5d199c41345296f49d974ddb4123"},
+ {file = "yarl-1.23.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:e7b0460976dc75cb87ad9cc1f9899a4b97751e7d4e77ab840fc9b6d377b8fd24"},
+ {file = "yarl-1.23.0-cp313-cp313t-musllinux_1_2_armv7l.whl", hash = "sha256:115136c4a426f9da976187d238e84139ff6b51a20839aa6e3720cd1026d768de"},
+ {file = "yarl-1.23.0-cp313-cp313t-musllinux_1_2_ppc64le.whl", hash = "sha256:ead11956716a940c1abc816b7df3fa2b84d06eaed8832ca32f5c5e058c65506b"},
+ {file = "yarl-1.23.0-cp313-cp313t-musllinux_1_2_riscv64.whl", hash = "sha256:fe8f8f5e70e6dbdfca9882cd9deaac058729bcf323cf7a58660901e55c9c94f6"},
+ {file = "yarl-1.23.0-cp313-cp313t-musllinux_1_2_s390x.whl", hash = "sha256:a0e317df055958a0c1e79e5d2aa5a5eaa4a6d05a20d4b0c9c3f48918139c9fc6"},
+ {file = "yarl-1.23.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:6f0fd84de0c957b2d280143522c4f91a73aada1923caee763e24a2b3fda9f8a5"},
+ {file = "yarl-1.23.0-cp313-cp313t-win32.whl", hash = "sha256:93a784271881035ab4406a172edb0faecb6e7d00f4b53dc2f55919d6c9688595"},
+ {file = "yarl-1.23.0-cp313-cp313t-win_amd64.whl", hash = "sha256:dd00607bffbf30250fe108065f07453ec124dbf223420f57f5e749b04295e090"},
+ {file = "yarl-1.23.0-cp313-cp313t-win_arm64.whl", hash = "sha256:ac09d42f48f80c9ee1635b2fcaa819496a44502737660d3c0f2ade7526d29144"},
+ {file = "yarl-1.23.0-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:21d1b7305a71a15b4794b5ff22e8eef96ff4a6d7f9657155e5aa419444b28912"},
+ {file = "yarl-1.23.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:85610b4f27f69984932a7abbe52703688de3724d9f72bceb1cca667deff27474"},
+ {file = "yarl-1.23.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:23f371bd662cf44a7630d4d113101eafc0cfa7518a2760d20760b26021454719"},
+ {file = "yarl-1.23.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c4a80f77dc1acaaa61f0934176fccca7096d9b1ff08c8ba9cddf5ae034a24319"},
+ {file = "yarl-1.23.0-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:bd654fad46d8d9e823afbb4f87c79160b5a374ed1ff5bde24e542e6ba8f41434"},
+ {file = "yarl-1.23.0-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:682bae25f0a0dd23a056739f23a134db9f52a63e2afd6bfb37ddc76292bbd723"},
+ {file = "yarl-1.23.0-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:a82836cab5f197a0514235aaf7ffccdc886ccdaa2324bc0aafdd4ae898103039"},
+ {file = "yarl-1.23.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1c57676bdedc94cd3bc37724cf6f8cd2779f02f6aba48de45feca073e714fe52"},
+ {file = "yarl-1.23.0-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:c7f8dc16c498ff06497c015642333219871effba93e4a2e8604a06264aca5c5c"},
+ {file = "yarl-1.23.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:5ee586fb17ff8f90c91cf73c6108a434b02d69925f44f5f8e0d7f2f260607eae"},
+ {file = "yarl-1.23.0-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:17235362f580149742739cc3828b80e24029d08cbb9c4bda0242c7b5bc610a8e"},
+ {file = "yarl-1.23.0-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:0793e2bd0cf14234983bbb371591e6bea9e876ddf6896cdcc93450996b0b5c85"},
+ {file = "yarl-1.23.0-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:3650dc2480f94f7116c364096bc84b1d602f44224ef7d5c7208425915c0475dd"},
+ {file = "yarl-1.23.0-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:f40e782d49630ad384db66d4d8b73ff4f1b8955dc12e26b09a3e3af064b3b9d6"},
+ {file = "yarl-1.23.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:94f8575fbdf81749008d980c17796097e645574a3b8c28ee313931068dad14fe"},
+ {file = "yarl-1.23.0-cp314-cp314-win32.whl", hash = "sha256:c8aa34a5c864db1087d911a0b902d60d203ea3607d91f615acd3f3108ac32169"},
+ {file = "yarl-1.23.0-cp314-cp314-win_amd64.whl", hash = "sha256:63e92247f383c85ab00dd0091e8c3fa331a96e865459f5ee80353c70a4a42d70"},
+ {file = "yarl-1.23.0-cp314-cp314-win_arm64.whl", hash = "sha256:70efd20be968c76ece7baa8dafe04c5be06abc57f754d6f36f3741f7aa7a208e"},
+ {file = "yarl-1.23.0-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:9a18d6f9359e45722c064c97464ec883eb0e0366d33eda61cb19a244bf222679"},
+ {file = "yarl-1.23.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:2803ed8b21ca47a43da80a6fd1ed3019d30061f7061daa35ac54f63933409412"},
+ {file = "yarl-1.23.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:394906945aa8b19fc14a61cf69743a868bb8c465efe85eee687109cc540b98f4"},
+ {file = "yarl-1.23.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:71d006bee8397a4a89f469b8deb22469fe7508132d3c17fa6ed871e79832691c"},
+ {file = "yarl-1.23.0-cp314-cp314t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:62694e275c93d54f7ccedcfef57d42761b2aad5234b6be1f3e3026cae4001cd4"},
+ {file = "yarl-1.23.0-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:a31de1613658308efdb21ada98cbc86a97c181aa050ba22a808120bb5be3ab94"},
+ {file = "yarl-1.23.0-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:fb1e8b8d66c278b21d13b0a7ca22c41dd757a7c209c6b12c313e445c31dd3b28"},
+ {file = "yarl-1.23.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:50f9d8d531dfb767c565f348f33dd5139a6c43f5cbdf3f67da40d54241df93f6"},
+ {file = "yarl-1.23.0-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:575aa4405a656e61a540f4a80eaa5260f2a38fff7bfdc4b5f611840d76e9e277"},
+ {file = "yarl-1.23.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:041b1a4cefacf65840b4e295c6985f334ba83c30607441ae3cf206a0eed1a2e4"},
+ {file = "yarl-1.23.0-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:d38c1e8231722c4ce40d7593f28d92b5fc72f3e9774fe73d7e800ec32299f63a"},
+ {file = "yarl-1.23.0-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:d53834e23c015ee83a99377db6e5e37d8484f333edb03bd15b4bc312cc7254fb"},
+ {file = "yarl-1.23.0-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:2e27c8841126e017dd2a054a95771569e6070b9ee1b133366d8b31beb5018a41"},
+ {file = "yarl-1.23.0-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:76855800ac56f878847a09ce6dba727c93ca2d89c9e9d63002d26b916810b0a2"},
+ {file = "yarl-1.23.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:e09fd068c2e169a7070d83d3bde728a4d48de0549f975290be3c108c02e499b4"},
+ {file = "yarl-1.23.0-cp314-cp314t-win32.whl", hash = "sha256:73309162a6a571d4cbd3b6a1dcc703c7311843ae0d1578df6f09be4e98df38d4"},
+ {file = "yarl-1.23.0-cp314-cp314t-win_amd64.whl", hash = "sha256:4503053d296bc6e4cbd1fad61cf3b6e33b939886c4f249ba7c78b602214fabe2"},
+ {file = "yarl-1.23.0-cp314-cp314t-win_arm64.whl", hash = "sha256:44bb7bef4ea409384e3f8bc36c063d77ea1b8d4a5b2706956c0d6695f07dcc25"},
+ {file = "yarl-1.23.0-py3-none-any.whl", hash = "sha256:a2df6afe50dea8ae15fa34c9f824a3ee958d785fd5d089063d960bae1daa0a3f"},
+ {file = "yarl-1.23.0.tar.gz", hash = "sha256:53b1ea6ca88ebd4420379c330aea57e258408dd0df9af0992e5de2078dc9f5d5"},
]
[[package]]
diff --git a/pyproject.toml b/pyproject.toml
index 417cef7cda..3d5972ef77 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -100,6 +100,9 @@ vllm = [
"transformers>=4.30.0",
"vllm>=0.4.0",
]
+mcp = [
+ "mcp[cli]~=1.2",
+]
[project.urls]
"Homepage" = "https://github.com/LearningCircuit/local-deep-research"
@@ -108,6 +111,7 @@ vllm = [
[project.scripts]
ldr = "local_deep_research.main:main"
ldr-web = "local_deep_research.web.app:main"
+ldr-mcp = "local_deep_research.mcp:run_server"
[tool.setuptools]
include-package-data = true
diff --git a/src/local_deep_research/advanced_search_system/filters/journal_reputation_filter.py b/src/local_deep_research/advanced_search_system/filters/journal_reputation_filter.py
index 247c098985..96a776003b 100644
--- a/src/local_deep_research/advanced_search_system/filters/journal_reputation_filter.py
+++ b/src/local_deep_research/advanced_search_system/filters/journal_reputation_filter.py
@@ -109,8 +109,15 @@ class JournalReputationFilter(BaseFilter):
self.__engine = create_search_engine(
"searxng", llm=self.model, settings_snapshot=settings_snapshot
)
- if self.__engine is None:
- raise JournalFilterError("SearXNG initialization failed.")
+ # create_search_engine() can return a non-None engine whose backing
+ # service is unreachable (e.g. SearXNG is down), so we also verify
+ # the engine reports itself as available.
+ if self.__engine is None or not getattr(
+ self.__engine, "is_available", False
+ ):
+ raise JournalFilterError(
+ "SearXNG initialization failed or not available."
+ )
@classmethod
def create_default(
diff --git a/src/local_deep_research/advanced_search_system/strategies/__init__.py b/src/local_deep_research/advanced_search_system/strategies/__init__.py
index 361e3bdec6..7b25c0738f 100644
--- a/src/local_deep_research/advanced_search_system/strategies/__init__.py
+++ b/src/local_deep_research/advanced_search_system/strategies/__init__.py
@@ -11,6 +11,7 @@ from .evidence_based_strategy import EvidenceBasedStrategy
from .focused_iteration_strategy import FocusedIterationStrategy
from .iterative_reasoning_strategy import IterativeReasoningStrategy
from .iterdrag_strategy import IterDRAGStrategy
+from .mcp_strategy import MCPSearchStrategy
from .modular_strategy import ModularStrategy
from .parallel_constrained_strategy import ParallelConstrainedStrategy
from .parallel_search_strategy import ParallelSearchStrategy
@@ -32,6 +33,7 @@ __all__ = [
"FocusedIterationStrategy",
"IterDRAGStrategy",
"IterativeReasoningStrategy",
+ "MCPSearchStrategy",
"ModularStrategy",
"ParallelConstrainedStrategy",
"ParallelSearchStrategy",
diff --git a/src/local_deep_research/advanced_search_system/strategies/mcp_strategy.py b/src/local_deep_research/advanced_search_system/strategies/mcp_strategy.py
new file mode 100644
index 0000000000..f04e55008d
--- /dev/null
+++ b/src/local_deep_research/advanced_search_system/strategies/mcp_strategy.py
@@ -0,0 +1,1569 @@
+"""
+MCP Strategy using ReAct pattern (Reasoning + Acting).
+
+This strategy makes LDR behave more like Claude - thinking about requests,
+calling tools (MCP and web search), analyzing results, and iterating
+until the query is properly answered.
+
+Unlike traditional strategies with fixed pipelines, the LLM decides
+what to do at each step based on what it has learned.
+"""
+
+import json
+import re
+from datetime import UTC, datetime
+from typing import Any, Dict, List, Optional
+
+from langchain_core.language_models import BaseChatModel
+from loguru import logger
+
+from ...citation_handler import CitationHandler
+from ...utilities.json_utils import extract_json
+from ...utilities.search_utilities import (
+ extract_links_from_search_results,
+ format_links_to_markdown,
+)
+from .base_strategy import BaseSearchStrategy
+
+# ReAct prompt template - simplified for better model compatibility
+# Note: {current_date} placeholder is replaced at runtime
+REACT_SYSTEM_PROMPT = """You are a research assistant. You MUST search for information before answering.
+
+Today's date: {current_date}
+
+CRITICAL: You MUST call at least one search tool BEFORE giving any ANSWER.
+- Do NOT answer from memory or prior knowledge
+- Do NOT ask clarifying questions - just search for the topic
+- If the query seems vague, search for it anyway and provide what you find
+
+## Available Tools:
+
+### General Search:
+- **web_search** - Quick web search using the default engine
+
+### Deep Research (delegate to sub-strategies):
+- **focused_research** - Iterative deep analysis from multiple angles
+- **source_research** - Prioritizes authoritative sources
+- **quick_research** - Fast multi-iteration search
+
+### Specialized Search Engines (examples — actual availability depends on configuration):
+- **search_arxiv** - Academic papers (physics, math, CS)
+- **search_wikipedia** - Encyclopedia/background info
+- **search_pubmed** - Medical/biomedical papers
+- **search_semantic_scholar** - Academic papers, citations
+- **search_github** - Code repositories and projects
+- And more based on your configuration...
+
+### Content Download:
+- **download_content** - Get full text from a URL (papers, articles, web pages)
+
+## How to respond:
+
+To SEARCH (do this first):
+THOUGHT: I need to search for [topic]
+ACTION: web_search
+ARGUMENTS: {{"query": "your search terms here"}}
+
+To do DEEP RESEARCH on a subtopic:
+THOUGHT: This aspect needs deeper investigation
+ACTION: focused_research
+ARGUMENTS: {{"query": "specific question to investigate"}}
+
+To DOWNLOAD full content from a URL:
+THOUGHT: I need to read the full paper/article at this URL
+ACTION: download_content
+ARGUMENTS: {{"url": "https://arxiv.org/abs/2301.12345"}}
+
+To give FINAL ANSWER (only after searching):
+THOUGHT: Based on my searches, I found [summary]
+ANSWER: [Your answer here with citations like [1], [2], etc.]
+
+## Citations:
+- Search results are numbered [1], [2], [3], etc.
+- In your ANSWER, cite sources: "According to [1], solar power is..."
+- Reference multiple sources: "Research shows [1][3] that..."
+
+## Example:
+User: What is the population of France?
+
+THOUGHT: I need to search for current population data for France.
+ACTION: web_search
+ARGUMENTS: {{"query": "France population 2024"}}
+
+[After receiving results like [1] Wikipedia - France, [2] WorldBank...]
+
+THOUGHT: I found population data from multiple sources.
+ANSWER: France has a population of approximately 68 million people [1]. According to recent census data [2], this makes it one of the most populous countries in Europe.
+
+## When to use research tools:
+- **web_search**: Quick facts, simple queries, current events
+- **focused_research**: Complex topics needing iterative deep analysis
+- **source_research**: When source authority/credibility is important
+- **quick_research**: When you need a fast multi-iteration search across sources
+- **download_content**: When you need the full text of a paper/article, not just the snippet
+
+## Rules:
+1. ALWAYS search before answering
+2. Use THOUGHT: then ACTION: then ARGUMENTS: format
+3. Only give ANSWER: after you have search results
+4. ALWAYS cite sources using [1], [2], etc. in your answer
+5. Use focused/source/quick_research for complex subtopics
+"""
+
+
+def _to_bool(value) -> bool:
+ """Convert a value to bool, handling string 'false'/'0' from settings."""
+ if isinstance(value, str):
+ return value.strip().lower() not in ("false", "0", "no", "")
+ return bool(value)
+
+
+REACT_USER_PROMPT = """## Query
+{query}
+
+## Available Tools
+{tool_descriptions}
+
+## Research History
+{history}
+
+## Your Turn
+Think about what you know and what you still need. Then either call a tool or provide your final answer."""
+
+
+class MCPSearchStrategy(BaseSearchStrategy):
+ """
+ Agentic research strategy using the ReAct pattern.
+
+ The LLM thinks step-by-step, decides which tools to call,
+ analyzes results, and continues until the query is answered.
+ """
+
+ # -- Content limits --
+ OBSERVATION_MAX_LENGTH = 5000
+ MAX_ARG_LENGTH = 10000
+ DOWNLOAD_DEFAULT_MAX_LENGTH = 10000
+ HISTORY_OBSERVATION_MAX_LENGTH = 1000
+ DIRECT_ANSWER_MIN_LENGTH = 300
+
+ # -- Display limits --
+ THOUGHT_PREVIEW_LENGTH = 200
+ OBSERVATION_PREVIEW_LENGTH = 500
+ RAW_RESPONSE_PREVIEW_LENGTH = 500
+ ENGINE_STRENGTHS_DISPLAY_LIMIT = 2
+ SOURCE_REFS_DISPLAY_LIMIT = 5
+
+ # -- Timeouts --
+ MCP_DISCOVERY_TIMEOUT = 30.0
+ CONTENT_FETCHER_TIMEOUT = 30
+ MCP_TOOL_CALL_TIMEOUT = 60.0
+
+ def __init__(
+ self,
+ model: BaseChatModel,
+ search: Any, # Search engine instance
+ citation_handler=None,
+ mcp_servers: Optional[List[Dict[str, Any]]] = None,
+ max_iterations: int = 10,
+ include_web_search: bool = True,
+ include_sub_research: bool = True,
+ depth: int = 0,
+ max_depth: int = 2,
+ all_links_of_system: Optional[List] = None,
+ settings_snapshot: Optional[Dict] = None,
+ **kwargs,
+ ):
+ """
+ Initialize the MCP strategy.
+
+ Args:
+ model: Language model for reasoning and decisions
+ search: Web search engine instance
+ citation_handler: Citation handler for formatting sources
+ mcp_servers: List of MCP server configurations
+ max_iterations: Maximum ReAct iterations (safety limit)
+ include_web_search: Whether to include web_search as a tool
+ include_sub_research: Whether to include sub_research tool
+ depth: Current recursion depth (0 = top level)
+ max_depth: Maximum recursion depth for sub-research
+ all_links_of_system: Shared links list
+ settings_snapshot: Settings configuration
+ """
+ super().__init__(
+ all_links_of_system=all_links_of_system,
+ settings_snapshot=settings_snapshot,
+ **kwargs,
+ )
+
+ self.model = model
+ self.search = search
+ self.mcp_servers = mcp_servers or []
+ self.max_iterations = int(
+ max_iterations
+ ) # Ensure int (settings may pass string)
+ self.include_web_search = _to_bool(include_web_search)
+ self.include_sub_research = _to_bool(include_sub_research)
+ self.depth = int(depth)
+ self.max_depth = int(max_depth)
+
+ # Citation handler for proper source formatting
+ self.citation_handler = citation_handler or CitationHandler(
+ self.model,
+ handler_type="standard",
+ settings_snapshot=settings_snapshot,
+ )
+
+ # Track reasoning history
+ self._history: List[Dict[str, str]] = []
+ self._sources: List[str] = []
+ self._findings: List[Dict[str, Any]] = []
+
+ # Track all search results for citation handling
+ self.all_search_results: List[Dict[str, Any]] = []
+
+ # Cache for MCP tools (avoid rediscovery on every call)
+ self._mcp_tools_cache: Optional[List[Dict[str, Any]]] = None
+
+ def analyze_topic(self, query: str) -> Dict:
+ """
+ Analyze a topic using the ReAct pattern.
+
+ The LLM reasons about what to do, calls tools, observes results,
+ and continues until it has enough information to answer.
+
+ Args:
+ query: The research query
+
+ Returns:
+ Dict with findings, sources, iterations, etc.
+ """
+ logger.info(f"Starting MCP ReAct research for: {query[:100]}...")
+ self._update_progress(
+ f'STARTING ReAct agent for: "{query[:80]}..."',
+ 5,
+ {"phase": "init", "type": "milestone", "query": query[:100]},
+ )
+
+ # Reset state
+ self._history = []
+ self._sources = []
+ self._findings = []
+ self.all_search_results = []
+
+ # Build tool descriptions
+ tools = self._build_tool_descriptions()
+
+ if not tools:
+ return self._create_error_response(
+ "No tools available for research"
+ )
+
+ tool_descriptions = self._format_tool_descriptions(tools)
+
+ # ReAct loop
+ iteration = 0
+ final_answer = None
+
+ while iteration < self.max_iterations:
+ iteration += 1
+ progress = 10 + int((iteration / self.max_iterations) * 80)
+
+ self._update_progress(
+ f"CYCLE {iteration}/{self.max_iterations}: Agent is reasoning about what to do next...",
+ progress,
+ {
+ "phase": "react",
+ "iteration": iteration,
+ "max": self.max_iterations,
+ },
+ )
+
+ # Get LLM response
+ try:
+ response = self._get_llm_response(
+ query, tool_descriptions, tools
+ )
+ except Exception as e:
+ logger.exception("LLM call failed")
+ return self._create_error_response(f"LLM error: {e}")
+
+ # Parse the response
+ parsed = self._parse_response(response)
+
+ if parsed["type"] == "answer":
+ # LLM decided it has enough information
+ final_answer = parsed["content"]
+ self._history.append(
+ {
+ "role": "assistant",
+ "thought": parsed.get("thought", ""),
+ "answer": final_answer,
+ }
+ )
+ logger.info(
+ f"ReAct completed with answer after {iteration} iterations"
+ )
+ break
+
+ elif parsed["type"] == "action":
+ # LLM wants to call a tool
+ tool_name = parsed.get("tool")
+ arguments = parsed.get("arguments", {})
+ thought = parsed.get("thought", "")
+
+ # Validate required action fields
+ if not tool_name:
+ logger.warning(
+ "Action missing 'tool' field, treating as error"
+ )
+ self._history.append(
+ {
+ "role": "system",
+ "error": "Invalid action: missing tool name. Please specify which tool to use.",
+ }
+ )
+ continue
+
+ # Show detailed progress with thought and action
+ thought_preview = (
+ thought[: self.THOUGHT_PREVIEW_LENGTH]
+ if thought
+ else "Analyzing..."
+ )
+ search_query = arguments.get("query", str(arguments))
+
+ self._update_progress(
+ f"THINKING: {thought_preview}",
+ progress,
+ {"phase": "thought", "thought": thought},
+ )
+ self._update_progress(
+ f'ACTION: Using {tool_name} - "{search_query}"',
+ progress + 2,
+ {
+ "phase": "tool_call",
+ "tool": tool_name,
+ "arguments": arguments,
+ },
+ )
+
+ # Execute the tool
+ try:
+ result = self._execute_tool(tool_name, arguments, tools)
+ if not isinstance(result, dict):
+ result = (
+ {"content": str(result)}
+ if result
+ else {"content": "No result returned"}
+ )
+ observation = result.get("content", str(result))
+
+ # Truncate very long observations
+ if len(observation) > self.OBSERVATION_MAX_LENGTH:
+ observation = (
+ observation[: self.OBSERVATION_MAX_LENGTH]
+ + "\n... [truncated]"
+ )
+
+ # Show observation summary with actual content
+ obs_preview = observation[
+ : self.OBSERVATION_PREVIEW_LENGTH
+ ].replace("\n", " ")
+ self._update_progress(
+ f"RESULT: {obs_preview}",
+ progress + 4,
+ {
+ "phase": "observation",
+ "tool": tool_name,
+ "result_length": len(observation),
+ "content": obs_preview,
+ },
+ )
+
+ except Exception as e:
+ logger.exception("Tool execution failed")
+ observation = f"Error: Tool '{tool_name}' failed: {e}"
+ self._update_progress(
+ f"ERROR: {tool_name} failed - {str(e)[:100]}",
+ progress + 4,
+ {"phase": "error", "tool": tool_name, "error": str(e)},
+ )
+
+ # Add to history
+ self._history.append(
+ {
+ "role": "assistant",
+ "thought": thought,
+ "action": tool_name,
+ "arguments": arguments,
+ }
+ )
+ self._history.append(
+ {
+ "role": "tool",
+ "tool": tool_name,
+ "observation": observation,
+ }
+ )
+
+ elif parsed["type"] == "error":
+ # Parsing error - show what the LLM said anyway
+ raw_response = parsed.get("raw", "")[
+ : self.RAW_RESPONSE_PREVIEW_LENGTH
+ ]
+ logger.warning(
+ f"Failed to parse LLM response: {parsed['message']}"
+ )
+
+ # Show the raw LLM output to the user so they can see what it's thinking
+ self._update_progress(
+ f"LLM Response (unparsed): {raw_response}",
+ progress,
+ {
+ "phase": "thought",
+ "thought": raw_response,
+ "parse_error": True,
+ },
+ )
+
+ self._history.append(
+ {
+ "role": "system",
+ "error": f"Invalid response format: {parsed['message']}. Please use the correct format.",
+ }
+ )
+
+ # If we hit max iterations without an answer, synthesize one
+ if final_answer is None:
+ logger.warning(
+ f"Max iterations ({self.max_iterations}) reached, synthesizing answer"
+ )
+ final_answer = self._synthesize_answer(query)
+
+ # Use citation handler for final synthesis with proper source formatting
+ self._update_progress(
+ f"Synthesizing {len(self.all_search_results)} sources with citations...",
+ 90,
+ {"phase": "synthesis", "type": "milestone"},
+ )
+
+ # If we have search results, use citation handler for proper formatting
+ synthesized_content = final_answer
+ documents = []
+ if self.all_search_results:
+ try:
+ citation_result = self.citation_handler.analyze_followup(
+ query,
+ self.all_search_results,
+ previous_knowledge=final_answer,
+ nr_of_links=0,
+ )
+ # Handle case where citation_result is None or not a dict
+ if citation_result is None or not isinstance(
+ citation_result, dict
+ ):
+ logger.warning(
+ "Citation handler returned None or non-dict, using raw answer"
+ )
+ synthesized_content = final_answer
+ else:
+ synthesized_content = citation_result.get(
+ "content", citation_result.get("response", final_answer)
+ )
+ documents = citation_result.get("documents", [])
+ logger.info(
+ f"Citation handler produced {len(documents)} documents"
+ )
+ except Exception as e:
+ logger.warning(
+ f"Citation handler failed, using raw answer: {e}"
+ )
+ synthesized_content = final_answer
+
+ # Format sources as markdown bibliography and append to output
+ formatted_output = synthesized_content
+ logger.info(
+ f"MCP Strategy: all_search_results has {len(self.all_search_results)} items"
+ )
+ if self.all_search_results:
+ try:
+ all_links = extract_links_from_search_results(
+ self.all_search_results
+ )
+ logger.info(
+ f"MCP Strategy: extracted {len(all_links)} links from search results"
+ )
+ if all_links:
+ sources_markdown = format_links_to_markdown(all_links)
+ logger.info(
+ f"MCP Strategy: sources_markdown length={len(sources_markdown) if sources_markdown else 0}"
+ )
+ if sources_markdown:
+ formatted_output = f"{synthesized_content}\n\n## Sources\n\n{sources_markdown}"
+ logger.info(
+ f"MCP Strategy: Appended {len(all_links)} sources to output"
+ )
+ else:
+ logger.warning(
+ "MCP Strategy: sources_markdown is empty despite having links"
+ )
+ else:
+ logger.warning(
+ "MCP Strategy: No links extracted from search results"
+ )
+ except Exception:
+ logger.exception("MCP Strategy: Failed to format source links")
+ else:
+ logger.warning("MCP Strategy: all_search_results is empty")
+
+ # Add final finding WITH search_results for research_service.py to extract
+ # This is critical for sources to be saved to database and displayed
+ final_finding = {
+ "content": synthesized_content,
+ "question": query,
+ "search_results": self.all_search_results,
+ "documents": documents,
+ }
+ self._findings.append(final_finding)
+
+ # Build result
+ self._update_progress(
+ "Research complete",
+ 100,
+ {"phase": "complete", "iterations": iteration},
+ )
+
+ # Extract actual search queries from history (not just tool names)
+ questions = {}
+ q_idx = 0
+ for h in self._history:
+ if h.get("action") and h.get("arguments"):
+ action_query = h["arguments"].get(
+ "query", h["arguments"].get("question", "")
+ )
+ if action_query:
+ questions[q_idx] = [action_query]
+ q_idx += 1
+
+ return {
+ "findings": self._findings,
+ "iterations": iteration,
+ "questions": questions,
+ "formatted_findings": formatted_output,
+ "current_knowledge": synthesized_content,
+ "sources": list(
+ set(s for s in self._sources if isinstance(s, str))
+ ),
+ "search_results": self.all_search_results,
+ "documents": documents,
+ "reasoning_trace": self._history,
+ }
+
+ def _build_tool_descriptions(self) -> List[Dict[str, Any]]:
+ """Build list of available tools with descriptions."""
+ tools = []
+
+ # Add web search if enabled
+ if self.include_web_search and self.search:
+ tools.append(
+ {
+ "name": "web_search",
+ "description": "Search the web for information. Use this for quick searches to find current information, facts, news, or any web content. Returns search result snippets.",
+ "parameters": {
+ "query": {
+ "type": "string",
+ "description": "The search query",
+ "required": True,
+ }
+ },
+ "executor": self._execute_web_search,
+ }
+ )
+
+ # Add strategy-based research tools if enabled and not at max depth
+ logger.info(
+ f"Sub-research check: enabled={self.include_sub_research}, depth={self.depth}, max_depth={self.max_depth}"
+ )
+ if self.include_sub_research and self.depth < self.max_depth:
+ # Focused iteration - good for complex queries needing multiple angles
+ tools.append(
+ {
+ "name": "focused_research",
+ "description": "Deep focused research using iterative refinement. Best for complex topics that need multiple search angles and thorough analysis. Takes longer but provides comprehensive results with proper citations.",
+ "parameters": {
+ "query": {
+ "type": "string",
+ "description": "The specific research question to investigate",
+ "required": True,
+ }
+ },
+ "executor": lambda args: self._execute_strategy_research(
+ args, "focused-iteration"
+ ),
+ }
+ )
+
+ # Source-based - good for finding authoritative sources
+ tools.append(
+ {
+ "name": "source_research",
+ "description": "Source-focused research that prioritizes finding and extracting from authoritative sources. Best for factual queries where source credibility matters.",
+ "parameters": {
+ "query": {
+ "type": "string",
+ "description": "The specific research question to investigate",
+ "required": True,
+ }
+ },
+ "executor": lambda args: self._execute_strategy_research(
+ args, "source-based"
+ ),
+ }
+ )
+
+ # Standard iteration - quick multi-iteration search
+ tools.append(
+ {
+ "name": "quick_research",
+ "description": "Quick iterative research with multiple search rounds. Faster than focused_research but still thorough.",
+ "parameters": {
+ "query": {
+ "type": "string",
+ "description": "The specific research question to investigate",
+ "required": True,
+ }
+ },
+ "executor": lambda args: self._execute_strategy_research(
+ args, "standard"
+ ),
+ }
+ )
+
+ # Add specialized search engine tools dynamically from available engines
+ available_engines = self._get_available_search_engines()
+ for engine_name, engine_config in available_engines.items():
+ # Skip the currently selected engine (already available via web_search)
+ # Skip 'auto' and meta engines
+ if (
+ engine_name in ("auto", "meta")
+ or engine_name == self._get_current_engine_name()
+ ):
+ continue
+
+ # Create tool for this engine
+ description = engine_config.get(
+ "description", f"Search using {engine_name}"
+ )
+ strengths = engine_config.get("strengths", [])
+ if strengths:
+ description += f" Best for: {', '.join(strengths[: self.ENGINE_STRENGTHS_DISPLAY_LIMIT])}."
+
+ tools.append(
+ {
+ "name": f"search_{engine_name}",
+ "description": description,
+ "parameters": {
+ "query": {
+ "type": "string",
+ "description": "The search query",
+ "required": True,
+ }
+ },
+ "executor": lambda args,
+ eng=engine_name: self._execute_specialized_search(
+ args, eng
+ ),
+ }
+ )
+
+ # Add content download tool for fetching full papers/articles
+ tools.append(
+ {
+ "name": "download_content",
+ "description": "Download and extract full text content from a URL. Works with academic papers (arXiv, PubMed, Semantic Scholar, bioRxiv) and web pages. Use this when you need the complete text of a paper or article found in search results, not just the snippet.",
+ "parameters": {
+ "url": {
+ "type": "string",
+ "description": "The URL to download content from",
+ "required": True,
+ },
+ "max_length": {
+ "type": "integer",
+ "description": f"Maximum characters to return (default {self.DOWNLOAD_DEFAULT_MAX_LENGTH})",
+ "required": False,
+ },
+ },
+ "executor": self._execute_download_content,
+ }
+ )
+
+ # Add MCP tools (if configured)
+ mcp_tools = self._discover_mcp_tools()
+ tools.extend(mcp_tools)
+
+ return tools
+
+ def _discover_mcp_tools(self) -> List[Dict[str, Any]]:
+ """Discover tools from configured MCP servers.
+
+ Results are cached only on successful discovery to allow retry on failure.
+ """
+ # Return cached tools if available
+ if self._mcp_tools_cache is not None:
+ return self._mcp_tools_cache
+
+ tools = []
+
+ if not self.mcp_servers:
+ return tools
+
+ try:
+ from local_deep_research.mcp.client import (
+ MCPClientManager,
+ run_async,
+ )
+
+ async def discover():
+ manager = MCPClientManager(self.mcp_servers)
+ async with manager.connect_all():
+ return await manager.list_all_tools()
+
+ # Use shorter timeout for discovery instead of default 300s
+ all_tools = run_async(
+ discover(), timeout=self.MCP_DISCOVERY_TIMEOUT
+ )
+
+ for server_name, server_tools in all_tools.items():
+ for tool in server_tools:
+ tools.append(
+ {
+ "name": f"{server_name}.{tool['name']}",
+ "description": tool.get(
+ "description", "No description"
+ ),
+ "parameters": tool.get("input_schema", {}).get(
+ "properties", {}
+ ),
+ "mcp_server": server_name,
+ "mcp_tool": tool["name"],
+ }
+ )
+
+ # Only cache successful discoveries (when tools were found)
+ if tools:
+ self._mcp_tools_cache = tools
+ logger.info(f"Discovered and cached {len(tools)} MCP tools")
+
+ except Exception as e:
+ # Don't cache failures - allow retry on next call
+ logger.warning(f"Failed to discover MCP tools (will retry): {e}")
+
+ return tools
+
+ def _format_tool_descriptions(self, tools: List[Dict[str, Any]]) -> str:
+ """Format tool descriptions for the LLM."""
+ lines = []
+ for tool in tools:
+ params = tool.get("parameters", {})
+ param_str = ", ".join(
+ f"{k}: {v.get('type', 'any')}" for k, v in params.items()
+ )
+ lines.append(f"- **{tool['name']}**({param_str})")
+ lines.append(f" {tool['description']}")
+ lines.append("")
+ return "\n".join(lines)
+
+ def _format_history(self) -> str:
+ """Format the reasoning history for the LLM."""
+ if not self._history:
+ return "No research done yet."
+
+ lines = []
+ for entry in self._history:
+ role = entry.get("role", "")
+
+ if role == "assistant":
+ if "thought" in entry:
+ lines.append(f"THOUGHT: {entry['thought']}")
+ if "action" in entry:
+ lines.append(f"ACTION: {entry['action']}")
+ lines.append(
+ f"ARGUMENTS: {json.dumps(entry.get('arguments', {}))}"
+ )
+ if "answer" in entry:
+ lines.append(f"ANSWER: {entry['answer'][:500]}...")
+
+ elif role == "tool":
+ obs = entry.get("observation", "")
+ if len(obs) > self.HISTORY_OBSERVATION_MAX_LENGTH:
+ obs = obs[: self.HISTORY_OBSERVATION_MAX_LENGTH] + "..."
+ lines.append(
+ f"OBSERVATION ({entry.get('tool', 'unknown')}): {obs}"
+ )
+
+ elif role == "system":
+ if "error" in entry:
+ lines.append(f"SYSTEM: {entry['error']}")
+
+ lines.append("")
+
+ return "\n".join(lines)
+
+ def _get_llm_response(
+ self, query: str, tool_descriptions: str, tools: List[Dict[str, Any]]
+ ) -> str:
+ """Get a response from the LLM with tools bound for native tool calling."""
+ history = self._format_history()
+
+ prompt = REACT_USER_PROMPT.format(
+ query=query,
+ tool_descriptions=tool_descriptions,
+ history=history,
+ )
+
+ # Format system prompt with current date
+ current_date = datetime.now(UTC).strftime("%Y-%m-%d")
+ system_prompt = REACT_SYSTEM_PROMPT.format(current_date=current_date)
+
+ messages = [
+ {"role": "system", "content": system_prompt},
+ {"role": "user", "content": prompt},
+ ]
+
+ # Build tool schemas for native tool calling
+ tool_schemas = self._build_tool_schemas(tools)
+ logger.info(
+ f"Built {len(tool_schemas)} tool schemas: {[s['function']['name'] for s in tool_schemas]}"
+ )
+
+ # Bind tools to model if we have schemas
+ if tool_schemas:
+ try:
+ model_with_tools = self.model.bind_tools(tool_schemas)
+ response = model_with_tools.invoke(messages)
+ except Exception as e:
+ logger.warning(f"Failed to bind tools, using text-based: {e}")
+ response = self.model.invoke(messages)
+ else:
+ response = self.model.invoke(messages)
+
+ # Return the full response object so we can handle both text and tool calls
+ return response
+
+ def _build_tool_schemas(
+ self, tools: List[Dict[str, Any]]
+ ) -> List[Dict[str, Any]]:
+ """Build tool schemas for native LLM tool calling."""
+ schemas = []
+ for tool in tools:
+ # Build JSON schema for the tool
+ properties = {}
+ required = []
+ for param_name, param_info in tool.get("parameters", {}).items():
+ properties[param_name] = {
+ "type": param_info.get("type", "string"),
+ "description": param_info.get("description", ""),
+ }
+ if param_info.get("required", False):
+ required.append(param_name)
+
+ schema = {
+ "type": "function",
+ "function": {
+ "name": tool["name"],
+ "description": tool["description"],
+ "parameters": {
+ "type": "object",
+ "properties": properties,
+ "required": required,
+ },
+ },
+ }
+ schemas.append(schema)
+
+ return schemas
+
+ def _parse_response(self, response) -> Dict[str, Any]:
+ """Parse the LLM's response to extract thought/action/answer.
+
+ Handles both native tool calls and text-based responses.
+ """
+ # Check for native tool calls first (preferred)
+ if (
+ hasattr(response, "tool_calls")
+ and response.tool_calls
+ and len(response.tool_calls) > 0
+ ):
+ tool_call = response.tool_calls[0]
+ tool_name = tool_call.get("name", "unknown")
+ tool_args = tool_call.get("args", {})
+
+ # Get any text content as the "thought"
+ thought = ""
+ if hasattr(response, "content") and response.content:
+ thought = response.content
+ else:
+ thought = f"Calling {tool_name} to find information"
+
+ logger.info(f"Native tool call: {tool_name} with args {tool_args}")
+
+ return {
+ "type": "action",
+ "thought": thought,
+ "tool": tool_name,
+ "arguments": tool_args,
+ }
+
+ # Extract text content for text-based parsing
+ if hasattr(response, "content"):
+ response = response.content
+ response = str(response).strip()
+
+ # Log raw response at INFO level so we can see what the LLM generates
+ logger.info(
+ f"Raw LLM response ({len(response)} chars): {response[:800]}..."
+ )
+
+ # Try to extract THOUGHT
+ thought = ""
+ thought_match = re.search(
+ r"THOUGHT:\s*(.+?)(?=(?:ACTION:|ANSWER:|$))",
+ response,
+ re.DOTALL | re.IGNORECASE,
+ )
+ if thought_match:
+ thought = thought_match.group(1).strip()
+
+ # Check for ANSWER
+ answer_match = re.search(
+ r"ANSWER:\s*(.+)", response, re.DOTALL | re.IGNORECASE
+ )
+ if answer_match:
+ return {
+ "type": "answer",
+ "thought": thought,
+ "content": answer_match.group(1).strip(),
+ }
+
+ # Check for ACTION
+ action_match = re.search(r"ACTION:\s*(\S+)", response, re.IGNORECASE)
+ if action_match:
+ tool_name = action_match.group(1).strip()
+
+ # Try to extract ARGUMENTS using centralized JSON parser
+ arguments = {}
+ args_section = re.search(
+ r"ARGUMENTS:\s*(.+?)(?=(?:THOUGHT:|ACTION:|ANSWER:|$))",
+ response,
+ re.DOTALL | re.IGNORECASE,
+ )
+ if args_section:
+ parsed_args = extract_json(
+ args_section.group(1), expected_type=dict
+ )
+ if parsed_args is not None:
+ arguments = parsed_args
+ else:
+ logger.warning(
+ f"Failed to parse ARGUMENTS JSON: {args_section.group(1)[:200]}"
+ )
+
+ # If no JSON arguments, try to find query parameter
+ if not arguments:
+ query_match = re.search(
+ r'["\']?query["\']?\s*[:=]\s*["\'](.+?)["\']',
+ response,
+ re.IGNORECASE,
+ )
+ if query_match:
+ arguments = {"query": query_match.group(1)}
+
+ return {
+ "type": "action",
+ "thought": thought,
+ "tool": tool_name,
+ "arguments": arguments,
+ }
+
+ # FALLBACK: Try to detect intent from response even without proper format
+ response_lower = response.lower()
+
+ # Check if model wants to search (common patterns)
+ search_patterns = [
+ r"(?:let me |i will |i should |i need to |going to )(?:search|look up|find|research)",
+ r"search(?:ing)? for",
+ r"look(?:ing)? up",
+ r"find(?:ing)? information",
+ ]
+ for pattern in search_patterns:
+ if re.search(pattern, response_lower):
+ # Extract what they want to search for
+ # Try to find quoted text or text after "for" or "about"
+ search_query = None
+ quoted = re.search(r'["\']([^"\']+)["\']', response)
+ if quoted:
+ search_query = quoted.group(1)
+ else:
+ about_match = re.search(
+ r"(?:for|about|on)\s+(.+?)(?:\.|$)",
+ response,
+ re.IGNORECASE,
+ )
+ if about_match:
+ search_query = about_match.group(1).strip()[:100]
+
+ if search_query:
+ logger.info(
+ f"Fallback parser detected search intent: {search_query}"
+ )
+ return {
+ "type": "action",
+ "thought": response[: self.THOUGHT_PREVIEW_LENGTH],
+ "tool": "web_search",
+ "arguments": {"query": search_query},
+ }
+
+ # If response is long and looks like a direct answer, treat as answer
+ if len(response) > self.DIRECT_ANSWER_MIN_LENGTH:
+ logger.info("Fallback parser treating long response as answer")
+ return {
+ "type": "answer",
+ "thought": "Model provided direct answer without following format",
+ "content": response,
+ }
+
+ # If we can't parse, return error with the full raw response for display
+ logger.warning(f"Could not parse LLM response: {response[:300]}...")
+ return {
+ "type": "error",
+ "message": "Could not parse response. Expected THOUGHT/ACTION or THOUGHT/ANSWER format.",
+ "raw": response, # Include full response so user can see what LLM said
+ }
+
+ def _validate_tool_arguments(
+ self, arguments: Dict[str, Any]
+ ) -> Dict[str, Any]:
+ """
+ Validate and sanitize tool arguments.
+
+ Args:
+ arguments: Raw arguments from LLM
+
+ Returns:
+ Sanitized arguments dictionary
+ """
+ if not isinstance(arguments, dict):
+ return {}
+
+ sanitized = {}
+ for key, value in arguments.items():
+ # Ensure key is a string
+ if not isinstance(key, str):
+ continue
+ # Truncate very long string values
+ if isinstance(value, str) and len(value) > self.MAX_ARG_LENGTH:
+ value = value[: self.MAX_ARG_LENGTH]
+ logger.warning(
+ f"Truncated argument '{key}' to {self.MAX_ARG_LENGTH} chars"
+ )
+ sanitized[key] = value
+
+ return sanitized
+
+ def _execute_tool(
+ self,
+ tool_name: str,
+ arguments: Dict[str, Any],
+ tools: List[Dict[str, Any]],
+ ) -> Dict[str, Any]:
+ """Execute a tool and return the result."""
+ # Validate and sanitize arguments
+ arguments = self._validate_tool_arguments(arguments)
+
+ # Find the tool
+ tool = None
+ for t in tools:
+ if t["name"] == tool_name:
+ tool = t
+ break
+
+ if not tool:
+ return {"status": "error", "content": f"Unknown tool: {tool_name}"}
+
+ # Execute based on tool type
+ if "executor" in tool:
+ # Built-in tool with executor function
+ return tool["executor"](arguments)
+ elif "mcp_server" in tool:
+ # MCP tool
+ return self._execute_mcp_tool(
+ tool["mcp_server"],
+ tool["mcp_tool"],
+ arguments,
+ )
+ else:
+ return {
+ "status": "error",
+ "content": f"Tool {tool_name} has no executor",
+ }
+
+ def _execute_web_search(self, arguments: Dict[str, Any]) -> Dict[str, Any]:
+ """Execute web search tool."""
+ query = arguments.get("query", "")
+ if not query:
+ return {"status": "error", "content": "No query provided"}
+
+ try:
+ results = self.search.run(query)
+
+ # Track sources and accumulate search results for citation handling
+ if isinstance(results, list):
+ # Handle empty results
+ if not results:
+ logger.info(f"Web search returned no results for: {query}")
+ return {
+ "status": "success",
+ "content": f"No search results found for '{query}'. Try rephrasing the query or using a different search approach.",
+ }
+
+ for r in results:
+ if isinstance(r, dict):
+ # Track source URLs
+ if "link" in r:
+ self._sources.append(r["link"])
+
+ # Add to all_search_results for citation handler
+ # Assign index based on current count
+ result_with_index = dict(r)
+ result_with_index["index"] = str(
+ len(self.all_search_results) + 1
+ )
+ self.all_search_results.append(result_with_index)
+
+ # Also add to shared links
+ if self.all_links_of_system is not None:
+ self.all_links_of_system.append(result_with_index)
+
+ # Format with index, title, URL, and snippet for LLM
+ content = "\n\n".join(
+ f"[{len(self.all_search_results) - len(results) + i + 1}] {r.get('title', 'No title')} ({r.get('link', 'no url')})\n{r.get('snippet', r.get('body', ''))}"
+ for i, r in enumerate(results)
+ if isinstance(r, dict)
+ )
+ else:
+ content = str(results)
+
+ # Add to findings
+ self._findings.append(
+ {
+ "type": "web_search",
+ "query": query,
+ "result_count": len(results)
+ if isinstance(results, list)
+ else 1,
+ }
+ )
+
+ return {"status": "success", "content": content}
+
+ except Exception as e:
+ logger.exception("Web search failed")
+ return {"status": "error", "content": f"Search failed: {e}"}
+
+ def _execute_download_content(
+ self, arguments: Dict[str, Any]
+ ) -> Dict[str, Any]:
+ """Execute content download tool.
+
+ Downloads full text content from URLs including academic papers
+ (arXiv, PubMed, Semantic Scholar) and web pages.
+ """
+ url = arguments.get("url", "")
+ if not url:
+ return {"status": "error", "content": "No URL provided"}
+
+ max_length = arguments.get(
+ "max_length", self.DOWNLOAD_DEFAULT_MAX_LENGTH
+ )
+
+ try:
+ from local_deep_research.content_fetcher import ContentFetcher
+
+ fetcher = ContentFetcher(timeout=self.CONTENT_FETCHER_TIMEOUT)
+ result = fetcher.fetch(url, max_length=max_length)
+
+ if result.get("status") == "success":
+ content = result.get("content", "")
+ source_type = result.get("source_type", "unknown")
+ title = result.get("title", "")
+
+ # Format output
+ output_parts = []
+ if title:
+ output_parts.append(f"Title: {title}")
+ output_parts.append(f"Source: {source_type}")
+ output_parts.append(f"URL: {url}")
+ output_parts.append("")
+ output_parts.append(content)
+
+ formatted_content = "\n".join(output_parts)
+
+ # Track as a finding
+ self._findings.append(
+ {
+ "type": "content_download",
+ "url": url,
+ "source_type": source_type,
+ "title": title,
+ "content_length": len(content),
+ }
+ )
+
+ # Track source
+ self._sources.append(url)
+
+ logger.info(
+ f"Downloaded {len(content)} chars from {source_type}: {url}"
+ )
+
+ return {"status": "success", "content": formatted_content}
+
+ else:
+ error_msg = result.get("error", "Download failed")
+ logger.warning(f"Content download failed: {error_msg}")
+ return {"status": "error", "content": error_msg}
+
+ except ImportError:
+ logger.warning("ContentFetcher not available")
+ return {
+ "status": "error",
+ "content": "Content fetcher module not available",
+ }
+ except Exception as e:
+ logger.exception(f"Content download failed for {url}")
+ return {"status": "error", "content": f"Download failed: {e}"}
+
+ def _execute_strategy_research(
+ self, arguments: Dict[str, Any], strategy_name: str
+ ) -> Dict[str, Any]:
+ """Execute research using a specific strategy.
+
+ This delegates to other research strategies (focused-iteration,
+ source-based, comprehensive) for deeper investigation.
+ """
+ sub_query = arguments.get("query", "")
+ if not sub_query:
+ return {"status": "error", "content": "No query provided"}
+
+ # Check recursion depth
+ if self.depth >= self.max_depth:
+ return {
+ "status": "error",
+ "content": f"Maximum research depth ({self.max_depth}) reached",
+ }
+
+ try:
+ logger.info(
+ f"Delegating to {strategy_name} strategy: {sub_query[:100]}"
+ )
+
+ self._update_progress(
+ f"DELEGATING to {strategy_name}: {sub_query[:80]}...",
+ 50,
+ {
+ "phase": "sub_research",
+ "strategy": strategy_name,
+ "depth": self.depth + 1,
+ "query": sub_query[:100],
+ },
+ )
+
+ # Import factory to create strategy
+ from local_deep_research.search_system_factory import (
+ create_strategy,
+ )
+
+ # Create the delegated strategy with incremented depth
+ child_strategy = create_strategy(
+ strategy_name=strategy_name,
+ model=self.model,
+ search=self.search,
+ all_links_of_system=self.all_links_of_system,
+ settings_snapshot=self.settings_snapshot,
+ depth=self.depth + 1,
+ max_depth=self.max_depth,
+ )
+
+ # Run the research
+ result = child_strategy.analyze_topic(sub_query)
+
+ # Merge sources from child into parent
+ child_sources = []
+ child_findings = result.get("findings", [])
+ logger.info(
+ f"MCP Strategy: Merging sources from {strategy_name}, got {len(child_findings)} findings"
+ )
+ for finding in child_findings:
+ finding_sources = finding.get("search_results", [])
+ logger.info(
+ f"MCP Strategy: Finding has {len(finding_sources)} search_results"
+ )
+ for source in finding_sources:
+ # Re-index sources to continue from parent's count
+ source_copy = dict(source)
+ source_copy["index"] = str(len(self.all_search_results) + 1)
+ self.all_search_results.append(source_copy)
+ child_sources.append(source_copy)
+
+ if self.all_links_of_system is not None:
+ self.all_links_of_system.append(source_copy)
+
+ logger.info(
+ f"MCP Strategy: After merge, all_search_results has {len(self.all_search_results)} items"
+ )
+
+ # Add findings to parent
+ for finding in child_findings:
+ finding["from_strategy"] = strategy_name
+ finding["sub_query"] = sub_query
+ self._findings.append(finding)
+
+ # Track sources (only strings)
+ for src in result.get("sources", []):
+ if isinstance(src, str):
+ self._sources.append(src)
+ elif isinstance(src, dict) and "link" in src:
+ self._sources.append(src["link"])
+
+ # Return the synthesized content
+ content = result.get("formatted_findings", "")
+ if not content:
+ content = result.get("current_knowledge", "No results found")
+
+ # Add source references to the content
+ if child_sources:
+ source_refs = ", ".join(
+ f"[{s.get('index', '?')}]"
+ for s in child_sources[-self.SOURCE_REFS_DISPLAY_LIMIT :]
+ )
+ content = f"{content}\n\nSources: {source_refs}"
+
+ logger.info(
+ f"{strategy_name} research completed with {len(child_sources)} sources"
+ )
+
+ return {"status": "success", "content": content}
+
+ except Exception as e:
+ logger.exception(f"{strategy_name} research failed")
+ return {
+ "status": "error",
+ "content": f"{strategy_name} research failed: {e}",
+ }
+
+ def _get_available_search_engines(self) -> Dict[str, Any]:
+ """Get all available search engines from configuration."""
+ try:
+ from local_deep_research.web_search_engines.search_engines_config import (
+ search_config,
+ )
+
+ if self.settings_snapshot:
+ return search_config(settings_snapshot=self.settings_snapshot)
+ return {}
+ except Exception as e:
+ logger.warning(f"Failed to get available search engines: {e}")
+ return {}
+
+ def _get_current_engine_name(self) -> str:
+ """Get the name of the currently selected search engine."""
+ try:
+ if hasattr(self.search, "__class__"):
+ # Extract engine name from class name
+ class_name = self.search.__class__.__name__
+ # Convert "ArXivSearchEngine" -> "arxiv"
+ name = class_name.replace("SearchEngine", "").lower()
+ return name
+ except Exception:
+ pass
+ return ""
+
+ def _execute_specialized_search(
+ self, arguments: Dict[str, Any], engine_name: str
+ ) -> Dict[str, Any]:
+ """Execute search using a specific search engine."""
+ query = arguments.get("query", "")
+ if not query:
+ return {"status": "error", "content": "No query provided"}
+
+ try:
+ from local_deep_research.web_search_engines.search_engine_factory import (
+ create_search_engine,
+ )
+
+ logger.info(f"Specialized search with {engine_name}: {query[:100]}")
+
+ # Create the specialized search engine
+ engine = create_search_engine(
+ engine_name=engine_name,
+ llm=self.model,
+ settings_snapshot=self.settings_snapshot,
+ )
+
+ if not engine:
+ return {
+ "status": "error",
+ "content": f"Failed to create {engine_name} search engine",
+ }
+
+ # Run the search
+ results = engine.run(query)
+
+ # Track sources and accumulate search results
+ if isinstance(results, list):
+ for r in results:
+ if isinstance(r, dict):
+ if "link" in r:
+ self._sources.append(r["link"])
+
+ result_with_index = dict(r)
+ result_with_index["index"] = str(
+ len(self.all_search_results) + 1
+ )
+ result_with_index["source_engine"] = engine_name
+ self.all_search_results.append(result_with_index)
+
+ if self.all_links_of_system is not None:
+ self.all_links_of_system.append(result_with_index)
+
+ # Format results for LLM
+ content = "\n\n".join(
+ f"[{len(self.all_search_results) - len(results) + i + 1}] {r.get('title', 'No title')} ({r.get('link', 'no url')})\n{r.get('snippet', r.get('body', ''))}"
+ for i, r in enumerate(results)
+ if isinstance(r, dict)
+ )
+ else:
+ content = str(results)
+
+ self._findings.append(
+ {
+ "type": "specialized_search",
+ "engine": engine_name,
+ "query": query,
+ "result_count": len(results)
+ if isinstance(results, list)
+ else 1,
+ }
+ )
+
+ return {"status": "success", "content": content}
+
+ except Exception as e:
+ logger.exception(f"Specialized search with {engine_name} failed")
+ return {
+ "status": "error",
+ "content": f"{engine_name} search failed: {e}",
+ }
+
+ def _execute_mcp_tool(
+ self,
+ server_name: str,
+ tool_name: str,
+ arguments: Dict[str, Any],
+ timeout: Optional[float] = None,
+ ) -> Dict[str, Any]:
+ """Execute an MCP tool.
+
+ Args:
+ server_name: Name of the MCP server
+ tool_name: Name of the tool to call
+ arguments: Arguments to pass to the tool
+ timeout: Timeout in seconds for the tool call
+ (defaults to MCP_TOOL_CALL_TIMEOUT)
+ """
+ if timeout is None:
+ timeout = self.MCP_TOOL_CALL_TIMEOUT
+ try:
+ from local_deep_research.mcp.client import (
+ MCPClientManager,
+ run_async,
+ )
+
+ # Find the server config
+ server_config = None
+ for config in self.mcp_servers:
+ if config.get("name") == server_name:
+ server_config = config
+ break
+
+ if not server_config:
+ return {
+ "status": "error",
+ "content": f"Unknown server: {server_name}",
+ }
+
+ async def call():
+ manager = MCPClientManager([server_config])
+ async with manager.connect_all():
+ return await manager.call_tool(
+ server_name, tool_name, arguments
+ )
+
+ result = run_async(call(), timeout=timeout)
+
+ # Ensure result is a dict
+ if not isinstance(result, dict):
+ result = {
+ "status": "success",
+ "content": str(result) if result else "",
+ }
+
+ # Track findings
+ self._findings.append(
+ {
+ "type": "mcp_tool",
+ "server": server_name,
+ "tool": tool_name,
+ "arguments": arguments,
+ }
+ )
+
+ return result
+
+ except Exception as e:
+ logger.exception("MCP tool call failed")
+ return {"status": "error", "content": f"MCP tool failed: {e}"}
+
+ def _synthesize_answer(self, query: str) -> str:
+ """Synthesize an answer from the gathered information when max iterations reached."""
+ history = self._format_history()
+
+ prompt = f"""Based on the research conducted, provide a comprehensive answer to the query.
+
+Query: {query}
+
+Research History:
+{history}
+
+Please synthesize all the information gathered into a clear, comprehensive answer.
+If some information is missing, note what couldn't be found."""
+
+ try:
+ response = self.model.invoke(prompt)
+ if hasattr(response, "content"):
+ return response.content
+ return str(response)
+ except Exception as e:
+ logger.exception("Failed to synthesize answer")
+ return f"Research completed but synthesis failed: {e}"
+
+ def _create_error_response(self, error: str) -> Dict:
+ """Create an error response."""
+ return {
+ "findings": [],
+ "iterations": 0,
+ "questions": {},
+ "formatted_findings": f"Error: {error}",
+ "current_knowledge": "",
+ "error": error,
+ }
diff --git a/src/local_deep_research/advanced_search_system/strategies/standard_strategy.py b/src/local_deep_research/advanced_search_system/strategies/standard_strategy.py
index f5958112e6..c72e6c11d3 100644
--- a/src/local_deep_research/advanced_search_system/strategies/standard_strategy.py
+++ b/src/local_deep_research/advanced_search_system/strategies/standard_strategy.py
@@ -37,7 +37,9 @@ class StandardSearchStrategy(BaseSearchStrategy):
# Get iterations setting
self.max_iterations = int(
get_setting_from_snapshot(
- "search.iterations", settings_snapshot=settings_snapshot
+ "search.iterations",
+ settings_snapshot=settings_snapshot,
+ default=3,
)
)
@@ -45,12 +47,14 @@ class StandardSearchStrategy(BaseSearchStrategy):
get_setting_from_snapshot(
"search.questions_per_iteration",
settings_snapshot=settings_snapshot,
+ default=1,
)
)
self.context_limit = int(
get_setting_from_snapshot(
"general.knowledge_accumulation_context_limit",
settings_snapshot=settings_snapshot,
+ default=2000000,
)
)
# Note: questions_by_iteration is already initialized by parent class
diff --git a/src/local_deep_research/api/research_functions.py b/src/local_deep_research/api/research_functions.py
index ecdf6afa11..1c3e2b3601 100644
--- a/src/local_deep_research/api/research_functions.py
+++ b/src/local_deep_research/api/research_functions.py
@@ -221,22 +221,20 @@ def quick_summary(
if max_search_results is not None:
snapshot_kwargs["max_search_results"] = max_search_results
- # Create settings snapshot for programmatic use (only if not already provided)
- if "settings_snapshot" not in kwargs:
- kwargs["settings_snapshot"] = create_settings_snapshot(
- base_settings=settings,
- overrides=settings_override,
- **snapshot_kwargs,
- )
- log_settings(
- kwargs["settings_snapshot"],
- "Created settings snapshot for programmatic API",
- )
- else:
- log_settings(
- kwargs["settings_snapshot"],
- "Using provided settings snapshot for programmatic API",
- )
+ kwargs["settings_snapshot"] = create_settings_snapshot(
+ base_settings=settings,
+ overrides=settings_override,
+ **snapshot_kwargs,
+ )
+ log_settings(
+ kwargs["settings_snapshot"],
+ "Created settings snapshot for programmatic API",
+ )
+ else:
+ log_settings(
+ kwargs["settings_snapshot"],
+ "Using provided settings snapshot for programmatic API",
+ )
# Generate a research_id if none provided
if research_id is None:
@@ -295,7 +293,9 @@ def quick_summary(
else:
summary = "Unable to generate summary for the query."
- # Prepare the return value
+ # Prepare the return value (guard against None results)
+ if results is None:
+ results = {}
return {
"research_id": research_id,
"summary": summary,
@@ -378,22 +378,20 @@ def generate_report(
if max_search_results is not None:
snapshot_kwargs["max_search_results"] = max_search_results
- # Create settings snapshot for programmatic use (only if not already provided)
- if "settings_snapshot" not in kwargs:
- kwargs["settings_snapshot"] = create_settings_snapshot(
- base_settings=settings,
- overrides=settings_override,
- **snapshot_kwargs,
- )
- log_settings(
- kwargs["settings_snapshot"],
- "Created settings snapshot for programmatic API",
- )
- else:
- log_settings(
- kwargs["settings_snapshot"],
- "Using provided settings snapshot for programmatic API",
- )
+ kwargs["settings_snapshot"] = create_settings_snapshot(
+ base_settings=settings,
+ overrides=settings_override,
+ **snapshot_kwargs,
+ )
+ log_settings(
+ kwargs["settings_snapshot"],
+ "Created settings snapshot for programmatic API",
+ )
+ else:
+ log_settings(
+ kwargs["settings_snapshot"],
+ "Using provided settings snapshot for programmatic API",
+ )
# Register retrievers if provided
if retrievers:
@@ -512,7 +510,9 @@ def detailed_research(
# Perform detailed research
results = system.analyze_topic(query)
- # Return comprehensive results
+ # Return comprehensive results (guard against None results)
+ if results is None:
+ results = {}
return {
"query": query,
"research_id": research_id,
diff --git a/src/local_deep_research/content_fetcher/__init__.py b/src/local_deep_research/content_fetcher/__init__.py
new file mode 100644
index 0000000000..363c56d180
--- /dev/null
+++ b/src/local_deep_research/content_fetcher/__init__.py
@@ -0,0 +1,20 @@
+"""
+Content Fetcher Module.
+
+Provides unified content fetching from various sources:
+- Academic papers (arXiv, PubMed, Semantic Scholar, bioRxiv)
+- Web pages (HTML)
+- Direct PDF links
+
+Usage:
+ from local_deep_research.content_fetcher import ContentFetcher
+
+ fetcher = ContentFetcher()
+ result = fetcher.fetch("https://arxiv.org/abs/2301.12345")
+ print(result["content"])
+"""
+
+from .fetcher import ContentFetcher
+from .url_classifier import URLClassifier, URLType
+
+__all__ = ["ContentFetcher", "URLClassifier", "URLType"]
diff --git a/src/local_deep_research/content_fetcher/fetcher.py b/src/local_deep_research/content_fetcher/fetcher.py
new file mode 100644
index 0000000000..2982ae91b9
--- /dev/null
+++ b/src/local_deep_research/content_fetcher/fetcher.py
@@ -0,0 +1,299 @@
+"""
+Unified Content Fetcher.
+
+Provides a single interface to fetch content from various sources:
+- Academic papers (arXiv, PubMed, Semantic Scholar)
+- Web pages (HTML)
+- Direct PDF links
+"""
+
+from typing import Any, Dict, Optional
+from loguru import logger
+
+from .url_classifier import URLClassifier, URLType
+from ..research_library.downloaders.base import ContentType
+from ..security.ssrf_validator import validate_url
+
+# Default maximum content length (500KB of text)
+DEFAULT_MAX_CONTENT_LENGTH = 500_000
+
+
+class ContentFetcher:
+ """
+ Unified content fetcher that routes to appropriate downloaders.
+
+ Automatically detects URL type and uses the best downloader.
+ """
+
+ def __init__(self, timeout: int = 30):
+ """
+ Initialize the content fetcher.
+
+ Args:
+ timeout: Request timeout in seconds
+ """
+ self.timeout = timeout
+ self._downloaders: Dict[URLType, Any] = {}
+
+ def _get_downloader(self, url_type: URLType):
+ """Get or create the appropriate downloader for a URL type."""
+ if url_type in self._downloaders:
+ return self._downloaders[url_type]
+
+ downloader = None
+
+ if url_type == URLType.ARXIV:
+ try:
+ from ..research_library.downloaders.arxiv import ArxivDownloader
+
+ downloader = ArxivDownloader(timeout=self.timeout)
+ except ImportError:
+ logger.warning("ArxivDownloader not available")
+
+ elif url_type in (URLType.PUBMED, URLType.PMC):
+ try:
+ from ..research_library.downloaders.pubmed import (
+ PubMedDownloader,
+ )
+
+ downloader = PubMedDownloader(timeout=self.timeout)
+ except ImportError:
+ logger.warning("PubMedDownloader not available")
+
+ elif url_type == URLType.SEMANTIC_SCHOLAR:
+ try:
+ from ..research_library.downloaders.semantic_scholar import (
+ SemanticScholarDownloader,
+ )
+
+ downloader = SemanticScholarDownloader(timeout=self.timeout)
+ except ImportError:
+ logger.warning("SemanticScholarDownloader not available")
+
+ elif url_type in (URLType.BIORXIV, URLType.MEDRXIV):
+ try:
+ from ..research_library.downloaders.biorxiv import (
+ BioRxivDownloader,
+ )
+
+ downloader = BioRxivDownloader(timeout=self.timeout)
+ except ImportError:
+ logger.warning("BioRxivDownloader not available")
+
+ elif url_type == URLType.PDF:
+ try:
+ from ..research_library.downloaders.direct_pdf import (
+ DirectPDFDownloader,
+ )
+
+ downloader = DirectPDFDownloader(timeout=self.timeout)
+ except ImportError:
+ logger.warning("DirectPDFDownloader not available")
+
+ elif url_type == URLType.HTML:
+ try:
+ from ..research_library.downloaders.html import HTMLDownloader
+
+ downloader = HTMLDownloader(timeout=self.timeout)
+ except ImportError:
+ logger.warning("HTMLDownloader not available")
+
+ elif url_type == URLType.DOI:
+ # DOI URLs typically redirect to publisher pages
+ # Use HTML downloader as fallback
+ try:
+ from ..research_library.downloaders.html import HTMLDownloader
+
+ downloader = HTMLDownloader(timeout=self.timeout)
+ except ImportError:
+ logger.warning("HTMLDownloader not available")
+
+ # Cache the downloader
+ if downloader:
+ self._downloaders[url_type] = downloader
+
+ return downloader
+
+ def fetch(
+ self,
+ url: str,
+ max_length: Optional[int] = None,
+ prefer_text: bool = True,
+ ) -> Dict[str, Any]:
+ """
+ Fetch content from a URL.
+
+ Automatically detects the URL type and uses the appropriate downloader.
+
+ Args:
+ url: The URL to fetch content from
+ max_length: Maximum content length to return (chars). Defaults to 500KB.
+ prefer_text: If True, prefer text extraction over PDF download
+
+ Returns:
+ Dict with:
+ - status: "success" or "error"
+ - content: Extracted text content
+ - url: Original URL
+ - source_type: Type of source (arxiv, pubmed, html, etc.)
+ - title: Title if available
+ - error: Error message if failed
+ """
+ # Apply default max_length if not specified
+ if max_length is None:
+ max_length = DEFAULT_MAX_CONTENT_LENGTH
+
+ # Classify the URL
+ url_type = URLClassifier.classify(url)
+ source_name = URLClassifier.get_source_name(url_type)
+
+ # Reject invalid/dangerous URLs
+ if url_type == URLType.INVALID:
+ return {
+ "status": "error",
+ "url": url,
+ "source_type": source_name,
+ "error": "Invalid or unsupported URL scheme (only http/https allowed)",
+ }
+
+ # SSRF validation: reject private/internal IPs before reaching downloaders
+ if not validate_url(url):
+ logger.warning(f"URL failed SSRF validation: {url}")
+ return {
+ "status": "error",
+ "url": url,
+ "source_type": source_name,
+ "error": "URL failed security validation (blocked by SSRF protection)",
+ }
+
+ logger.info(f"Fetching content from {url} (detected: {source_name})")
+
+ # Get the appropriate downloader
+ downloader = self._get_downloader(url_type)
+
+ if not downloader:
+ # Fall back to HTML downloader
+ try:
+ from ..research_library.downloaders.html import HTMLDownloader
+
+ downloader = HTMLDownloader(timeout=self.timeout)
+ except ImportError:
+ return {
+ "status": "error",
+ "url": url,
+ "source_type": source_name,
+ "error": "No suitable downloader available",
+ }
+
+ # Determine content type
+ content_type = ContentType.TEXT if prefer_text else ContentType.PDF
+
+ # Download content
+ try:
+ result = downloader.download_with_result(url, content_type)
+
+ if result.is_success and result.content:
+ # Decode content — check PDF magic bytes first, then try
+ # UTF-8, and reject anything that is neither.
+ if result.content[:4] == b"%PDF":
+ from ..research_library.downloaders.base import (
+ BaseDownloader,
+ )
+
+ content = BaseDownloader.extract_text_from_pdf(
+ result.content
+ )
+ if not content:
+ return {
+ "status": "error",
+ "url": url,
+ "source_type": source_name,
+ "error": "Could not extract text from PDF",
+ }
+ else:
+ try:
+ content = result.content.decode("utf-8")
+ except UnicodeDecodeError:
+ return {
+ "status": "error",
+ "url": url,
+ "source_type": source_name,
+ "error": "Content is not valid UTF-8 and not a PDF",
+ }
+
+ # Truncate if needed
+ if max_length and len(content) > max_length:
+ content = (
+ content[:max_length] + "\n\n[... content truncated ...]"
+ )
+
+ # Try to get metadata
+ metadata = {}
+ if hasattr(downloader, "get_metadata"):
+ try:
+ metadata = downloader.get_metadata(url)
+ except Exception:
+ pass
+
+ return {
+ "status": "success",
+ "content": content,
+ "url": url,
+ "source_type": source_name,
+ "title": metadata.get("title"),
+ "author": metadata.get("author"),
+ "published_date": metadata.get("published_date"),
+ }
+
+ else:
+ return {
+ "status": "error",
+ "url": url,
+ "source_type": source_name,
+ "error": result.skip_reason or "Download failed",
+ }
+
+ except Exception as e:
+ logger.exception(f"Error fetching content from {url}")
+ return {
+ "status": "error",
+ "url": url,
+ "source_type": source_name,
+ "error": str(e),
+ }
+
+ def fetch_text(
+ self, url: str, max_length: Optional[int] = None
+ ) -> Optional[str]:
+ """
+ Convenience method to fetch just the text content.
+
+ Args:
+ url: The URL to fetch
+ max_length: Maximum content length
+
+ Returns:
+ Text content or None if failed
+ """
+ result = self.fetch(url, max_length=max_length, prefer_text=True)
+ if result.get("status") == "success":
+ return result.get("content")
+ return None
+
+ def get_url_info(self, url: str) -> Dict[str, Any]:
+ """
+ Get information about a URL without downloading.
+
+ Args:
+ url: The URL to analyze
+
+ Returns:
+ Dict with url_type, source_name, and extracted_id
+ """
+ url_type = URLClassifier.classify(url)
+ return {
+ "url": url,
+ "url_type": url_type.value,
+ "source_name": URLClassifier.get_source_name(url_type),
+ "extracted_id": URLClassifier.extract_id(url, url_type),
+ }
diff --git a/src/local_deep_research/content_fetcher/url_classifier.py b/src/local_deep_research/content_fetcher/url_classifier.py
new file mode 100644
index 0000000000..0ba1b00dc5
--- /dev/null
+++ b/src/local_deep_research/content_fetcher/url_classifier.py
@@ -0,0 +1,242 @@
+"""
+URL Classifier for content fetching.
+
+Determines the type of URL to route to the appropriate downloader.
+"""
+
+import re
+from enum import Enum
+from typing import Optional
+from urllib.parse import urlparse
+
+
+class URLType(Enum):
+ """Types of URLs we can handle."""
+
+ ARXIV = "arxiv"
+ PUBMED = "pubmed"
+ PMC = "pmc" # PubMed Central
+ SEMANTIC_SCHOLAR = "semantic_scholar"
+ BIORXIV = "biorxiv"
+ MEDRXIV = "medrxiv"
+ DOI = "doi"
+ PDF = "pdf" # Direct PDF link
+ HTML = "html" # Generic web page
+ INVALID = "invalid" # Dangerous/unsupported URL schemes
+
+
+# URL schemes that should be rejected (security risk)
+DANGEROUS_SCHEMES = {"javascript", "data", "file", "vbscript", "about"}
+
+
+class URLClassifier:
+ """Classifies URLs to determine the appropriate downloader."""
+
+ # ArXiv patterns
+ ARXIV_PATTERNS = [
+ r"arxiv\.org/abs/",
+ r"arxiv\.org/pdf/",
+ r"arxiv\.org/html/",
+ r"ar5iv\.org/",
+ ]
+
+ # PubMed patterns
+ PUBMED_PATTERNS = [
+ r"pubmed\.ncbi\.nlm\.nih\.gov/\d+",
+ r"ncbi\.nlm\.nih\.gov/pubmed/\d+",
+ ]
+
+ # PMC patterns (PubMed Central - full text)
+ # Note: patterns match lowercase since URLs are lowercased before matching
+ PMC_PATTERNS = [
+ r"ncbi\.nlm\.nih\.gov/pmc/articles/pmc",
+ r"europepmc\.org/article/pmc",
+ r"europepmc\.org/articles/pmc",
+ ]
+
+ # Semantic Scholar patterns
+ SEMANTIC_SCHOLAR_PATTERNS = [
+ r"semanticscholar\.org/paper/",
+ r"api\.semanticscholar\.org/",
+ ]
+
+ # BioRxiv/MedRxiv patterns
+ BIORXIV_PATTERNS = [
+ r"biorxiv\.org/content/",
+ ]
+
+ MEDRXIV_PATTERNS = [
+ r"medrxiv\.org/content/",
+ ]
+
+ # DOI patterns
+ DOI_PATTERNS = [
+ r"doi\.org/10\.",
+ r"dx\.doi\.org/10\.",
+ ]
+
+ @classmethod
+ def classify(cls, url: str) -> URLType:
+ """
+ Classify a URL to determine its type.
+
+ Args:
+ url: The URL to classify
+
+ Returns:
+ URLType enum indicating the type of content
+ """
+ url_lower = url.lower().strip()
+
+ # Check for dangerous URL schemes first (security)
+ try:
+ parsed = urlparse(url_lower)
+ if parsed.scheme in DANGEROUS_SCHEMES:
+ return URLType.INVALID
+ # Only allow http/https schemes
+ if parsed.scheme and parsed.scheme not in ("http", "https", ""):
+ return URLType.INVALID
+ except Exception:
+ return URLType.INVALID
+
+ # Check for direct PDF link first
+ if cls._is_pdf_url(url_lower):
+ return URLType.PDF
+
+ # Check specific academic sources
+ for pattern in cls.ARXIV_PATTERNS:
+ if re.search(pattern, url_lower):
+ return URLType.ARXIV
+
+ for pattern in cls.PMC_PATTERNS:
+ if re.search(pattern, url_lower):
+ return URLType.PMC
+
+ for pattern in cls.PUBMED_PATTERNS:
+ if re.search(pattern, url_lower):
+ return URLType.PUBMED
+
+ for pattern in cls.SEMANTIC_SCHOLAR_PATTERNS:
+ if re.search(pattern, url_lower):
+ return URLType.SEMANTIC_SCHOLAR
+
+ for pattern in cls.BIORXIV_PATTERNS:
+ if re.search(pattern, url_lower):
+ return URLType.BIORXIV
+
+ for pattern in cls.MEDRXIV_PATTERNS:
+ if re.search(pattern, url_lower):
+ return URLType.MEDRXIV
+
+ for pattern in cls.DOI_PATTERNS:
+ if re.search(pattern, url_lower):
+ return URLType.DOI
+
+ # Default to HTML for web pages
+ return URLType.HTML
+
+ @classmethod
+ def _is_pdf_url(cls, url: str) -> bool:
+ """Check if URL points directly to a PDF.
+
+ Note: Academic source PDFs (arXiv, bioRxiv, etc.) are handled
+ by their respective patterns, not as generic PDFs.
+ """
+ url_lower = url.lower()
+
+ # Academic sources with PDF URLs should use their specialized downloaders
+ academic_domains = [
+ "arxiv.org",
+ "biorxiv.org",
+ "medrxiv.org",
+ "ncbi.nlm.nih.gov",
+ "europepmc.org",
+ "semanticscholar.org",
+ ]
+ if any(domain in url_lower for domain in academic_domains):
+ return False
+
+ parsed = urlparse(url_lower)
+ path = parsed.path
+
+ # Check file extension
+ if path.endswith(".pdf"):
+ return True
+
+ # Check common PDF URL patterns
+ if "/pdf/" in path:
+ return True
+
+ return False
+
+ @classmethod
+ def extract_id(
+ cls, url: str, url_type: Optional[URLType] = None
+ ) -> Optional[str]:
+ """
+ Extract the identifier from a URL.
+
+ Args:
+ url: The URL to extract from
+ url_type: Optional pre-classified type
+
+ Returns:
+ Extracted ID or None
+ """
+ if url_type is None:
+ url_type = cls.classify(url)
+
+ if url_type == URLType.ARXIV:
+ # Extract arXiv ID (e.g., 2301.12345 or cond-mat/0501234)
+ match = re.search(r"(\d{4}\.\d{4,5}(?:v\d+)?)", url)
+ if match:
+ return match.group(1)
+ # Old format
+ match = re.search(r"([a-z-]+/\d{7}(?:v\d+)?)", url)
+ if match:
+ return match.group(1)
+
+ elif url_type == URLType.PUBMED:
+ # Extract PMID
+ match = re.search(r"/(\d+)/?", url)
+ if match:
+ return match.group(1)
+
+ elif url_type == URLType.PMC:
+ # Extract PMC ID
+ match = re.search(r"PMC(\d+)", url, re.IGNORECASE)
+ if match:
+ return f"PMC{match.group(1)}"
+
+ elif url_type == URLType.SEMANTIC_SCHOLAR:
+ # Extract paper ID (40-char hex)
+ match = re.search(
+ r"/paper/(?:[^/]+/)?([a-f0-9]{40})", url, re.IGNORECASE
+ )
+ if match:
+ return match.group(1)
+
+ elif url_type == URLType.DOI:
+ # Extract DOI
+ match = re.search(r"(10\.\d{4,}/[^\s]+)", url)
+ if match:
+ return match.group(1)
+
+ return None
+
+ @classmethod
+ def get_source_name(cls, url_type: URLType) -> str:
+ """Get human-readable source name."""
+ names = {
+ URLType.ARXIV: "arXiv",
+ URLType.PUBMED: "PubMed",
+ URLType.PMC: "PubMed Central",
+ URLType.SEMANTIC_SCHOLAR: "Semantic Scholar",
+ URLType.BIORXIV: "bioRxiv",
+ URLType.MEDRXIV: "medRxiv",
+ URLType.DOI: "DOI",
+ URLType.PDF: "PDF",
+ URLType.HTML: "Web Page",
+ URLType.INVALID: "Invalid URL",
+ }
+ return names.get(url_type, "Unknown")
diff --git a/src/local_deep_research/mcp/__init__.py b/src/local_deep_research/mcp/__init__.py
new file mode 100644
index 0000000000..4343b67e18
--- /dev/null
+++ b/src/local_deep_research/mcp/__init__.py
@@ -0,0 +1,17 @@
+"""
+MCP (Model Context Protocol) server for Local Deep Research.
+
+This module provides an MCP server that exposes LDR's research capabilities
+to AI agents like Claude, enabling programmatic deep research.
+
+Usage:
+ # Run as module
+ python -m local_deep_research.mcp
+
+ # Or use the entry point (after installing with mcp extras)
+ ldr-mcp
+"""
+
+from .server import mcp, run_server
+
+__all__ = ["mcp", "run_server"]
diff --git a/src/local_deep_research/mcp/__main__.py b/src/local_deep_research/mcp/__main__.py
new file mode 100644
index 0000000000..41cf9e8c3c
--- /dev/null
+++ b/src/local_deep_research/mcp/__main__.py
@@ -0,0 +1,11 @@
+"""
+Entry point for running the MCP server as a module.
+
+Usage:
+ python -m local_deep_research.mcp
+"""
+
+from .server import run_server
+
+if __name__ == "__main__":
+ run_server()
diff --git a/src/local_deep_research/mcp/client.py b/src/local_deep_research/mcp/client.py
new file mode 100644
index 0000000000..8bafe3524a
--- /dev/null
+++ b/src/local_deep_research/mcp/client.py
@@ -0,0 +1,481 @@
+"""
+MCP Client utilities for connecting to MCP servers.
+
+This module provides a wrapper around the MCP client SDK for connecting
+to and calling tools on MCP servers.
+"""
+
+import asyncio
+from contextlib import AsyncExitStack, asynccontextmanager
+from pathlib import Path
+from typing import Any, Dict, List, Optional
+
+from tenacity import (
+ AsyncRetrying,
+ retry_if_exception_message,
+ retry_if_exception_type,
+ stop_after_attempt,
+ wait_exponential,
+)
+
+from loguru import logger
+
+# Allowed commands for MCP server execution (security whitelist)
+ALLOWED_COMMANDS = {"node", "npx", "python", "python3", "uv", "uvx", "docker"}
+
+# Retry configuration for subprocess startup race condition
+INIT_RETRY_ATTEMPTS = 5
+INIT_RETRY_BASE_DELAY = 0.1 # seconds
+INIT_RETRY_MAX_DELAY = 2.0 # seconds
+INIT_RETRY_BACKOFF_FACTOR = 2.0
+
+# The MCP SDK is an optional dependency (installed via the [mcp] extras group),
+# so we guard the import and set a flag for runtime availability checks.
+try:
+ from mcp import ClientSession
+ from mcp.client.stdio import StdioServerParameters, stdio_client
+
+ MCP_AVAILABLE = True
+except ImportError:
+ MCP_AVAILABLE = False
+ logger.warning(
+ "MCP client not available. Install with: pip install mcp[cli]"
+ )
+
+
+class MCPClientError(Exception):
+ """Error during MCP client operations."""
+
+ pass
+
+
+class MCPClient:
+ """
+ Client for connecting to and calling tools on MCP servers.
+
+ Usage:
+ async with MCPClient(config) as client:
+ tools = await client.list_tools()
+ result = await client.call_tool("tool_name", {"arg": "value"})
+ """
+
+ def __init__(
+ self,
+ server_config: Dict[str, Any],
+ timeout: float = 60.0,
+ ):
+ """
+ Initialize MCP client.
+
+ Args:
+ server_config: Server configuration with keys:
+ - command: str - Command to run (e.g., "python")
+ - args: List[str] - Command arguments
+ - env: Dict[str, str] - Environment variables (optional)
+ - name: str - Server name for logging (optional)
+ timeout: Timeout in seconds for tool calls
+ """
+ if not MCP_AVAILABLE:
+ raise MCPClientError(
+ "MCP client not available. Install with: pip install mcp[cli]"
+ )
+
+ # Validate server configuration for security
+ self._validate_server_config(server_config)
+
+ self.config = server_config
+ self.timeout = timeout
+ self.name = server_config.get("name", "unnamed")
+ self._session: Optional[ClientSession] = None
+ self._read_stream = None
+ self._write_stream = None
+ self._connected = False
+
+ def _validate_server_config(self, config: Dict[str, Any]) -> None:
+ """
+ Validate server configuration for security.
+
+ Args:
+ config: Server configuration dictionary
+
+ Raises:
+ MCPClientError: If configuration is invalid or insecure
+ """
+ # Check command exists
+ command = config.get("command", "")
+ command = command.strip()
+ if not command:
+ raise MCPClientError("Server config missing 'command'")
+
+ if " " in command or "\t" in command:
+ raise MCPClientError(
+ "'command' must be a single executable name without spaces; "
+ "pass arguments via the 'args' field"
+ )
+
+ # Write stripped command back for use by connect()
+ config["command"] = command
+
+ # Extract base command (handle paths like /usr/bin/node)
+ base_cmd = Path(command).name
+ if base_cmd not in ALLOWED_COMMANDS:
+ raise MCPClientError(
+ f"Command '{base_cmd}' not in allowed list: {ALLOWED_COMMANDS}. "
+ f"Add to ALLOWED_COMMANDS if this is a trusted command."
+ )
+
+ # Validate args are a list of strings
+ args = config.get("args", [])
+ if not isinstance(args, list):
+ raise MCPClientError("Server 'args' must be a list")
+ if not all(isinstance(a, str) for a in args):
+ raise MCPClientError("Server 'args' must contain only strings")
+
+ # Validate env is a dict of strings if provided
+ env = config.get("env")
+ if env is not None:
+ if not isinstance(env, dict):
+ raise MCPClientError("Server 'env' must be a dictionary")
+ if not all(
+ isinstance(k, str) and isinstance(v, str)
+ for k, v in env.items()
+ ):
+ raise MCPClientError(
+ "Server 'env' must contain only string keys and values"
+ )
+
+ @asynccontextmanager
+ async def connect(self):
+ """
+ Connect to the MCP server as an async context manager.
+
+ Yields:
+ self: The connected client instance
+ """
+ server_params = StdioServerParameters(
+ command=self.config["command"],
+ args=self.config.get("args", []),
+ env=self.config.get("env"),
+ )
+
+ logger.info(f"Connecting to MCP server '{self.name}'...")
+
+ try:
+ async with stdio_client(server_params) as (
+ read_stream,
+ write_stream,
+ ):
+ self._read_stream = read_stream
+ self._write_stream = write_stream
+
+ # ClientSession must be used as async context manager
+ async with ClientSession(read_stream, write_stream) as session:
+ self._session = session
+
+ await self._initialize_with_retry()
+
+ self._connected = True
+ logger.info(f"Connected to MCP server '{self.name}'")
+
+ yield self
+
+ except Exception as e:
+ logger.exception(f"Failed to connect to MCP server '{self.name}'")
+ raise MCPClientError(f"Connection failed: {e}") from e
+ finally:
+ self._connected = False
+ self._session = None
+ self._read_stream = None
+ self._write_stream = None
+
+ async def _initialize_with_retry(self) -> None:
+ """Initialize the MCP session with retry logic for subprocess startup race.
+
+ Retries on TimeoutError and "before initialization" errors using
+ exponential backoff, then wraps final failures in MCPClientError.
+ """
+ try:
+ async for attempt in AsyncRetrying(
+ stop=stop_after_attempt(INIT_RETRY_ATTEMPTS),
+ wait=wait_exponential(
+ multiplier=INIT_RETRY_BASE_DELAY,
+ max=INIT_RETRY_MAX_DELAY,
+ exp_base=INIT_RETRY_BACKOFF_FACTOR,
+ ),
+ retry=(
+ retry_if_exception_type(asyncio.TimeoutError)
+ | retry_if_exception_message(
+ match="(?i)before initialization"
+ )
+ ),
+ before_sleep=lambda rs: logger.debug(
+ f"Server '{self.name}' not ready "
+ f"(attempt {rs.attempt_number}/{INIT_RETRY_ATTEMPTS}), retrying..."
+ ),
+ reraise=True,
+ ):
+ with attempt:
+ await asyncio.wait_for(
+ self._session.initialize(),
+ timeout=min(5.0, self.timeout),
+ )
+ except asyncio.TimeoutError as e:
+ raise MCPClientError(
+ f"Timeout initializing connection to '{self.name}' "
+ f"after {INIT_RETRY_ATTEMPTS} attempts"
+ ) from e
+ except MCPClientError:
+ raise
+ except Exception as e:
+ if "before initialization" in str(e).lower():
+ raise MCPClientError(
+ f"Failed to initialize connection to '{self.name}' "
+ f"after {INIT_RETRY_ATTEMPTS} attempts: {e}"
+ ) from e
+ raise
+
+ async def list_tools(self) -> List[Dict[str, Any]]:
+ """
+ List available tools on the connected server.
+
+ Returns:
+ List of tool definitions with name, description, and input schema
+ """
+ if not self._connected or not self._session:
+ raise MCPClientError("Not connected to server")
+
+ try:
+ result = await asyncio.wait_for(
+ self._session.list_tools(),
+ timeout=self.timeout,
+ )
+ tools = []
+ for tool in result.tools:
+ tools.append(
+ {
+ "name": tool.name,
+ "description": tool.description or "",
+ "input_schema": (
+ tool.inputSchema
+ if hasattr(tool, "inputSchema")
+ else {}
+ ),
+ }
+ )
+ return tools
+ except asyncio.TimeoutError:
+ logger.warning(
+ f"Timeout listing tools from '{self.name}' after {self.timeout}s"
+ )
+ raise MCPClientError(f"Timeout listing tools after {self.timeout}s")
+ except Exception as e:
+ logger.exception(f"Failed to list tools from '{self.name}'")
+ raise MCPClientError(f"Failed to list tools: {e}") from e
+
+ async def call_tool(
+ self,
+ name: str,
+ arguments: Optional[Dict[str, Any]] = None,
+ ) -> Dict[str, Any]:
+ """
+ Call a tool on the connected server.
+
+ Args:
+ name: Name of the tool to call
+ arguments: Arguments to pass to the tool
+
+ Returns:
+ Tool result as a dictionary
+ """
+ if not self._connected or not self._session:
+ raise MCPClientError("Not connected to server")
+
+ try:
+ logger.debug(
+ f"Calling tool '{name}' on '{self.name}' with args: {arguments}"
+ )
+
+ result = await asyncio.wait_for(
+ self._session.call_tool(name, arguments or {}),
+ timeout=self.timeout,
+ )
+
+ # Parse the result
+ if result.isError:
+ return {
+ "status": "error",
+ "error": str(result.content),
+ }
+
+ # Extract content from the result
+ content = []
+ # Check if result.content is iterable (not None or other non-iterable types)
+ if result.content is not None and hasattr(
+ result.content, "__iter__"
+ ):
+ for item in result.content:
+ if hasattr(item, "text"):
+ content.append(item.text)
+ elif hasattr(item, "data"):
+ content.append(str(item.data))
+ else:
+ content.append(str(item))
+ elif result.content is not None:
+ # Handle non-iterable content by converting to string
+ content.append(str(result.content))
+
+ return {
+ "status": "success",
+ "content": "\n".join(content) if content else "",
+ "raw": result.content,
+ }
+
+ except asyncio.TimeoutError:
+ logger.exception(
+ f"Tool call '{name}' timed out after {self.timeout}s"
+ )
+ raise MCPClientError(f"Tool call timed out after {self.timeout}s")
+ except Exception as e:
+ logger.exception(f"Failed to call tool '{name}' on '{self.name}'")
+ raise MCPClientError(f"Tool call failed: {e}") from e
+
+
+class MCPClientManager:
+ """
+ Manager for multiple MCP client connections.
+
+ Handles connecting to multiple MCP servers and aggregating their tools.
+ """
+
+ def __init__(self, server_configs: List[Dict[str, Any]]):
+ """
+ Initialize the manager with server configurations.
+
+ Args:
+ server_configs: List of server configurations
+ """
+ self.server_configs = server_configs
+ self._clients: Dict[str, MCPClient] = {}
+
+ @asynccontextmanager
+ async def connect_all(self):
+ """
+ Connect to all configured MCP servers.
+
+ Yields:
+ self: The manager with all clients connected
+ """
+ # Create clients for each server
+ clients = [MCPClient(config) for config in self.server_configs]
+
+ # Connect to all servers
+ # Connect sequentially to avoid overwhelming the system.
+ # AsyncExitStack manages cleanup of successfully-entered contexts.
+ async with AsyncExitStack() as stack:
+ for client in clients:
+ ctx = None
+ try:
+ ctx = client.connect()
+ connected = await stack.enter_async_context(ctx)
+ self._clients[client.name] = connected
+ except Exception as e:
+ logger.warning(
+ f"Failed to connect to server '{client.name}': {e}. Skipping."
+ )
+ # If ctx was created but __aenter__ failed, clean up
+ # manually — AsyncExitStack only tracks contexts that
+ # were successfully entered, but the MCP subprocess
+ # may already be running.
+ if ctx is not None:
+ try:
+ await ctx.__aexit__(None, None, None)
+ except Exception:
+ pass
+
+ try:
+ yield self
+ finally:
+ self._clients.clear()
+
+ async def list_all_tools(self) -> Dict[str, List[Dict[str, Any]]]:
+ """
+ List tools from all connected servers.
+
+ Returns:
+ Dictionary mapping server name to list of tools
+ """
+ all_tools = {}
+ for name, client in self._clients.items():
+ try:
+ tools = await client.list_tools()
+ all_tools[name] = tools
+ except MCPClientError as e:
+ logger.warning(f"Failed to list tools from '{name}': {e}")
+ all_tools[name] = []
+ return all_tools
+
+ async def call_tool(
+ self,
+ server_name: str,
+ tool_name: str,
+ arguments: Optional[Dict[str, Any]] = None,
+ ) -> Dict[str, Any]:
+ """
+ Call a tool on a specific server.
+
+ Args:
+ server_name: Name of the server
+ tool_name: Name of the tool to call
+ arguments: Arguments to pass to the tool
+
+ Returns:
+ Tool result
+ """
+ if server_name not in self._clients:
+ raise MCPClientError(f"Server '{server_name}' not connected")
+
+ return await self._clients[server_name].call_tool(tool_name, arguments)
+
+ def get_connected_servers(self) -> List[str]:
+ """Get list of connected server names."""
+ return list(self._clients.keys())
+
+
+def run_async(coro, timeout: float = 300.0):
+ """
+ Run an async coroutine synchronously.
+
+ Helper for running async MCP operations from sync code.
+
+ Args:
+ coro: The coroutine to run
+ timeout: Maximum time to wait in seconds (default 5 minutes)
+
+ Returns:
+ The result of the coroutine
+
+ Raises:
+ MCPClientError: If the operation times out
+ """
+ import concurrent.futures
+
+ try:
+ # Check if we're already in an async context
+ asyncio.get_running_loop()
+ # We are in an async context - use thread pool to avoid nesting
+ with concurrent.futures.ThreadPoolExecutor(max_workers=1) as executor:
+ future = executor.submit(
+ asyncio.run, asyncio.wait_for(coro, timeout=timeout)
+ )
+ try:
+ return future.result(timeout=timeout + 5.0)
+ except TimeoutError:
+ raise MCPClientError(
+ f"Async operation timed out after {timeout}s"
+ )
+ except RuntimeError:
+ # No running event loop - safe to use asyncio.run()
+ try:
+ return asyncio.run(asyncio.wait_for(coro, timeout=timeout))
+ except TimeoutError:
+ raise MCPClientError(f"Async operation timed out after {timeout}s")
diff --git a/src/local_deep_research/mcp/server.py b/src/local_deep_research/mcp/server.py
new file mode 100644
index 0000000000..6c074c4116
--- /dev/null
+++ b/src/local_deep_research/mcp/server.py
@@ -0,0 +1,732 @@
+"""
+MCP Server for Local Deep Research.
+
+This module provides an MCP (Model Context Protocol) server that exposes
+LDR's research capabilities to AI agents like Claude.
+
+Security Notice:
+ This server is designed for LOCAL USE ONLY via STDIO transport
+ (e.g., Claude Desktop). It has no built-in authentication or rate
+ limiting. Do NOT expose this server over a network without implementing
+ proper security controls (OAuth, rate limiting, input validation).
+
+ When running locally via STDIO, security is provided by your operating
+ system's user permissions.
+
+Tools:
+ - quick_research: Fast research summary (1-5 min)
+ - detailed_research: Comprehensive analysis (5-15 min)
+ - generate_report: Full markdown report (10-30 min)
+ - analyze_documents: Search local document collection (30s-2 min)
+ - list_search_engines: List available search engines
+ - list_strategies: List available research strategies
+ - get_configuration: Get current server configuration
+
+Usage:
+ python -m local_deep_research.mcp
+ # or
+ ldr-mcp
+"""
+
+import sys
+from typing import Any, Dict, Optional
+
+from loguru import logger
+from mcp.server.fastmcp import FastMCP
+
+from local_deep_research.api.research_functions import (
+ analyze_documents as ldr_analyze_documents,
+ detailed_research as ldr_detailed_research,
+ generate_report as ldr_generate_report,
+ quick_summary as ldr_quick_summary,
+)
+from local_deep_research.api.settings_utils import create_settings_snapshot
+from local_deep_research.search_system_factory import (
+ get_available_strategies,
+)
+
+# Create FastMCP server instance
+mcp = FastMCP(
+ "local-deep-research",
+ instructions="AI-powered deep research assistant with iterative analysis using LLMs and web searches",
+)
+
+
+def _classify_error(error_msg: str) -> str:
+ """Classify error for client handling."""
+ error_lower = error_msg.lower()
+ if "503" in error_msg or "unavailable" in error_lower:
+ return "service_unavailable"
+ if "404" in error_msg or "not found" in error_lower:
+ return "model_not_found"
+ if (
+ "api key" in error_lower
+ or "authentication" in error_lower
+ or "unauthorized" in error_lower
+ or "401" in error_msg
+ ):
+ return "auth_error"
+ if "timeout" in error_lower or "timed out" in error_lower:
+ return "timeout"
+ if "rate limit" in error_lower or "429" in error_msg:
+ return "rate_limit"
+ if "connection" in error_lower:
+ return "connection_error"
+ if "validation" in error_lower or "invalid" in error_lower:
+ return "validation_error"
+ return "unknown"
+
+
+class ValidationError(Exception):
+ """Raised when parameter validation fails."""
+
+ pass
+
+
+def _validate_query(query: str) -> str:
+ """Validate and sanitize query parameter."""
+ if not query or not query.strip():
+ raise ValidationError("Query cannot be empty")
+ query = query.strip()
+ if len(query) > 10000:
+ raise ValidationError(
+ "Query exceeds maximum length of 10000 characters"
+ )
+ return query
+
+
+def _validate_iterations(
+ iterations: Optional[int], max_val: int = 20
+) -> Optional[int]:
+ """Validate iterations parameter."""
+ if iterations is None:
+ return None
+ if not isinstance(iterations, int) or iterations < 1:
+ raise ValidationError("Iterations must be a positive integer")
+ if iterations > max_val:
+ raise ValidationError(f"Iterations cannot exceed {max_val}")
+ return iterations
+
+
+def _validate_questions_per_iteration(qpi: Optional[int]) -> Optional[int]:
+ """Validate questions_per_iteration parameter."""
+ if qpi is None:
+ return None
+ if not isinstance(qpi, int) or qpi < 1:
+ raise ValidationError(
+ "Questions per iteration must be a positive integer"
+ )
+ if qpi > 10:
+ raise ValidationError("Questions per iteration cannot exceed 10")
+ return qpi
+
+
+def _validate_max_results(max_results: int) -> int:
+ """Validate max_results parameter."""
+ if not isinstance(max_results, int) or max_results < 1:
+ raise ValidationError("Max results must be a positive integer")
+ if max_results > 100:
+ raise ValidationError("Max results cannot exceed 100")
+ return max_results
+
+
+def _validate_temperature(temperature: Optional[float]) -> Optional[float]:
+ """Validate temperature parameter."""
+ if temperature is None:
+ return None
+ if not isinstance(temperature, (int, float)):
+ raise ValidationError("Temperature must be a number")
+ if temperature < 0.0 or temperature > 2.0:
+ raise ValidationError("Temperature must be between 0.0 and 2.0")
+ return float(temperature)
+
+
+def _validate_search_engine(engine: Optional[str]) -> Optional[str]:
+ """Validate search engine name against available engines."""
+ if engine is None:
+ return None
+ engine = engine.strip()
+ if not engine:
+ return None
+ try:
+ from local_deep_research.web_search_engines.search_engines_config import (
+ search_config,
+ )
+
+ settings = create_settings_snapshot()
+ available = search_config(settings_snapshot=settings)
+ if engine not in available:
+ available_names = sorted(available.keys())
+ raise ValidationError(
+ f"Unknown search engine '{engine}'. Available: {', '.join(available_names)}"
+ )
+ except ValidationError:
+ raise
+ except Exception as e:
+ # If we can't load engine config, log but don't block
+ logger.warning(f"Could not validate search engine '{engine}': {e}")
+ return engine
+
+
+def _validate_strategy(strategy: Optional[str]) -> Optional[str]:
+ """Validate strategy name against available strategies."""
+ if strategy is None:
+ return None
+ strategy = strategy.strip()
+ if not strategy:
+ return None
+ available = get_available_strategies()
+ available_names = [s["name"] for s in available]
+ if strategy not in available_names:
+ raise ValidationError(
+ f"Unknown strategy '{strategy}'. Available: {', '.join(available_names)}"
+ )
+ return strategy
+
+
+def _build_settings_overrides(
+ search_engine: Optional[str] = None,
+ strategy: Optional[str] = None,
+ iterations: Optional[int] = None,
+ questions_per_iteration: Optional[int] = None,
+ temperature: Optional[float] = None,
+) -> Dict[str, Any]:
+ """Build settings overrides dict from tool parameters."""
+ overrides = {}
+ if search_engine is not None:
+ search_engine = _validate_search_engine(search_engine)
+ if search_engine:
+ overrides["search.tool"] = search_engine
+ if strategy is not None:
+ strategy = _validate_strategy(strategy)
+ if strategy:
+ overrides["search.search_strategy"] = strategy
+ if iterations is not None:
+ overrides["search.iterations"] = iterations
+ if questions_per_iteration is not None:
+ overrides["search.questions_per_iteration"] = questions_per_iteration
+ if temperature is not None:
+ overrides["llm.temperature"] = temperature
+ return overrides
+
+
+# =============================================================================
+# Research Tools
+# =============================================================================
+
+
+def quick_research(
+ query: str,
+ search_engine: Optional[str] = None,
+ strategy: Optional[str] = None,
+ iterations: Optional[int] = None,
+ questions_per_iteration: Optional[int] = None,
+) -> Dict[str, Any]:
+ """
+ Perform quick research on a topic.
+
+ This tool performs a fast research summary on the given query. It searches
+ the web, analyzes sources, and generates a concise summary with findings.
+
+ IMPORTANT: This is a synchronous operation that typically takes 1-5 minutes
+ to complete depending on the complexity and configuration.
+
+ Args:
+ query: The research question or topic to investigate.
+ search_engine: Search engine to use (e.g., "wikipedia", "arxiv", "searxng", "auto").
+ Use list_search_engines() to see available options.
+ strategy: Research strategy to use (e.g., "source-based", "rapid", "iterative").
+ Use list_strategies() to see available options.
+ iterations: Number of search iterations (1-10). More iterations = deeper research.
+ questions_per_iteration: Questions to generate per iteration (1-5).
+
+ Returns:
+ Dictionary containing:
+ - status: "success" or "error"
+ - summary: The research summary text
+ - findings: List of detailed findings from each search
+ - sources: List of source URLs discovered
+ - iterations: Number of iterations performed
+ - error: Error message (only if status is "error")
+ - error_type: Error classification (only if status is "error")
+ """
+ try:
+ # Validate parameters
+ query = _validate_query(query)
+ iterations = _validate_iterations(iterations, max_val=10)
+ questions_per_iteration = _validate_questions_per_iteration(
+ questions_per_iteration
+ )
+
+ logger.info(f"Starting quick research for query: {query[:100]}...")
+
+ overrides = _build_settings_overrides(
+ search_engine=search_engine,
+ strategy=strategy,
+ iterations=iterations,
+ questions_per_iteration=questions_per_iteration,
+ )
+
+ settings = (
+ create_settings_snapshot(overrides=overrides)
+ if overrides
+ else create_settings_snapshot()
+ )
+
+ result = ldr_quick_summary(query, settings_snapshot=settings)
+
+ return {
+ "status": "success",
+ "summary": result.get("summary", ""),
+ "findings": result.get("findings", []),
+ "sources": result.get("sources", []),
+ "iterations": result.get("iterations", 0),
+ "formatted_findings": result.get("formatted_findings", ""),
+ }
+
+ except ValidationError as e:
+ logger.warning(f"Validation failed for quick research: {e}")
+ return {
+ "status": "error",
+ "error": str(e),
+ "error_type": "validation_error",
+ }
+ except Exception as e:
+ logger.exception(
+ f"Quick research failed for query: {query[:100] if query else 'empty'}"
+ )
+ error_type = _classify_error(str(e))
+ return {
+ "status": "error",
+ "error": f"Quick research failed ({error_type}). Check server logs for details.",
+ "error_type": error_type,
+ }
+
+
+def detailed_research(
+ query: str,
+ search_engine: Optional[str] = None,
+ strategy: Optional[str] = None,
+ iterations: Optional[int] = None,
+ questions_per_iteration: Optional[int] = None,
+) -> Dict[str, Any]:
+ """
+ Perform detailed research with comprehensive analysis.
+
+ This tool performs a thorough research analysis on the given query, returning
+ structured data with detailed findings, sources, and metadata.
+
+ IMPORTANT: This is a synchronous operation that typically takes 5-15 minutes
+ to complete depending on the complexity and configuration.
+
+ Args:
+ query: The research question or topic to investigate.
+ search_engine: Search engine to use (e.g., "wikipedia", "arxiv", "searxng", "auto").
+ strategy: Research strategy to use (e.g., "source-based", "iterative", "evidence").
+ iterations: Number of search iterations (1-10). More iterations = deeper research.
+ questions_per_iteration: Questions to generate per iteration (1-5).
+
+ Returns:
+ Dictionary containing:
+ - status: "success" or "error"
+ - query: The original query
+ - research_id: Unique identifier for this research
+ - summary: The research summary text
+ - findings: List of detailed findings
+ - sources: List of source URLs
+ - iterations: Number of iterations performed
+ - metadata: Additional metadata (timestamp, search_tool, strategy)
+ - error/error_type: Error info (only if status is "error")
+ """
+ try:
+ # Validate parameters
+ query = _validate_query(query)
+ iterations = _validate_iterations(iterations, max_val=20)
+ questions_per_iteration = _validate_questions_per_iteration(
+ questions_per_iteration
+ )
+
+ logger.info(f"Starting detailed research for query: {query[:100]}...")
+
+ overrides = _build_settings_overrides(
+ search_engine=search_engine,
+ strategy=strategy,
+ iterations=iterations,
+ questions_per_iteration=questions_per_iteration,
+ )
+
+ settings = (
+ create_settings_snapshot(overrides=overrides)
+ if overrides
+ else create_settings_snapshot()
+ )
+
+ result = ldr_detailed_research(query, settings_snapshot=settings)
+
+ return {
+ "status": "success",
+ "query": result.get("query", query),
+ "research_id": result.get("research_id", ""),
+ "summary": result.get("summary", ""),
+ "findings": result.get("findings", []),
+ "sources": result.get("sources", []),
+ "iterations": result.get("iterations", 0),
+ "formatted_findings": result.get("formatted_findings", ""),
+ "metadata": result.get("metadata", {}),
+ }
+
+ except ValidationError as e:
+ logger.warning(f"Validation failed for detailed research: {e}")
+ return {
+ "status": "error",
+ "error": str(e),
+ "error_type": "validation_error",
+ }
+ except Exception as e:
+ logger.exception(
+ f"Detailed research failed for query: {query[:100] if query else 'empty'}"
+ )
+ error_type = _classify_error(str(e))
+ return {
+ "status": "error",
+ "error": f"Detailed research failed ({error_type}). Check server logs for details.",
+ "error_type": error_type,
+ }
+
+
+def generate_report(
+ query: str,
+ search_engine: Optional[str] = None,
+ searches_per_section: int = 2,
+) -> Dict[str, Any]:
+ """
+ Generate a comprehensive markdown research report.
+
+ This tool generates a full structured research report with sections,
+ citations, and comprehensive analysis. The output is formatted as markdown.
+
+ IMPORTANT: This is a synchronous operation that typically takes 10-30 minutes
+ to complete due to the comprehensive nature of the report.
+
+ Args:
+ query: The research question or topic for the report.
+ search_engine: Search engine to use (e.g., "wikipedia", "arxiv", "searxng", "auto").
+ searches_per_section: Number of searches per report section (1-10). Default is 2.
+
+ Returns:
+ Dictionary containing:
+ - status: "success" or "error"
+ - content: The full report content in markdown format
+ - metadata: Report metadata (timestamp, query)
+ - error/error_type: Error info (only if status is "error")
+ """
+ try:
+ # Validate parameters
+ query = _validate_query(query)
+ if (
+ not isinstance(searches_per_section, int)
+ or searches_per_section < 1
+ ):
+ raise ValidationError(
+ "Searches per section must be a positive integer"
+ )
+ if searches_per_section > 10:
+ raise ValidationError("Searches per section cannot exceed 10")
+
+ logger.info(f"Starting report generation for query: {query[:100]}...")
+
+ overrides = {}
+ if search_engine:
+ search_engine = _validate_search_engine(search_engine)
+ if search_engine:
+ overrides["search.tool"] = search_engine
+
+ settings = (
+ create_settings_snapshot(overrides=overrides)
+ if overrides
+ else create_settings_snapshot()
+ )
+
+ result = ldr_generate_report(
+ query,
+ settings_snapshot=settings,
+ searches_per_section=searches_per_section,
+ )
+
+ return {
+ "status": "success",
+ "content": result.get("content", ""),
+ "metadata": result.get("metadata", {}),
+ }
+
+ except ValidationError as e:
+ logger.warning(f"Validation failed for report generation: {e}")
+ return {
+ "status": "error",
+ "error": str(e),
+ "error_type": "validation_error",
+ }
+ except Exception as e:
+ logger.exception(
+ f"Report generation failed for query: {query[:100] if query else 'empty'}"
+ )
+ error_type = _classify_error(str(e))
+ return {
+ "status": "error",
+ "error": f"Report generation failed ({error_type}). Check server logs for details.",
+ "error_type": error_type,
+ }
+
+
+def analyze_documents(
+ query: str,
+ collection_name: str,
+ max_results: int = 10,
+) -> Dict[str, Any]:
+ """
+ Search and analyze documents in a local collection.
+
+ This tool performs RAG (Retrieval Augmented Generation) search on a
+ local document collection and generates a summary of relevant findings.
+
+ Args:
+ query: The search query for the documents.
+ collection_name: Name of the local document collection to search.
+ max_results: Maximum number of documents to retrieve (1-100). Default is 10.
+
+ Returns:
+ Dictionary containing:
+ - status: "success" or "error"
+ - summary: Summary of findings from the documents
+ - documents: List of matching documents with content and metadata
+ - collection: Name of the collection searched
+ - document_count: Number of documents found
+ - error/error_type: Error info (only if status is "error")
+ """
+ try:
+ # Validate parameters
+ query = _validate_query(query)
+ if not collection_name or not collection_name.strip():
+ raise ValidationError("Collection name cannot be empty")
+ collection_name = collection_name.strip()
+ max_results = _validate_max_results(max_results)
+
+ logger.info(
+ f"Analyzing documents in '{collection_name}' for query: {query[:100]}..."
+ )
+
+ result = ldr_analyze_documents(
+ query=query,
+ collection_name=collection_name,
+ max_results=max_results,
+ )
+
+ return {
+ "status": "success",
+ "summary": result.get("summary", ""),
+ "documents": result.get("documents", []),
+ "collection": result.get("collection", collection_name),
+ "document_count": result.get("document_count", 0),
+ }
+
+ except ValidationError as e:
+ logger.warning(f"Validation failed for document analysis: {e}")
+ return {
+ "status": "error",
+ "error": str(e),
+ "error_type": "validation_error",
+ }
+ except Exception as e:
+ logger.exception(
+ f"Document analysis failed for collection: {collection_name if collection_name else 'empty'}"
+ )
+ error_type = _classify_error(str(e))
+ return {
+ "status": "error",
+ "error": f"Document analysis failed ({error_type}). Check server logs for details.",
+ "error_type": error_type,
+ }
+
+
+# =============================================================================
+# Discovery Tools
+# =============================================================================
+
+
+def list_search_engines() -> Dict[str, Any]:
+ """
+ List available search engines.
+
+ Returns a list of search engines that can be used with the research tools.
+ Each engine has different strengths - some are better for academic research,
+ others for current events, etc.
+
+ Returns:
+ Dictionary containing:
+ - status: "success" or "error"
+ - engines: List of available search engine configurations
+ - error/error_type: Error info (only if status is "error")
+ """
+ try:
+ from local_deep_research.api.settings_utils import (
+ create_settings_snapshot,
+ )
+ from local_deep_research.web_search_engines.search_engines_config import (
+ search_config,
+ )
+
+ settings = create_settings_snapshot()
+ engines_config = search_config(settings_snapshot=settings)
+
+ engines = []
+ for name, config in engines_config.items():
+ engine_info = {
+ "name": name,
+ "description": config.get("description", ""),
+ "strengths": config.get("strengths", []),
+ "weaknesses": config.get("weaknesses", []),
+ "requires_api_key": config.get("requires_api_key", False),
+ "is_local": config.get("is_local", False),
+ }
+ engines.append(engine_info)
+
+ return {
+ "status": "success",
+ "engines": sorted(engines, key=lambda x: x["name"]),
+ }
+
+ except Exception as e:
+ logger.exception("Failed to list search engines")
+ error_type = _classify_error(str(e))
+ return {
+ "status": "error",
+ "error": f"Failed to list search engines ({error_type}). Check server logs for details.",
+ "error_type": error_type,
+ }
+
+
+def list_strategies() -> Dict[str, Any]:
+ """
+ List available research strategies.
+
+ Returns a list of research strategies that can be used with the research tools.
+ Each strategy has different characteristics suited for different types of queries.
+
+ Returns:
+ Dictionary containing:
+ - status: "success" or "error"
+ - strategies: List of available strategies with names and descriptions
+ - error/error_type: Error info (only if status is "error")
+ """
+ try:
+ return {
+ "status": "success",
+ "strategies": get_available_strategies(),
+ }
+
+ except Exception as e:
+ logger.exception("Failed to list strategies")
+ error_type = _classify_error(str(e))
+ return {
+ "status": "error",
+ "error": f"Failed to list strategies ({error_type}). Check server logs for details.",
+ "error_type": error_type,
+ }
+
+
+def get_configuration() -> Dict[str, Any]:
+ """
+ Get current server configuration.
+
+ Returns the current configuration settings being used by the MCP server,
+ including LLM provider, default search engine, and other settings.
+
+ Returns:
+ Dictionary containing:
+ - status: "success" or "error"
+ - config: Current configuration settings
+ - error/error_type: Error info (only if status is "error")
+ """
+ try:
+ from local_deep_research.api.settings_utils import (
+ create_settings_snapshot,
+ extract_setting_value,
+ )
+
+ settings = create_settings_snapshot()
+
+ config = {
+ "llm": {
+ "provider": extract_setting_value(
+ settings, "llm.provider", "unknown"
+ ),
+ "model": extract_setting_value(
+ settings, "llm.model", "unknown"
+ ),
+ "temperature": extract_setting_value(
+ settings, "llm.temperature", 0.7
+ ),
+ },
+ "search": {
+ "default_engine": extract_setting_value(
+ settings, "search.tool", "auto"
+ ),
+ "default_strategy": extract_setting_value(
+ settings, "search.search_strategy", "source-based"
+ ),
+ "iterations": extract_setting_value(
+ settings, "search.iterations", 2
+ ),
+ "questions_per_iteration": extract_setting_value(
+ settings, "search.questions_per_iteration", 3
+ ),
+ "max_results": extract_setting_value(
+ settings, "search.max_results", 10
+ ),
+ },
+ }
+
+ return {
+ "status": "success",
+ "config": config,
+ }
+
+ except Exception as e:
+ logger.exception("Failed to get configuration")
+ error_type = _classify_error(str(e))
+ return {
+ "status": "error",
+ "error": f"Failed to get configuration ({error_type}). Check server logs for details.",
+ "error_type": error_type,
+ }
+
+
+# =============================================================================
+# Server Entry Point
+# =============================================================================
+
+
+def run_server():
+ """Run the MCP server using STDIO transport."""
+ # MCP uses stdout for JSON-RPC, so redirect all logging to stderr.
+ # This runs in a separate subprocess (ldr-mcp) — logger.remove() only
+ # affects this MCP process, not the main LDR application.
+ logger.remove()
+ logger.add(
+ sys.stderr,
+ level="INFO",
+ format="{time:YYYY-MM-DD HH:mm:ss} | {level: <8} | {name}:{function}:{line} | {message}",
+ )
+ logger.info("Starting Local Deep Research MCP server...")
+ mcp.run(transport="stdio")
+
+
+if __name__ == "__main__":
+ run_server()
diff --git a/src/local_deep_research/research_library/downloaders/html.py b/src/local_deep_research/research_library/downloaders/html.py
new file mode 100644
index 0000000000..c0db8ef01e
--- /dev/null
+++ b/src/local_deep_research/research_library/downloaders/html.py
@@ -0,0 +1,396 @@
+"""
+HTML Content Downloader for web pages.
+
+Downloads and extracts clean text content from HTML web pages.
+"""
+
+from typing import Optional, Dict, Any
+from urllib.parse import urlparse
+from loguru import logger
+from bs4 import BeautifulSoup
+
+from .base import BaseDownloader, ContentType, DownloadResult
+
+
+class HTMLDownloader(BaseDownloader):
+ """Downloader for HTML web pages - extracts clean text content."""
+
+ # Elements to remove (navigation, ads, etc.)
+ REMOVE_ELEMENTS = [
+ "script",
+ "style",
+ "nav",
+ "header",
+ "footer",
+ "aside",
+ "iframe",
+ "noscript",
+ "svg",
+ "form",
+ "button",
+ "input",
+ "select",
+ "textarea",
+ ]
+
+ # Classes/IDs that typically contain non-content
+ REMOVE_PATTERNS = [
+ "nav",
+ "menu",
+ "sidebar",
+ "advertisement",
+ "ads",
+ "footer",
+ "header",
+ "comment",
+ "share",
+ "social",
+ "related",
+ "recommended",
+ "popup",
+ "modal",
+ "cookie",
+ "newsletter",
+ "subscribe",
+ ]
+
+ def can_handle(self, url: str) -> bool:
+ """
+ Check if this downloader can handle the given URL.
+
+ Returns True for any HTTP/HTTPS URL (fallback downloader for web content).
+ """
+ try:
+ parsed = urlparse(url)
+ return parsed.scheme in ("http", "https")
+ except Exception:
+ return False
+
+ def download(
+ self, url: str, content_type: ContentType = ContentType.TEXT
+ ) -> Optional[bytes]:
+ """
+ Download and extract text content from HTML page.
+
+ Args:
+ url: The URL to download
+ content_type: Type of content (TEXT for HTML extraction)
+
+ Returns:
+ Extracted text as UTF-8 bytes, or None if failed
+ """
+ if content_type == ContentType.PDF:
+ # HTML downloader doesn't handle PDFs
+ logger.warning(f"HTML downloader cannot download PDFs: {url}")
+ return None
+
+ try:
+ html_content = self._fetch_html(url)
+ if not html_content:
+ return None
+
+ extracted = self._extract_content(html_content, url)
+ if extracted:
+ # Format as structured text
+ text = self._format_extracted_content(extracted)
+ return text.encode("utf-8")
+
+ return None
+
+ except Exception:
+ logger.exception(f"Failed to download HTML from {url}")
+ return None
+
+ def download_with_result(
+ self, url: str, content_type: ContentType = ContentType.TEXT
+ ) -> DownloadResult:
+ """Download content and return detailed result with skip reason."""
+ if content_type == ContentType.PDF:
+ return DownloadResult(
+ skip_reason="HTML downloader does not support PDF downloads"
+ )
+
+ try:
+ html_content = self._fetch_html(url)
+ if not html_content:
+ return DownloadResult(
+ skip_reason="Failed to fetch HTML content from URL"
+ )
+
+ extracted = self._extract_content(html_content, url)
+ if not extracted:
+ return DownloadResult(
+ skip_reason="Could not extract meaningful content from page"
+ )
+
+ text = self._format_extracted_content(extracted)
+ if not text.strip():
+ return DownloadResult(skip_reason="Extracted content is empty")
+
+ return DownloadResult(
+ content=text.encode("utf-8"),
+ is_success=True,
+ )
+
+ except Exception as e:
+ logger.exception(f"Failed to download HTML from {url}")
+ return DownloadResult(skip_reason=f"Error: {str(e)}")
+
+ def _fetch_html(self, url: str) -> Optional[str]:
+ """Fetch raw HTML content from URL."""
+ domain = urlparse(url).netloc
+ engine_type = f"html_download_{domain}"
+
+ wait_time = self.rate_tracker.apply_rate_limit(engine_type)
+
+ try:
+ response = self.session.get(
+ url,
+ timeout=self.timeout,
+ allow_redirects=True,
+ )
+
+ if response.status_code == 200:
+ content_type = response.headers.get("content-type", "").lower()
+ if (
+ "text/html" in content_type
+ or "application/xhtml" in content_type
+ ):
+ self.rate_tracker.record_outcome(
+ engine_type=engine_type,
+ wait_time=wait_time,
+ success=True,
+ retry_count=1,
+ search_result_count=1,
+ )
+ # Try to get encoding from response
+ return response.text
+ else:
+ logger.warning(
+ f"Unexpected content type for HTML download: {content_type}"
+ )
+ return None
+ else:
+ logger.warning(f"HTTP {response.status_code} fetching {url}")
+ self.rate_tracker.record_outcome(
+ engine_type=engine_type,
+ wait_time=wait_time,
+ success=False,
+ retry_count=1,
+ error_type=f"HTTP_{response.status_code}",
+ )
+ return None
+
+ except Exception as e:
+ logger.exception(f"Error fetching HTML from {url}")
+ self.rate_tracker.record_outcome(
+ engine_type=engine_type,
+ wait_time=wait_time,
+ success=False,
+ retry_count=1,
+ error_type=type(e).__name__,
+ )
+ return None
+
+ def _extract_content(self, html: str, url: str) -> Optional[Dict[str, Any]]:
+ """
+ Extract clean content from HTML.
+
+ Returns dict with title, content, and metadata.
+ """
+ try:
+ soup = BeautifulSoup(html, "html.parser")
+
+ # Extract title
+ title = None
+ if soup.title and soup.title.string:
+ title = soup.title.string.strip()
+
+ # Try to find Open Graph or meta title
+ og_title = soup.find("meta", property="og:title")
+ if og_title and og_title.get("content"):
+ title = og_title["content"].strip()
+
+ # Extract meta description
+ description = None
+ meta_desc = soup.find("meta", attrs={"name": "description"})
+ if meta_desc and meta_desc.get("content"):
+ description = meta_desc["content"].strip()
+
+ og_desc = soup.find("meta", property="og:description")
+ if og_desc and og_desc.get("content"):
+ description = og_desc["content"].strip()
+
+ # Remove unwanted elements
+ for element in self.REMOVE_ELEMENTS:
+ for tag in soup.find_all(element):
+ tag.decompose()
+
+ # Remove elements with common non-content class/id patterns
+ for pattern in self.REMOVE_PATTERNS:
+ for tag in soup.find_all(
+ class_=lambda x: x and pattern in str(x).lower()
+ ):
+ tag.decompose()
+ for tag in soup.find_all(
+ id=lambda x: x and pattern in str(x).lower()
+ ):
+ tag.decompose()
+
+ # Try to find main content area
+ main_content = None
+
+ # Look for article tag first
+ article = soup.find("article")
+ if article:
+ main_content = article
+
+ # Try main tag
+ if not main_content:
+ main = soup.find("main")
+ if main:
+ main_content = main
+
+ # Try common content div patterns
+ if not main_content:
+ for pattern in ["content", "article", "post", "entry", "body"]:
+ content_div = soup.find(
+ "div",
+ class_=lambda x: x and pattern in str(x).lower(),
+ )
+ if content_div:
+ main_content = content_div
+ break
+
+ # Fall back to body
+ if not main_content:
+ main_content = soup.find("body")
+
+ if not main_content:
+ return None
+
+ # Extract text with some structure preservation
+ text_parts = []
+ for element in main_content.find_all(
+ [
+ "p",
+ "h1",
+ "h2",
+ "h3",
+ "h4",
+ "h5",
+ "h6",
+ "li",
+ "blockquote",
+ "pre",
+ ]
+ ):
+ text = element.get_text(separator=" ", strip=True)
+ if text and len(text) > 10: # Skip very short fragments
+ if element.name.startswith("h"):
+ text_parts.append(f"\n## {text}\n")
+ elif element.name == "li":
+ text_parts.append(f"• {text}")
+ elif element.name == "blockquote":
+ text_parts.append(f"> {text}")
+ elif element.name == "pre":
+ text_parts.append(f"```\n{text}\n```")
+ else:
+ text_parts.append(text)
+
+ content = "\n\n".join(text_parts)
+
+ # If we didn't get much content, fall back to simpler extraction
+ if len(content) < 100:
+ content = main_content.get_text(separator="\n", strip=True)
+
+ # Clean up whitespace
+ content = self._clean_text(content)
+
+ if not content or len(content) < 50:
+ return None
+
+ return {
+ "title": title,
+ "description": description,
+ "content": content,
+ "url": url,
+ }
+
+ except Exception:
+ logger.exception("Error extracting content from HTML")
+ return None
+
+ def _clean_text(self, text: str) -> str:
+ """Clean up extracted text."""
+ import re
+
+ # Normalize whitespace
+ text = re.sub(r"\n{3,}", "\n\n", text)
+ text = re.sub(r" {2,}", " ", text)
+ text = re.sub(r"\t+", " ", text)
+
+ # Remove lines that are just whitespace
+ lines = [line.strip() for line in text.split("\n")]
+ lines = [line for line in lines if line]
+
+ return "\n".join(lines)
+
+ def _format_extracted_content(self, extracted: Dict[str, Any]) -> str:
+ """Format extracted content as readable text."""
+ parts = []
+
+ if extracted.get("title"):
+ parts.append(f"# {extracted['title']}")
+ parts.append("")
+
+ if extracted.get("description"):
+ parts.append(f"*{extracted['description']}*")
+ parts.append("")
+
+ if extracted.get("url"):
+ parts.append(f"Source: {extracted['url']}")
+ parts.append("")
+
+ if extracted.get("content"):
+ parts.append(extracted["content"])
+
+ return "\n".join(parts)
+
+ def get_metadata(self, url: str) -> Dict[str, Any]:
+ """Get metadata about the page."""
+ html_content = self._fetch_html(url)
+ if not html_content:
+ return {}
+
+ try:
+ soup = BeautifulSoup(html_content, "html.parser")
+
+ metadata = {"url": url}
+
+ # Title
+ if soup.title and soup.title.string:
+ metadata["title"] = soup.title.string.strip()
+
+ # Description
+ meta_desc = soup.find("meta", attrs={"name": "description"})
+ if meta_desc and meta_desc.get("content"):
+ metadata["description"] = meta_desc["content"]
+
+ # Author
+ author = soup.find("meta", attrs={"name": "author"})
+ if author and author.get("content"):
+ metadata["author"] = author["content"]
+
+ # Published date
+ for prop in ["article:published_time", "datePublished"]:
+ date_tag = soup.find("meta", property=prop)
+ if date_tag and date_tag.get("content"):
+ metadata["published_date"] = date_tag["content"]
+ break
+
+ return metadata
+
+ except Exception:
+ logger.exception(f"Error extracting metadata from {url}")
+ return {"url": url}
diff --git a/src/local_deep_research/search_system_factory.py b/src/local_deep_research/search_system_factory.py
index 98fee592b2..9a52310dc1 100644
--- a/src/local_deep_research/search_system_factory.py
+++ b/src/local_deep_research/search_system_factory.py
@@ -9,6 +9,100 @@ from typing import Optional, Dict, Any, List
from langchain_core.language_models import BaseChatModel
+# =============================================================================
+# Strategy Registry - Single Source of Truth
+# =============================================================================
+
+AVAILABLE_STRATEGIES: List[Dict[str, str]] = [
+ {
+ "name": "source-based",
+ "description": "Comprehensive research with inline citations. Focuses on finding and extracting information from authoritative sources. Good for general research.",
+ },
+ {
+ "name": "focused-iteration",
+ "description": "Fast & precise Q&A with iterative search. Good for complex queries requiring specific answers.",
+ },
+ {
+ "name": "focused-iteration-standard",
+ "description": "Detailed long-form output with citations. Uses standard citation handler for comprehensive answers.",
+ },
+ {
+ "name": "iterative-refinement",
+ "description": "LLM-guided progressive refinement. Iteratively refines results using evaluation and follow-up queries.",
+ },
+ {
+ "name": "topic-organization",
+ "description": "Clusters sources into topics with lead texts. Organizes research by themes for structured output.",
+ },
+ {
+ "name": "mcp",
+ "description": "Agentic research using ReAct pattern (Reasoning + Acting). LLM decides what tools to call, analyzes results, and iterates until satisfied.",
+ },
+ {
+ "name": "rapid",
+ "description": "Quick single-pass search for fast results. Good for simple queries.",
+ },
+ {
+ "name": "iterative",
+ "description": "Loop-based reasoning with persistent knowledge accumulation and confidence tracking.",
+ },
+ {
+ "name": "parallel",
+ "description": "Runs multiple search queries in parallel for comprehensive coverage.",
+ },
+ {
+ "name": "recursive",
+ "description": "Recursive decomposition of complex queries into simpler sub-queries.",
+ },
+ {
+ "name": "adaptive",
+ "description": "Adaptive step-by-step reasoning that adjusts strategy based on results.",
+ },
+ {
+ "name": "smart",
+ "description": "Smart decomposition with automatic sub-query generation.",
+ },
+ {
+ "name": "browsecomp",
+ "description": "BrowseComp optimized strategy with confidence-based iteration.",
+ },
+ {
+ "name": "evidence",
+ "description": "Enhanced evidence-based verification with candidate discovery and pattern learning.",
+ },
+ {
+ "name": "constrained",
+ "description": "Progressive constraint-based search that narrows candidates step by step.",
+ },
+ {
+ "name": "news",
+ "description": "Specialized for news aggregation and current events.",
+ },
+ {
+ "name": "standard",
+ "description": "Basic iterative search strategy for general use.",
+ },
+ {
+ "name": "iterdrag",
+ "description": "IterDRAG strategy for iterative document retrieval and generation.",
+ },
+ {
+ "name": "iterative-reasoning",
+ "description": "Iterative reasoning with depth-based exploration.",
+ },
+]
+
+
+def get_available_strategies() -> List[Dict[str, str]]:
+ """
+ Get the list of available research strategies.
+
+ Returns:
+ List of dictionaries with 'name' and 'description' keys for each strategy.
+ """
+ return AVAILABLE_STRATEGIES.copy()
+
+
def _get_setting(
settings_snapshot: Optional[Dict], key: str, default: Any
) -> Any:
@@ -863,6 +957,28 @@ def create_strategy(
settings_snapshot=settings_snapshot,
)
+ # MCP strategy (ReAct pattern - agentic research)
+ elif strategy_name_lower in ["mcp", "agentic"]:
+ from .advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ # Get MCP server configurations from settings
+ mcp_servers = kwargs.get(
+ "mcp_servers",
+ _get_setting(settings_snapshot, "mcp.servers", []),
+ )
+
+ return MCPSearchStrategy(
+ model=model,
+ search=search,
+ mcp_servers=mcp_servers,
+ max_iterations=kwargs.get("max_iterations", 10),
+ include_web_search=kwargs.get("include_web_search", True),
+ all_links_of_system=all_links_of_system,
+ settings_snapshot=settings_snapshot,
+ )
+
else:
# Default to source-based if unknown
logger.warning(
diff --git a/src/local_deep_research/security/safe_requests.py b/src/local_deep_research/security/safe_requests.py
index 2e2d7db98c..1cca258602 100644
--- a/src/local_deep_research/security/safe_requests.py
+++ b/src/local_deep_research/security/safe_requests.py
@@ -231,3 +231,24 @@ class SafeSession(requests.Session):
kwargs["timeout"] = DEFAULT_TIMEOUT
return super().request(method, url, **kwargs)
+
+ def send(
+ self, request: requests.PreparedRequest, **kwargs
+ ) -> requests.Response:
+ """Override send to validate redirect targets against SSRF.
+
+ The ``requests`` library follows redirects internally via
+ ``resolve_redirects`` which calls ``send()`` for each hop
+ **without** going through ``request()``. By validating the
+ URL in ``send()`` we ensure every redirect target is checked.
+ """
+ if request.url and not validate_url(
+ request.url,
+ allow_localhost=self.allow_localhost,
+ allow_private_ips=self.allow_private_ips,
+ ):
+ raise ValueError(
+ f"Redirect target failed security validation (possible SSRF): {request.url}"
+ )
+
+ return super().send(request, **kwargs)
diff --git a/src/local_deep_research/web/services/research_service.py b/src/local_deep_research/web/services/research_service.py
index 7ed506136d..8fc4bb3a6f 100644
--- a/src/local_deep_research/web/services/research_service.py
+++ b/src/local_deep_research/web/services/research_service.py
@@ -553,7 +553,27 @@ def run_research_process(
should_emit = True
if should_emit:
- event_data = {"progress": adjusted_progress}
+ # Basic event data - include message for display
+ event_data = {
+ "progress": adjusted_progress,
+ "message": message,
+ "phase": phase,
+ }
+
+ # Include additional metadata for MCP/ReAct strategy display
+ if metadata.get("thought"):
+ event_data["thought"] = metadata["thought"]
+ if metadata.get("tool"):
+ event_data["tool"] = metadata["tool"]
+ if metadata.get("arguments"):
+ event_data["arguments"] = metadata["arguments"]
+ if metadata.get("iteration"):
+ event_data["iteration"] = metadata["iteration"]
+ if metadata.get("error"):
+ event_data["error"] = metadata["error"]
+ if metadata.get("content"):
+ event_data["content"] = metadata["content"]
+
SocketIOService().emit_to_subscribers(
"progress", research_id, event_data
)
diff --git a/src/local_deep_research/web/static/css/styles.css b/src/local_deep_research/web/static/css/styles.css
index 7ccd42516a..7269b775eb 100644
--- a/src/local_deep_research/web/static/css/styles.css
+++ b/src/local_deep_research/web/static/css/styles.css
@@ -885,6 +885,89 @@ textarea:focus, input[type="text"]:focus {
line-height: 1.4;
}
+/* Agent Thinking Panel - Shows ReAct reasoning for MCP strategy */
+.ldr-agent-thinking-panel {
+ margin-top: 1rem;
+ border: 1px solid var(--border-color);
+ border-radius: 8px;
+ background: var(--bg-secondary);
+ overflow: hidden;
+}
+
+.ldr-agent-thinking-header {
+ padding: 0.75rem 1rem;
+ background: var(--bg-tertiary);
+ border-bottom: 1px solid var(--border-color);
+ font-weight: 600;
+ color: var(--accent-primary);
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+}
+
+.ldr-agent-thinking-content {
+ padding: 1rem;
+ max-height: 400px;
+ overflow-y: auto;
+ font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
+ font-size: 0.9rem;
+ line-height: 1.5;
+}
+
+.ldr-agent-step {
+ margin-bottom: 1rem;
+ padding: 0.75rem;
+ border-radius: 6px;
+ background: var(--bg-primary);
+ border-left: 3px solid var(--border-color);
+}
+
+.ldr-agent-step.thought {
+ border-left-color: var(--accent-primary);
+}
+
+.ldr-agent-step.action {
+ border-left-color: var(--warning-color);
+}
+
+.ldr-agent-step.result {
+ border-left-color: var(--success-color);
+}
+
+.ldr-agent-step.error {
+ border-left-color: var(--error-color);
+}
+
+.ldr-agent-step-label {
+ font-weight: 700;
+ margin-bottom: 0.25rem;
+ text-transform: uppercase;
+ font-size: 0.75rem;
+ letter-spacing: 0.5px;
+}
+
+.ldr-agent-step.thought .ldr-agent-step-label {
+ color: var(--accent-primary);
+}
+
+.ldr-agent-step.action .ldr-agent-step-label {
+ color: var(--warning-color);
+}
+
+.ldr-agent-step.result .ldr-agent-step-label {
+ color: var(--success-color);
+}
+
+.ldr-agent-step.error .ldr-agent-step-label {
+ color: var(--error-color);
+}
+
+.ldr-agent-step-content {
+ color: var(--text-primary);
+ white-space: pre-wrap;
+ word-break: break-word;
+}
+
.ldr-progress-actions {
margin-top: 1.5rem;
display: flex;
diff --git a/src/local_deep_research/web/static/js/components/progress.js b/src/local_deep_research/web/static/js/components/progress.js
index 296bf83f43..248ea88395 100644
--- a/src/local_deep_research/web/static/js/components/progress.js
+++ b/src/local_deep_research/web/static/js/components/progress.js
@@ -288,6 +288,12 @@
if (!data) return;
+ // Handle agent thinking updates for MCP/ReAct strategy
+ if (data.phase && (data.phase === 'thought' || data.phase === 'tool_call' ||
+ data.phase === 'observation' || data.phase === 'error' || data.phase === 'react')) {
+ updateAgentThinking(data);
+ }
+
// Process progress_log if available and add to logs
// NOTE: This is now handled by the logpanel component directly
// We'll just ensure the panel is visible and let it manage logs
@@ -1160,6 +1166,96 @@
}
}
+ /**
+ * Update the agent thinking panel with ReAct steps
+ * @param {Object} data - The progress data with phase info
+ */
+ function updateAgentThinking(data) {
+ const panel = document.getElementById('agent-thinking-panel');
+ const content = document.getElementById('agent-thinking-content');
+
+ if (!panel || !content) return;
+
+ // Show the panel
+ panel.style.display = 'block';
+
+ // Determine step type and content
+ let stepType = 'info';
+ let label = '';
+ let stepContent = '';
+
+ switch (data.phase) {
+ case 'react':
+ // Iteration start - add a separator
+ stepType = 'info';
+ label = `CYCLE ${data.iteration || '?'}`;
+ stepContent = data.message || 'Agent is reasoning...';
+ break;
+ case 'thought':
+ stepType = 'thought';
+ label = '💭 THINKING';
+ stepContent = data.thought || data.message || '';
+ break;
+ case 'tool_call':
+ stepType = 'action';
+ label = '🔧 ACTION';
+ const tool = data.tool || 'unknown';
+ const args = data.arguments || {};
+ stepContent = `Using ${tool}`;
+ if (args.query) {
+ stepContent += `\nQuery: "${args.query}"`;
+ } else if (Object.keys(args).length > 0) {
+ stepContent += `\nArgs: ${JSON.stringify(args, null, 2)}`;
+ }
+ break;
+ case 'observation':
+ stepType = 'result';
+ label = '📋 RESULT';
+ // Use content if available, otherwise message
+ let resultText = data.content || data.message || '';
+ if (resultText.length > 800) {
+ resultText = resultText.substring(0, 800) + '...';
+ }
+ stepContent = resultText;
+ break;
+ case 'error':
+ stepType = 'error';
+ label = '❌ ERROR';
+ stepContent = data.message || data.error || 'An error occurred';
+ break;
+ default:
+ stepType = 'info';
+ label = data.phase.toUpperCase();
+ stepContent = data.message || '';
+ }
+
+ // Create the step element
+ const step = document.createElement('div');
+ step.className = `ldr-agent-step ${stepType}`;
+ step.innerHTML = `
+ <div class="ldr-agent-step-label">${label}</div>
+ <div class="ldr-agent-step-content">${escapeHtml(stepContent)}</div>
+ `;
+
+ // Add to content
+ content.appendChild(step);
+
+ // Auto-scroll to bottom
+ content.scrollTop = content.scrollHeight;
+ }
+
+ /**
+ * Escape HTML to prevent XSS
+ * @param {string} text - Text to escape
+ * @returns {string} - Escaped text
+ */
+ function escapeHtml(text) {
+ if (!text) return '';
+ const div = document.createElement('div');
+ div.textContent = text;
+ return div.innerHTML;
+ }
+
// Initialize on page load
document.addEventListener('DOMContentLoaded', initializeProgress);
diff --git a/src/local_deep_research/web/static/js/services/socket.js b/src/local_deep_research/web/static/js/services/socket.js
index dd3245425d..c17c4a2dd2 100644
--- a/src/local_deep_research/web/static/js/services/socket.js
+++ b/src/local_deep_research/web/static/js/services/socket.js
@@ -181,6 +181,9 @@ window.socket = (function() {
try {
socket.emit('join', { research_id: researchId });
+ // Remove any existing listener first to prevent duplicates
+ socket.off(`progress_${researchId}`);
+
// Setup direct event handler for progress updates
socket.on(`progress_${researchId}`, (data) => {
handleProgressUpdate(researchId, data);
@@ -800,8 +803,16 @@ window.socket = (function() {
return usingPolling;
}
- // Initialize socket on load with a small delay to ensure document is ready
- setTimeout(initializeSocket, 100);
+ // Initialize socket only after DOM is ready to avoid blocking DOMContentLoaded detection
+ // This is important for Puppeteer tests that use waitUntil: 'domcontentloaded'
+ if (document.readyState === 'loading') {
+ document.addEventListener('DOMContentLoaded', function() {
+ setTimeout(initializeSocket, 100);
+ });
+ } else {
+ // DOM already ready
+ setTimeout(initializeSocket, 100);
+ }
// Expose functions globally
window.filterLogsByType = filterLogsByType;
diff --git a/src/local_deep_research/web/templates/pages/progress.html b/src/local_deep_research/web/templates/pages/progress.html
index 6b8179ef97..d5bb8ddcee 100644
--- a/src/local_deep_research/web/templates/pages/progress.html
+++ b/src/local_deep_research/web/templates/pages/progress.html
@@ -28,6 +28,16 @@
<div class="ldr-task-label">Current Task:</div>
<div id="current-task" class="ldr-task-text">Starting research...</div>
</div>
+
+ <!-- Agent Thinking Panel - Shows ReAct reasoning for MCP strategy -->
+ <div id="agent-thinking-panel" class="ldr-agent-thinking-panel" style="display: none;">
+ <div class="ldr-agent-thinking-header">
+ <i class="fas fa-brain"></i> Agent Reasoning
+ </div>
+ <div id="agent-thinking-content" class="ldr-agent-thinking-content">
+ <!-- ReAct steps will be added here -->
+ </div>
+ </div>
<div class="ldr-progress-actions">
<button id="cancel-research-btn" class="btn ldr-btn-outline ldr-terminate-btn">
<i class="fas fa-stop-circle"></i> Cancel Research
diff --git a/src/local_deep_research/web/templates/pages/research.html b/src/local_deep_research/web/templates/pages/research.html
index b02aac4883..9c65ccd344 100644
--- a/src/local_deep_research/web/templates/pages/research.html
+++ b/src/local_deep_research/web/templates/pages/research.html
@@ -238,6 +238,7 @@
<option value="focused-iteration-standard" {% if settings.search_strategy == 'focused-iteration-standard' %}selected{% endif %}>Focused Iteration - Comprehensive (Needs >16,000 context window)</option>
<option value="iterative-refinement" {% if settings.search_strategy == 'iterative-refinement' %}selected{% endif %}>Experimental: Iterative Refinement (Progressive refinement)</option>
<option value="topic-organization" {% if settings.search_strategy == 'topic-organization' %}selected{% endif %}>Experimental: Topic Organization (Clusters by topic)</option>
+ <option value="mcp" {% if settings.search_strategy == 'mcp' %}selected{% endif %}>MCP ReAct (Agentic research - LLM decides tools)</option>
</select>
<span class="ldr-input-help">Focused Iteration works best with >16,000 context window</span>
</div>
diff --git a/tests/content_fetcher/__init__.py b/tests/content_fetcher/__init__.py
new file mode 100644
index 0000000000..0f6d9cd01f
--- /dev/null
+++ b/tests/content_fetcher/__init__.py
@@ -0,0 +1 @@
+"""Tests for content_fetcher module."""
diff --git a/tests/content_fetcher/conftest.py b/tests/content_fetcher/conftest.py
new file mode 100644
index 0000000000..8636206d0f
--- /dev/null
+++ b/tests/content_fetcher/conftest.py
@@ -0,0 +1,99 @@
+"""
+Fixtures for content_fetcher tests.
+"""
+
+import pytest
+from unittest.mock import MagicMock, patch
+
+
+def mock_html_response():
+ """Mock HTML response for testing."""
+ return """
+ <!DOCTYPE html>
+ <html>
+ <head>
+ <title>Test Article Title</title>
+ <meta name="description" content="This is a test article description.">
+ <meta name="author" content="Test Author">
+ </head>
+ <body>
+ <nav>Navigation menu to be removed</nav>
+ <article>
+ <h1>Main Article Heading</h1>
+ <p>This is the first paragraph of the article content. It contains important information about the topic being discussed.</p>
+ <p>This is the second paragraph with more details about the subject matter.</p>
+ <h2>Subheading</h2>
+ <p>Additional content under the subheading explaining more concepts.</p>
+ </article>
+ <footer>Footer content to be removed</footer>
+ </body>
+ </html>
+ """
+
+
+def mock_arxiv_html():
+ """Mock arXiv abstract page."""
+ return """
+ <!DOCTYPE html>
+ <html>
+ <head>
+ <title>[2301.12345] Attention Is All You Need</title>
+ </head>
+ <body>
+ <div id="abs">
+ <h1>Attention Is All You Need</h1>
+ <div class="authors">Vaswani et al.</div>
+ <blockquote class="abstract">
+ The dominant sequence transduction models are based on complex recurrent or
+ convolutional neural networks. We propose a new simple network architecture,
+ the Transformer, based solely on attention mechanisms.
+ </blockquote>
+ </div>
+ </body>
+ </html>
+ """
+
+
+def mock_session():
+ """Mock requests session."""
+ mock = MagicMock()
+ mock.headers = {}
+ return mock
+
+
+def mock_successful_response(mock_html_response):
+ """Mock successful HTTP response."""
+ response = MagicMock()
+ response.status_code = 200
+ response.text = mock_html_response
+ response.content = mock_html_response.encode("utf-8")
+ response.headers = {"content-type": "text/html; charset=utf-8"}
+ return response
+
+
+def mock_pdf_response():
+ """Mock PDF response (minimal valid PDF)."""
+ # Minimal PDF content
+ pdf_content = b"%PDF-1.4\n1 0 obj\n<<>>\nendobj\ntrailer\n<<>>\n%%EOF"
+ response = MagicMock()
+ response.status_code = 200
+ response.content = pdf_content
+ response.headers = {"content-type": "application/pdf"}
+ return response
+
+
+def mock_rate_tracker():
+ """Mock rate tracker."""
+ with patch(
+ "local_deep_research.research_library.downloaders.html.AdaptiveRateLimitTracker"
+ ) as mock:
+ tracker = MagicMock()
+ tracker.apply_rate_limit.return_value = 0
+ mock.return_value = tracker
+ yield tracker
diff --git a/tests/content_fetcher/test_fetcher.py b/tests/content_fetcher/test_fetcher.py
new file mode 100644
index 0000000000..7968759fd1
--- /dev/null
+++ b/tests/content_fetcher/test_fetcher.py
@@ -0,0 +1,359 @@
+"""
+Tests for ContentFetcher unified interface.
+"""
+
+import pytest
+from unittest.mock import MagicMock, patch
+
+from local_deep_research.content_fetcher import ContentFetcher, URLType
+from local_deep_research.research_library.downloaders.base import DownloadResult
+
+
+class TestContentFetcherInit:
+ """Test ContentFetcher initialization."""
+
+ def test_init_default_timeout(self):
+ """Test default timeout."""
+ fetcher = ContentFetcher()
+ assert fetcher.timeout == 30
+
+ def test_init_custom_timeout(self):
+ """Test custom timeout."""
+ fetcher = ContentFetcher(timeout=60)
+ assert fetcher.timeout == 60
+
+
+class TestContentFetcherGetDownloader:
+ """Test downloader selection."""
+
+ def test_get_html_downloader(self):
+ """Test HTML downloader is returned for HTML type."""
+ fetcher = ContentFetcher()
+ downloader = fetcher._get_downloader(URLType.HTML)
+
+ assert downloader is not None
+ # Should be cached
+ assert fetcher._get_downloader(URLType.HTML) is downloader
+
+ def test_get_arxiv_downloader(self):
+ """Test arXiv downloader is returned."""
+ fetcher = ContentFetcher()
+ downloader = fetcher._get_downloader(URLType.ARXIV)
+
+ # May be None if ArxivDownloader not available
+ # but should not raise exception
+ assert downloader is None or downloader is not None
+
+ def test_downloader_caching(self):
+ """Test downloaders are cached."""
+ fetcher = ContentFetcher()
+
+ # Get HTML downloader twice
+ d1 = fetcher._get_downloader(URLType.HTML)
+ d2 = fetcher._get_downloader(URLType.HTML)
+
+ assert d1 is d2
+
+
+class TestContentFetcherFetch:
+ """Test fetch functionality."""
+
+ @patch(
+ "local_deep_research.content_fetcher.fetcher.ContentFetcher._get_downloader"
+ )
+ def test_fetch_success(self, mock_get_downloader):
+ """Test successful fetch."""
+ # Setup mock downloader
+ mock_downloader = MagicMock()
+ mock_downloader.download_with_result.return_value = DownloadResult(
+ content=b"Test content from the article.",
+ is_success=True,
+ )
+ mock_downloader.get_metadata.return_value = {"title": "Test Article"}
+ mock_get_downloader.return_value = mock_downloader
+
+ fetcher = ContentFetcher()
+ result = fetcher.fetch("https://example.com/article")
+
+ assert result["status"] == "success"
+ assert "Test content" in result["content"]
+ assert result["url"] == "https://example.com/article"
+ assert result["source_type"] == "Web Page"
+
+ @patch(
+ "local_deep_research.content_fetcher.fetcher.ContentFetcher._get_downloader"
+ )
+ def test_fetch_failure(self, mock_get_downloader):
+ """Test fetch failure."""
+ # Setup mock downloader
+ mock_downloader = MagicMock()
+ mock_downloader.download_with_result.return_value = DownloadResult(
+ content=None,
+ is_success=False,
+ skip_reason="Page not found",
+ )
+ mock_get_downloader.return_value = mock_downloader
+
+ fetcher = ContentFetcher()
+ result = fetcher.fetch("https://example.com/notfound")
+
+ assert result["status"] == "error"
+ assert "not found" in result["error"].lower()
+
+ @patch(
+ "local_deep_research.content_fetcher.fetcher.ContentFetcher._get_downloader"
+ )
+ def test_fetch_with_max_length(self, mock_get_downloader):
+ """Test fetch with max_length truncation."""
+ long_content = "A" * 20000 # 20k characters
+
+ mock_downloader = MagicMock()
+ mock_downloader.download_with_result.return_value = DownloadResult(
+ content=long_content.encode("utf-8"),
+ is_success=True,
+ )
+ mock_downloader.get_metadata.return_value = {}
+ mock_get_downloader.return_value = mock_downloader
+
+ fetcher = ContentFetcher()
+ result = fetcher.fetch("https://example.com/long", max_length=1000)
+
+ assert result["status"] == "success"
+ assert len(result["content"]) < 20000
+ assert "truncated" in result["content"].lower()
+
+ @patch(
+ "local_deep_research.content_fetcher.fetcher.ContentFetcher._get_downloader"
+ )
+ def test_fetch_exception_handling(self, mock_get_downloader):
+ """Test fetch handles exceptions gracefully."""
+ # Setup mock downloader that raises an exception
+ mock_downloader = MagicMock()
+ mock_downloader.download_with_result.side_effect = Exception(
+ "Network error"
+ )
+ mock_get_downloader.return_value = mock_downloader
+
+ fetcher = ContentFetcher()
+ result = fetcher.fetch("https://example.com/article")
+
+ assert result["status"] == "error"
+ assert (
+ "error" in result["error"].lower()
+ or "network" in result["error"].lower()
+ )
+
+
+class TestContentFetcherFetchText:
+ """Test fetch_text convenience method."""
+
+ @patch(
+ "local_deep_research.content_fetcher.fetcher.ContentFetcher._get_downloader"
+ )
+ def test_fetch_text_success(self, mock_get_downloader):
+ """Test fetch_text returns text on success."""
+ mock_downloader = MagicMock()
+ mock_downloader.download_with_result.return_value = DownloadResult(
+ content=b"Article text content.",
+ is_success=True,
+ )
+ mock_downloader.get_metadata.return_value = {}
+ mock_get_downloader.return_value = mock_downloader
+
+ fetcher = ContentFetcher()
+ result = fetcher.fetch_text("https://example.com/article")
+
+ assert result is not None
+ assert "Article text content" in result
+
+ @patch(
+ "local_deep_research.content_fetcher.fetcher.ContentFetcher._get_downloader"
+ )
+ def test_fetch_text_failure(self, mock_get_downloader):
+ """Test fetch_text returns None on failure."""
+ mock_downloader = MagicMock()
+ mock_downloader.download_with_result.return_value = DownloadResult(
+ content=None,
+ is_success=False,
+ skip_reason="Error",
+ )
+ mock_get_downloader.return_value = mock_downloader
+
+ fetcher = ContentFetcher()
+ result = fetcher.fetch_text("https://example.com/error")
+
+ assert result is None
+
+
+class TestContentFetcherGetURLInfo:
+ """Test URL info without downloading."""
+
+ def test_get_url_info_arxiv(self):
+ """Test URL info for arXiv."""
+ fetcher = ContentFetcher()
+ info = fetcher.get_url_info("https://arxiv.org/abs/2301.12345")
+
+ assert info["url"] == "https://arxiv.org/abs/2301.12345"
+ assert info["url_type"] == "arxiv"
+ assert info["source_name"] == "arXiv"
+ assert info["extracted_id"] == "2301.12345"
+
+ def test_get_url_info_pubmed(self):
+ """Test URL info for PubMed."""
+ fetcher = ContentFetcher()
+ info = fetcher.get_url_info("https://pubmed.ncbi.nlm.nih.gov/12345678")
+
+ assert info["url_type"] == "pubmed"
+ assert info["source_name"] == "PubMed"
+ assert info["extracted_id"] == "12345678"
+
+ def test_get_url_info_generic(self):
+ """Test URL info for generic web page."""
+ fetcher = ContentFetcher()
+ info = fetcher.get_url_info("https://example.com/article/123")
+
+ assert info["url_type"] == "html"
+ assert info["source_name"] == "Web Page"
+ assert info["extracted_id"] is None
+
+
+class TestContentFetcherURLTypeRouting:
+ """Test that URLs are routed to correct downloaders."""
+
+ def test_arxiv_routing(self):
+ """Test arXiv URLs are detected correctly."""
+ fetcher = ContentFetcher()
+ info = fetcher.get_url_info("https://arxiv.org/abs/2301.12345")
+ assert info["url_type"] == "arxiv"
+
+ def test_pubmed_routing(self):
+ """Test PubMed URLs are detected correctly."""
+ fetcher = ContentFetcher()
+ info = fetcher.get_url_info("https://pubmed.ncbi.nlm.nih.gov/12345")
+ assert info["url_type"] == "pubmed"
+
+ def test_semantic_scholar_routing(self):
+ """Test Semantic Scholar URLs are detected correctly."""
+ fetcher = ContentFetcher()
+ info = fetcher.get_url_info(
+ "https://www.semanticscholar.org/paper/Title/abc123"
+ )
+ assert info["url_type"] == "semantic_scholar"
+
+ def test_biorxiv_routing(self):
+ """Test bioRxiv URLs are detected correctly."""
+ fetcher = ContentFetcher()
+ info = fetcher.get_url_info(
+ "https://www.biorxiv.org/content/10.1101/123"
+ )
+ assert info["url_type"] == "biorxiv"
+
+ def test_doi_routing(self):
+ """Test DOI URLs are detected correctly."""
+ fetcher = ContentFetcher()
+ info = fetcher.get_url_info("https://doi.org/10.1234/example")
+ assert info["url_type"] == "doi"
+
+ def test_pdf_routing(self):
+ """Test direct PDF URLs are detected correctly."""
+ fetcher = ContentFetcher()
+ info = fetcher.get_url_info("https://example.com/paper.pdf")
+ assert info["url_type"] == "pdf"
+
+ def test_html_routing(self):
+ """Test generic HTML URLs are detected correctly."""
+ fetcher = ContentFetcher()
+ info = fetcher.get_url_info("https://news.ycombinator.com/item?id=123")
+ assert info["url_type"] == "html"
+
+
+class TestContentFetcherIntegration:
+ """Integration tests (may require network, marked for CI skip if needed)."""
+
+ @pytest.mark.skip(reason="Requires network access - run manually")
+ def test_fetch_real_webpage(self):
+ """Test fetching a real webpage."""
+ fetcher = ContentFetcher()
+ result = fetcher.fetch("https://httpbin.org/html")
+
+ assert result["status"] == "success"
+ assert len(result["content"]) > 0
+
+ @pytest.mark.skip(reason="Requires network access - run manually")
+ def test_fetch_real_arxiv(self):
+ """Test fetching a real arXiv paper."""
+ fetcher = ContentFetcher()
+ # Use a known stable paper
+ result = fetcher.fetch("https://arxiv.org/abs/1706.03762")
+
+ # May succeed or fail depending on arXiv availability
+ assert result["status"] in ("success", "error")
+
+
+class TestContentFetcherSecurity:
+ """Security tests for ContentFetcher."""
+
+ def test_fetch_javascript_url_rejected(self):
+ """Test that javascript: URLs are rejected."""
+ fetcher = ContentFetcher()
+ result = fetcher.fetch("javascript:alert('XSS')")
+
+ assert result["status"] == "error"
+ assert (
+ "invalid" in result["error"].lower()
+ or "unsupported" in result["error"].lower()
+ )
+ assert result["source_type"] == "Invalid URL"
+
+ def test_fetch_data_url_rejected(self):
+ """Test that data: URLs are rejected."""
+ fetcher = ContentFetcher()
+ result = fetcher.fetch("data:text/html,<script>evil()</script>")
+
+ assert result["status"] == "error"
+ assert result["source_type"] == "Invalid URL"
+
+ def test_fetch_file_url_rejected(self):
+ """Test that file: URLs are rejected."""
+ fetcher = ContentFetcher()
+ result = fetcher.fetch("file:///etc/passwd")
+
+ assert result["status"] == "error"
+ assert result["source_type"] == "Invalid URL"
+
+
+class TestContentFetcherDefaults:
+ """Test default values and configuration."""
+
+ def test_default_max_length_applied(self):
+ """Test that default max_length is applied when not specified."""
+ from local_deep_research.content_fetcher.fetcher import (
+ DEFAULT_MAX_CONTENT_LENGTH,
+ )
+
+ # Verify the constant exists and is reasonable
+ assert DEFAULT_MAX_CONTENT_LENGTH == 500_000 # 500KB
+
+ @patch(
+ "local_deep_research.content_fetcher.fetcher.ContentFetcher._get_downloader"
+ )
+ def test_fetch_uses_default_max_length(self, mock_get_downloader):
+ """Test that fetch applies default max_length to large content."""
+ # Create content larger than default max length
+ large_content = "X" * 600_000 # 600KB
+
+ mock_downloader = MagicMock()
+ mock_downloader.download_with_result.return_value = DownloadResult(
+ content=large_content.encode("utf-8"),
+ is_success=True,
+ )
+ mock_downloader.get_metadata.return_value = {}
+ mock_get_downloader.return_value = mock_downloader
+
+ fetcher = ContentFetcher()
+ result = fetcher.fetch("https://example.com/large")
+
+ assert result["status"] == "success"
+ # Content should be truncated to default max length
+ assert len(result["content"]) < 600_000
+ assert "truncated" in result["content"].lower()
diff --git a/tests/content_fetcher/test_html_downloader.py b/tests/content_fetcher/test_html_downloader.py
new file mode 100644
index 0000000000..83a08ce307
--- /dev/null
+++ b/tests/content_fetcher/test_html_downloader.py
@@ -0,0 +1,335 @@
+"""
+Tests for HTML downloader.
+"""
+
+from unittest.mock import MagicMock, patch
+
+from local_deep_research.research_library.downloaders.html import HTMLDownloader
+from local_deep_research.research_library.downloaders.base import ContentType
+
+
+class TestHTMLDownloaderCanHandle:
+ """Test URL handling capability."""
+
+ def test_can_handle_http(self):
+ """Test HTTP URLs are handled."""
+ downloader = HTMLDownloader()
+ assert downloader.can_handle("http://example.com/article")
+
+ def test_can_handle_https(self):
+ """Test HTTPS URLs are handled."""
+ downloader = HTMLDownloader()
+ assert downloader.can_handle("https://example.com/article")
+
+ def test_cannot_handle_ftp(self):
+ """Test FTP URLs are not handled."""
+ downloader = HTMLDownloader()
+ assert not downloader.can_handle("ftp://example.com/file")
+
+ def test_cannot_handle_invalid(self):
+ """Test invalid URLs are not handled."""
+ downloader = HTMLDownloader()
+ assert not downloader.can_handle("not-a-url")
+
+
+class TestHTMLDownloaderExtraction:
+ """Test content extraction from HTML."""
+
+ @patch(
+ "local_deep_research.research_library.downloaders.html.HTMLDownloader._fetch_html"
+ )
+ def test_extract_title(self, mock_fetch, mock_html_response):
+ """Test title extraction."""
+ mock_fetch.return_value = mock_html_response
+
+ downloader = HTMLDownloader()
+ result = downloader.download_text("https://example.com/article")
+
+ assert result is not None
+ assert "Test Article Title" in result
+
+ @patch(
+ "local_deep_research.research_library.downloaders.html.HTMLDownloader._fetch_html"
+ )
+ def test_extract_content(self, mock_fetch, mock_html_response):
+ """Test main content extraction."""
+ mock_fetch.return_value = mock_html_response
+
+ downloader = HTMLDownloader()
+ result = downloader.download_text("https://example.com/article")
+
+ assert result is not None
+ assert "first paragraph" in result
+ assert "second paragraph" in result
+
+ @patch(
+ "local_deep_research.research_library.downloaders.html.HTMLDownloader._fetch_html"
+ )
+ def test_removes_navigation(self, mock_fetch, mock_html_response):
+ """Test navigation elements are removed."""
+ mock_fetch.return_value = mock_html_response
+
+ downloader = HTMLDownloader()
+ result = downloader.download_text("https://example.com/article")
+
+ assert result is not None
+ assert "Navigation menu" not in result
+
+ @patch(
+ "local_deep_research.research_library.downloaders.html.HTMLDownloader._fetch_html"
+ )
+ def test_removes_footer(self, mock_fetch, mock_html_response):
+ """Test footer elements are removed."""
+ mock_fetch.return_value = mock_html_response
+
+ downloader = HTMLDownloader()
+ result = downloader.download_text("https://example.com/article")
+
+ assert result is not None
+ assert "Footer content" not in result
+
+ @patch(
+ "local_deep_research.research_library.downloaders.html.HTMLDownloader._fetch_html"
+ )
+ def test_extract_description(self, mock_fetch, mock_html_response):
+ """Test meta description extraction."""
+ mock_fetch.return_value = mock_html_response
+
+ downloader = HTMLDownloader()
+ result = downloader.download_text("https://example.com/article")
+
+ assert result is not None
+ assert "test article description" in result
+
+
+class TestHTMLDownloaderDownload:
+ """Test download functionality."""
+
+ @patch(
+ "local_deep_research.research_library.downloaders.html.HTMLDownloader._fetch_html"
+ )
+ def test_download_returns_bytes(self, mock_fetch, mock_html_response):
+ """Test download returns bytes."""
+ mock_fetch.return_value = mock_html_response
+
+ downloader = HTMLDownloader()
+ result = downloader.download(
+ "https://example.com/article", ContentType.TEXT
+ )
+
+ assert result is not None
+ assert isinstance(result, bytes)
+
+ @patch(
+ "local_deep_research.research_library.downloaders.html.HTMLDownloader._fetch_html"
+ )
+ def test_download_pdf_not_supported(self, mock_fetch):
+ """Test PDF download returns None."""
+ downloader = HTMLDownloader()
+ result = downloader.download(
+ "https://example.com/article", ContentType.PDF
+ )
+
+ assert result is None
+ mock_fetch.assert_not_called()
+
+ @patch(
+ "local_deep_research.research_library.downloaders.html.HTMLDownloader._fetch_html"
+ )
+ def test_download_with_result_success(self, mock_fetch, mock_html_response):
+ """Test download_with_result on success."""
+ mock_fetch.return_value = mock_html_response
+
+ downloader = HTMLDownloader()
+ result = downloader.download_with_result(
+ "https://example.com/article", ContentType.TEXT
+ )
+
+ assert result.is_success
+ assert result.content is not None
+ assert result.skip_reason is None
+
+ @patch(
+ "local_deep_research.research_library.downloaders.html.HTMLDownloader._fetch_html"
+ )
+ def test_download_with_result_failure(self, mock_fetch):
+ """Test download_with_result on failure."""
+ mock_fetch.return_value = None
+
+ downloader = HTMLDownloader()
+ result = downloader.download_with_result(
+ "https://example.com/article", ContentType.TEXT
+ )
+
+ assert not result.is_success
+ assert result.content is None
+ assert result.skip_reason is not None
+
+
+class TestHTMLDownloaderFetchHTML:
+ """Test HTML fetching."""
+
+ @patch("local_deep_research.security.SafeSession")
+ def test_fetch_html_success(
+ self, mock_session_class, mock_successful_response
+ ):
+ """Test successful HTML fetch."""
+ mock_session = MagicMock()
+ mock_session.headers = {}
+ mock_session.get.return_value = mock_successful_response
+ mock_session_class.return_value = mock_session
+
+ downloader = HTMLDownloader()
+ downloader.session = mock_session
+
+ result = downloader._fetch_html("https://example.com/article")
+
+ assert result is not None
+ mock_session.get.assert_called_once()
+
+ @patch("local_deep_research.security.SafeSession")
+ def test_fetch_html_404(self, mock_session_class):
+ """Test 404 response."""
+ mock_session = MagicMock()
+ mock_session.headers = {}
+ mock_response = MagicMock()
+ mock_response.status_code = 404
+ mock_session.get.return_value = mock_response
+ mock_session_class.return_value = mock_session
+
+ downloader = HTMLDownloader()
+ downloader.session = mock_session
+
+ result = downloader._fetch_html("https://example.com/notfound")
+
+ assert result is None
+
+ @patch("local_deep_research.security.SafeSession")
+ def test_fetch_html_wrong_content_type(self, mock_session_class):
+ """Test non-HTML content type."""
+ mock_session = MagicMock()
+ mock_session.headers = {}
+ mock_response = MagicMock()
+ mock_response.status_code = 200
+ mock_response.headers = {"content-type": "application/json"}
+ mock_session.get.return_value = mock_response
+ mock_session_class.return_value = mock_session
+
+ downloader = HTMLDownloader()
+ downloader.session = mock_session
+
+ result = downloader._fetch_html("https://api.example.com/data")
+
+ assert result is None
+
+
+class TestHTMLDownloaderMetadata:
+ """Test metadata extraction."""
+
+ @patch(
+ "local_deep_research.research_library.downloaders.html.HTMLDownloader._fetch_html"
+ )
+ def test_get_metadata(self, mock_fetch, mock_html_response):
+ """Test metadata extraction."""
+ mock_fetch.return_value = mock_html_response
+
+ downloader = HTMLDownloader()
+ metadata = downloader.get_metadata("https://example.com/article")
+
+ assert metadata.get("url") == "https://example.com/article"
+ assert metadata.get("title") == "Test Article Title"
+ assert (
+ metadata.get("description") == "This is a test article description."
+ )
+ assert metadata.get("author") == "Test Author"
+
+ @patch(
+ "local_deep_research.research_library.downloaders.html.HTMLDownloader._fetch_html"
+ )
+ def test_get_metadata_fetch_failure(self, mock_fetch):
+ """Test metadata extraction when fetch fails."""
+ mock_fetch.return_value = None
+
+ downloader = HTMLDownloader()
+ metadata = downloader.get_metadata("https://example.com/article")
+
+ assert metadata == {}
+
+
+class TestHTMLDownloaderEdgeCases:
+ """Test edge cases."""
+
+ @patch(
+ "local_deep_research.research_library.downloaders.html.HTMLDownloader._fetch_html"
+ )
+ def test_empty_html(self, mock_fetch):
+ """Test handling of empty HTML."""
+ mock_fetch.return_value = "<html><body></body></html>"
+
+ downloader = HTMLDownloader()
+ result = downloader.download_text("https://example.com/empty")
+
+ # Should return None for empty content
+ assert result is None
+
+ @patch(
+ "local_deep_research.research_library.downloaders.html.HTMLDownloader._fetch_html"
+ )
+ def test_malformed_html(self, mock_fetch):
+ """Test handling of malformed HTML."""
+ mock_fetch.return_value = "<html><body><p>Unclosed paragraph"
+
+ downloader = HTMLDownloader()
+ # Should not raise exception
+ result = downloader.download_text("https://example.com/malformed")
+
+ # BeautifulSoup handles malformed HTML gracefully
+ assert result is None or isinstance(result, str)
+
+ @patch(
+ "local_deep_research.research_library.downloaders.html.HTMLDownloader._fetch_html"
+ )
+ def test_unicode_content(self, mock_fetch):
+ """Test handling of Unicode content."""
+ mock_fetch.return_value = """
+ <html>
+ <head><title>Unicode Test</title></head>
+ <body>
+ <article>
+ <p>This has émojis 🎉 and spëcial çharacters.</p>
+ <p>Chinese: 中文内容</p>
+ <p>Japanese: 日本語のテキスト</p>
+ </article>
+ </body>
+ </html>
+ """
+
+ downloader = HTMLDownloader()
+ result = downloader.download_text("https://example.com/unicode")
+
+ assert result is not None
+ assert "émojis" in result or "mojis" in result # Unicode handling
+ assert "中文" in result or "Chinese" in result
+
+ @patch(
+ "local_deep_research.research_library.downloaders.html.HTMLDownloader._fetch_html"
+ )
+ def test_very_long_content(self, mock_fetch):
+ """Test handling of very long content."""
+ # Create HTML with many paragraphs
+ paragraphs = "\n".join(
+ f"<p>Paragraph {i} with some content that is long enough to matter.</p>"
+ for i in range(100)
+ )
+ mock_fetch.return_value = f"""
+ <html>
+ <head><title>Long Article</title></head>
+ <body><article>{paragraphs}</article></body>
+ </html>
+ """
+
+ downloader = HTMLDownloader()
+ result = downloader.download_text("https://example.com/long")
+
+ assert result is not None
+ assert len(result) > 1000
diff --git a/tests/content_fetcher/test_mcp_integration.py b/tests/content_fetcher/test_mcp_integration.py
new file mode 100644
index 0000000000..5cb66e9443
--- /dev/null
+++ b/tests/content_fetcher/test_mcp_integration.py
@@ -0,0 +1,360 @@
+"""
+Integration tests for download_content tool in MCP strategy.
+"""
+
+from unittest.mock import MagicMock, patch
+
+from local_deep_research.content_fetcher import ContentFetcher
+from local_deep_research.research_library.downloaders.base import DownloadResult
+
+
+class TestMCPDownloadContentTool:
+ """Test download_content tool integration with MCP strategy."""
+
+ @patch(
+ "local_deep_research.content_fetcher.fetcher.ContentFetcher._get_downloader"
+ )
+ def test_execute_download_content_success(self, mock_get_downloader):
+ """Test successful content download via MCP strategy executor."""
+ # Setup mock
+ mock_downloader = MagicMock()
+ mock_downloader.download_with_result.return_value = DownloadResult(
+ content=b"# Research Paper\n\nThis is the abstract of the paper discussing important findings.",
+ is_success=True,
+ )
+ mock_downloader.get_metadata.return_value = {
+ "title": "Important Research Paper",
+ "author": "Dr. Smith",
+ }
+ mock_get_downloader.return_value = mock_downloader
+
+ # Import and test the executor pattern
+ from local_deep_research.content_fetcher import ContentFetcher
+
+ fetcher = ContentFetcher()
+ result = fetcher.fetch(
+ "https://arxiv.org/abs/2301.12345",
+ max_length=5000,
+ )
+
+ assert result["status"] == "success"
+ assert "abstract" in result["content"].lower()
+ assert result["source_type"] == "arXiv"
+
+ @patch(
+ "local_deep_research.content_fetcher.fetcher.ContentFetcher._get_downloader"
+ )
+ def test_execute_download_content_with_truncation(
+ self, mock_get_downloader
+ ):
+ """Test content truncation for very long papers."""
+ # Create a very long paper content
+ long_content = "Introduction. " * 5000 # ~70k characters
+
+ mock_downloader = MagicMock()
+ mock_downloader.download_with_result.return_value = DownloadResult(
+ content=long_content.encode("utf-8"),
+ is_success=True,
+ )
+ mock_downloader.get_metadata.return_value = {}
+ mock_get_downloader.return_value = mock_downloader
+
+ fetcher = ContentFetcher()
+ result = fetcher.fetch(
+ "https://arxiv.org/abs/2301.12345",
+ max_length=1000,
+ )
+
+ assert result["status"] == "success"
+ assert len(result["content"]) < 2000 # Should be truncated
+ assert "truncated" in result["content"].lower()
+
+ @patch(
+ "local_deep_research.content_fetcher.fetcher.ContentFetcher._get_downloader"
+ )
+ def test_execute_download_content_paper_not_found(
+ self, mock_get_downloader
+ ):
+ """Test handling when paper is not available."""
+ mock_downloader = MagicMock()
+ mock_downloader.download_with_result.return_value = DownloadResult(
+ content=None,
+ is_success=False,
+ skip_reason="Paper not found or requires subscription",
+ )
+ mock_get_downloader.return_value = mock_downloader
+
+ fetcher = ContentFetcher()
+ result = fetcher.fetch("https://example.com/paywalled-paper")
+
+ assert result["status"] == "error"
+ assert (
+ "subscription" in result["error"].lower()
+ or "not found" in result["error"].lower()
+ )
+
+ @patch(
+ "local_deep_research.content_fetcher.fetcher.ContentFetcher._get_downloader"
+ )
+ def test_execute_download_content_timeout(self, mock_get_downloader):
+ """Test handling of timeout during download."""
+ mock_downloader = MagicMock()
+ mock_downloader.download_with_result.side_effect = TimeoutError(
+ "Connection timed out"
+ )
+ mock_get_downloader.return_value = mock_downloader
+
+ fetcher = ContentFetcher()
+ result = fetcher.fetch("https://slow-server.example.com/paper")
+
+ assert result["status"] == "error"
+ assert (
+ "timed out" in result["error"].lower()
+ or "timeout" in result["error"].lower()
+ )
+
+
+class TestDownloadContentWithRealURLPatterns:
+ """Test with real-world URL patterns."""
+
+ def test_arxiv_url_variants(self):
+ """Test various arXiv URL formats are recognized."""
+ fetcher = ContentFetcher()
+
+ # Standard abstract
+ info = fetcher.get_url_info("https://arxiv.org/abs/2301.12345")
+ assert info["url_type"] == "arxiv"
+ assert info["extracted_id"] == "2301.12345"
+
+ # With version
+ info = fetcher.get_url_info("https://arxiv.org/abs/2301.12345v3")
+ assert info["url_type"] == "arxiv"
+ assert info["extracted_id"] == "2301.12345v3"
+
+ # PDF link
+ info = fetcher.get_url_info("https://arxiv.org/pdf/2301.12345.pdf")
+ assert info["url_type"] == "arxiv"
+
+ # HTML version
+ info = fetcher.get_url_info("https://arxiv.org/html/2301.12345")
+ assert info["url_type"] == "arxiv"
+
+ # ar5iv (HTML rendering)
+ info = fetcher.get_url_info("https://ar5iv.org/abs/2301.12345")
+ assert info["url_type"] == "arxiv"
+
+ # Old format (pre-2007)
+ info = fetcher.get_url_info("https://arxiv.org/abs/hep-th/9901001")
+ assert info["url_type"] == "arxiv"
+
+ def test_pubmed_url_variants(self):
+ """Test various PubMed URL formats."""
+ fetcher = ContentFetcher()
+
+ # Standard PubMed
+ info = fetcher.get_url_info("https://pubmed.ncbi.nlm.nih.gov/12345678")
+ assert info["url_type"] == "pubmed"
+ assert info["extracted_id"] == "12345678"
+
+ # With trailing slash
+ info = fetcher.get_url_info("https://pubmed.ncbi.nlm.nih.gov/12345678/")
+ assert info["url_type"] == "pubmed"
+
+ # Old format
+ info = fetcher.get_url_info(
+ "https://www.ncbi.nlm.nih.gov/pubmed/12345678"
+ )
+ assert info["url_type"] == "pubmed"
+
+ def test_pmc_url_variants(self):
+ """Test various PMC URL formats."""
+ fetcher = ContentFetcher()
+
+ # Standard PMC
+ info = fetcher.get_url_info(
+ "https://www.ncbi.nlm.nih.gov/pmc/articles/PMC1234567/"
+ )
+ assert info["url_type"] == "pmc"
+ assert info["extracted_id"] == "PMC1234567"
+
+ # Europe PMC
+ info = fetcher.get_url_info("https://europepmc.org/article/PMC/1234567")
+ assert info["url_type"] == "pmc"
+
+ def test_semantic_scholar_url_variants(self):
+ """Test Semantic Scholar URL formats."""
+ fetcher = ContentFetcher()
+
+ # With paper title in URL
+ info = fetcher.get_url_info(
+ "https://www.semanticscholar.org/paper/Attention-Is-All-You-Need-Vaswani-Shazeer/abcdef1234567890abcdef1234567890abcdef12"
+ )
+ assert info["url_type"] == "semantic_scholar"
+
+ # API URL
+ info = fetcher.get_url_info(
+ "https://api.semanticscholar.org/v1/paper/abcd1234"
+ )
+ assert info["url_type"] == "semantic_scholar"
+
+ def test_biorxiv_medrxiv_url_variants(self):
+ """Test bioRxiv and medRxiv URL formats."""
+ fetcher = ContentFetcher()
+
+ # bioRxiv
+ info = fetcher.get_url_info(
+ "https://www.biorxiv.org/content/10.1101/2021.01.01.123456v1"
+ )
+ assert info["url_type"] == "biorxiv"
+
+ # medRxiv
+ info = fetcher.get_url_info(
+ "https://www.medrxiv.org/content/10.1101/2021.01.01.123456v1"
+ )
+ assert info["url_type"] == "medrxiv"
+
+ def test_doi_url_variants(self):
+ """Test DOI URL formats."""
+ fetcher = ContentFetcher()
+
+ # doi.org
+ info = fetcher.get_url_info("https://doi.org/10.1038/nature12373")
+ assert info["url_type"] == "doi"
+ assert "10.1038" in info["extracted_id"]
+
+ # dx.doi.org
+ info = fetcher.get_url_info(
+ "https://dx.doi.org/10.1126/science.1234567"
+ )
+ assert info["url_type"] == "doi"
+
+
+class TestDownloadContentEdgeCases:
+ """Test edge cases and error handling."""
+
+ @patch(
+ "local_deep_research.content_fetcher.fetcher.ContentFetcher._get_downloader"
+ )
+ def test_empty_url(self, mock_get_downloader):
+ """Test handling of empty URL."""
+ fetcher = ContentFetcher()
+ # Empty URL should still try to classify and fetch
+ info = fetcher.get_url_info("")
+ assert info["url_type"] == "html" # Falls back to HTML
+
+ @patch(
+ "local_deep_research.content_fetcher.fetcher.ContentFetcher._get_downloader"
+ )
+ def test_malformed_url(self, mock_get_downloader):
+ """Test handling of malformed URL."""
+ mock_downloader = MagicMock()
+ mock_downloader.download_with_result.side_effect = ValueError(
+ "Invalid URL"
+ )
+ mock_get_downloader.return_value = mock_downloader
+
+ fetcher = ContentFetcher()
+ result = fetcher.fetch("not-a-valid-url")
+
+ assert result["status"] == "error"
+
+ @patch(
+ "local_deep_research.content_fetcher.fetcher.ContentFetcher._get_downloader"
+ )
+ def test_binary_pdf_content(self, mock_get_downloader):
+ """Test handling of binary PDF content that can't be decoded as UTF-8."""
+ # Simulate PDF bytes that fail UTF-8 decoding
+ pdf_bytes = b"%PDF-1.4\x00\x01\x02\x03binary content"
+
+ mock_downloader = MagicMock()
+ mock_downloader.download_with_result.return_value = DownloadResult(
+ content=pdf_bytes,
+ is_success=True,
+ )
+ mock_downloader.get_metadata.return_value = {}
+ mock_get_downloader.return_value = mock_downloader
+
+ # Mock the PDF text extraction to return extracted text
+ with patch(
+ "local_deep_research.research_library.downloaders.base.BaseDownloader.extract_text_from_pdf"
+ ) as mock_extract:
+ mock_extract.return_value = "Extracted PDF text content"
+
+ fetcher = ContentFetcher()
+ result = fetcher.fetch("https://example.com/paper.pdf")
+
+ # Should attempt PDF extraction
+ assert result["status"] == "success" or result["status"] == "error"
+
+ @patch(
+ "local_deep_research.content_fetcher.fetcher.ContentFetcher._get_downloader"
+ )
+ def test_rate_limited_response(self, mock_get_downloader):
+ """Test handling of rate-limited responses."""
+ mock_downloader = MagicMock()
+ mock_downloader.download_with_result.return_value = DownloadResult(
+ content=None,
+ is_success=False,
+ skip_reason="Rate limited - too many requests (429)",
+ )
+ mock_get_downloader.return_value = mock_downloader
+
+ fetcher = ContentFetcher()
+ result = fetcher.fetch("https://arxiv.org/abs/2301.12345")
+
+ assert result["status"] == "error"
+ assert "rate" in result["error"].lower() or "429" in result["error"]
+
+ @patch(
+ "local_deep_research.content_fetcher.fetcher.ContentFetcher._get_downloader"
+ )
+ def test_subscription_required(self, mock_get_downloader):
+ """Test handling of paywalled content."""
+ mock_downloader = MagicMock()
+ mock_downloader.download_with_result.return_value = DownloadResult(
+ content=None,
+ is_success=False,
+ skip_reason="Subscription required to access full text",
+ )
+ mock_get_downloader.return_value = mock_downloader
+
+ fetcher = ContentFetcher()
+ result = fetcher.fetch("https://nature.com/articles/paywalled")
+
+ assert result["status"] == "error"
+ assert "subscription" in result["error"].lower()
+
+
+class TestDownloadContentCaching:
+ """Test downloader caching behavior."""
+
+ def test_downloader_reuse(self):
+ """Test that downloaders are cached and reused."""
+ fetcher = ContentFetcher()
+
+ # Get HTML downloader twice
+ d1 = fetcher._get_downloader(
+ __import__(
+ "local_deep_research.content_fetcher.url_classifier",
+ fromlist=["URLType"],
+ ).URLType.HTML
+ )
+ d2 = fetcher._get_downloader(
+ __import__(
+ "local_deep_research.content_fetcher.url_classifier",
+ fromlist=["URLType"],
+ ).URLType.HTML
+ )
+
+ # Should be the same instance
+ assert d1 is d2
+
+ def test_different_downloaders_for_different_types(self):
+ """Test that different URL types get different downloaders."""
+ from local_deep_research.content_fetcher.url_classifier import URLType
+
+ fetcher = ContentFetcher()
+
+ html_downloader = fetcher._get_downloader(URLType.HTML)
+ # Other downloaders may not be available, but HTML should always work
+ assert html_downloader is not None
diff --git a/tests/content_fetcher/test_security.py b/tests/content_fetcher/test_security.py
new file mode 100644
index 0000000000..fc094f17ab
--- /dev/null
+++ b/tests/content_fetcher/test_security.py
@@ -0,0 +1,393 @@
+"""
+Security tests for content fetcher.
+
+Tests for XSS prevention, malicious content handling, and safe URL processing.
+"""
+
+from unittest.mock import MagicMock, patch
+
+from local_deep_research.research_library.downloaders.html import HTMLDownloader
+from local_deep_research.content_fetcher import ContentFetcher
+from local_deep_research.content_fetcher.url_classifier import (
+ URLClassifier,
+ URLType,
+)
+
+
+class TestHTMLDownloaderSecurity:
+ """Security tests for HTML downloader."""
+
+ @patch(
+ "local_deep_research.research_library.downloaders.html.HTMLDownloader._fetch_html"
+ )
+ def test_script_tags_removed(self, mock_fetch):
+ """Test that script tags are removed from content."""
+ malicious_html = """
+ <html>
+ <head><title>Test</title></head>
+ <body>
+ <article>
+ <p>Safe content here that should be included in the extracted text output.</p>
+ <script>alert('XSS')</script>
+ <script src="https://evil.com/malware.js"></script>
+ <p>More safe content that should also appear in the final output.</p>
+ </article>
+ </body>
+ </html>
+ """
+ mock_fetch.return_value = malicious_html
+
+ downloader = HTMLDownloader()
+ result_bytes = downloader.download("https://example.com/page")
+
+ assert result_bytes is not None
+ result = result_bytes.decode("utf-8")
+ assert "<script>" not in result
+ assert "alert(" not in result
+ assert "evil.com" not in result
+ assert "Safe content" in result
+
+ @patch(
+ "local_deep_research.research_library.downloaders.html.HTMLDownloader._fetch_html"
+ )
+ def test_inline_javascript_removed(self, mock_fetch):
+ """Test that inline JavaScript event handlers are not in extracted text."""
+ malicious_html = """
+ <html>
+ <body>
+ <article>
+ <p onclick="stealCookies()">Click me and see the content here.</p>
+ <a href="javascript:void(0)" onmouseover="evil()">Link text here</a>
+ <p>Another paragraph with enough content.</p>
+ </article>
+ </body>
+ </html>
+ """
+ mock_fetch.return_value = malicious_html
+
+ downloader = HTMLDownloader()
+ result_bytes = downloader.download("https://example.com/page")
+
+ # The text extraction should just get the text, not attributes
+ assert result_bytes is not None
+ result = result_bytes.decode("utf-8")
+ assert "stealCookies" not in result
+ assert "javascript:" not in result
+ assert "onmouseover" not in result
+
+ @patch(
+ "local_deep_research.research_library.downloaders.html.HTMLDownloader._fetch_html"
+ )
+ def test_iframe_removed(self, mock_fetch):
+ """Test that iframes are removed."""
+ html_with_iframe = """
+ <html>
+ <body>
+ <article>
+ <p>Article content that should be included in the output.</p>
+ <iframe src="https://malicious.com/phishing"></iframe>
+ <iframe srcdoc="<script>evil()</script>"></iframe>
+ <p>More article content for the reader.</p>
+ </article>
+ </body>
+ </html>
+ """
+ mock_fetch.return_value = html_with_iframe
+
+ downloader = HTMLDownloader()
+ result_bytes = downloader.download("https://example.com/page")
+
+ assert result_bytes is not None
+ result = result_bytes.decode("utf-8")
+ assert "iframe" not in result.lower()
+ assert "malicious.com" not in result
+ assert "phishing" not in result
+
+ @patch(
+ "local_deep_research.research_library.downloaders.html.HTMLDownloader._fetch_html"
+ )
+ def test_form_elements_removed(self, mock_fetch):
+ """Test that form elements are removed (prevent phishing)."""
+ html_with_form = """
+ <html>
+ <body>
+ <article>
+ <p>Please enter your credentials in the form below:</p>
+ <form action="https://evil.com/steal">
+ <input type="password" name="password">
+ <button type="submit">Login</button>
+ </form>
+ <p>This is additional content after the form element.</p>
+ </article>
+ </body>
+ </html>
+ """
+ mock_fetch.return_value = html_with_form
+
+ downloader = HTMLDownloader()
+ result_bytes = downloader.download("https://example.com/page")
+
+ assert result_bytes is not None
+ result = result_bytes.decode("utf-8")
+ assert "<form" not in result
+ assert "<input" not in result
+ assert "evil.com" not in result
+
+ @patch(
+ "local_deep_research.research_library.downloaders.html.HTMLDownloader._fetch_html"
+ )
+ def test_svg_with_scripts_removed(self, mock_fetch):
+ """Test that SVG elements (which can contain scripts) are removed."""
+ html_with_svg = """
+ <html>
+ <body>
+ <article>
+ <p>Content before SVG element with additional text.</p>
+ <svg onload="evil()">
+ <script>alert('XSS')</script>
+ </svg>
+ <p>Content after SVG element with additional text.</p>
+ </article>
+ </body>
+ </html>
+ """
+ mock_fetch.return_value = html_with_svg
+
+ downloader = HTMLDownloader()
+ result_bytes = downloader.download("https://example.com/page")
+
+ assert result_bytes is not None
+ result = result_bytes.decode("utf-8")
+ assert "<svg" not in result
+ assert "onload" not in result
+ assert "Content before SVG" in result or "Content after SVG" in result
+
+ @patch(
+ "local_deep_research.research_library.downloaders.html.HTMLDownloader._fetch_html"
+ )
+ def test_style_tags_removed(self, mock_fetch):
+ """Test that style tags are removed."""
+ html_with_style = """
+ <html>
+ <head>
+ <style>
+ body { background: url('javascript:evil()'); }
+ </style>
+ </head>
+ <body>
+ <article>
+ <p>Article content that should be extracted properly.</p>
+ <style>@import url('https://evil.com/tracker.css');</style>
+ <p>More article content for testing the output.</p>
+ </article>
+ </body>
+ </html>
+ """
+ mock_fetch.return_value = html_with_style
+
+ downloader = HTMLDownloader()
+ result_bytes = downloader.download("https://example.com/page")
+
+ assert result_bytes is not None
+ result = result_bytes.decode("utf-8")
+ assert "<style" not in result
+ assert "javascript:" not in result
+ assert "evil.com" not in result
+
+
+class TestURLClassifierSecurity:
+ """Security tests for URL classifier."""
+
+ def test_javascript_url_rejected(self):
+ """Test that javascript: URLs are classified as INVALID (security)."""
+ url = "javascript:alert('XSS')"
+ url_type = URLClassifier.classify(url)
+ # Should be rejected as invalid for security
+ assert url_type == URLType.INVALID
+
+ def test_data_url_rejected(self):
+ """Test that data: URLs are classified as INVALID (security)."""
+ url = "data:text/html,<script>alert('XSS')</script>"
+ url_type = URLClassifier.classify(url)
+ # Should be rejected as invalid for security
+ assert url_type == URLType.INVALID
+
+ def test_file_url_classified(self):
+ """Test that file: URLs are classified as INVALID (security)."""
+ url = "file:///etc/passwd"
+ url_type = URLClassifier.classify(url)
+ # Should be rejected as invalid for security
+ assert url_type == URLType.INVALID
+
+ def test_url_with_credentials(self):
+ """Test URL with embedded credentials."""
+ url = "https://user:[email protected]/article"
+ url_type = URLClassifier.classify(url)
+ # Should still classify normally
+ assert url_type == URLType.HTML
+
+ def test_url_with_special_characters(self):
+ """Test URL with special characters that could cause issues."""
+ urls = [
+ "https://example.com/<script>alert(1)</script>",
+ "https://example.com/page?q=<img src=x onerror=alert(1)>",
+ "https://example.com/path/../../../etc/passwd",
+ "https://example.com/page\x00nullbyte",
+ ]
+ for url in urls:
+ # Should not crash
+ url_type = URLClassifier.classify(url)
+ assert url_type is not None
+
+ def test_very_long_url(self):
+ """Test handling of very long URLs."""
+ long_url = "https://example.com/" + "a" * 10000
+ # Should not crash or hang
+ url_type = URLClassifier.classify(long_url)
+ assert url_type == URLType.HTML
+
+
+class TestContentFetcherSecurity:
+ """Security tests for content fetcher."""
+
+ @patch(
+ "local_deep_research.content_fetcher.fetcher.ContentFetcher._get_downloader"
+ )
+ def test_content_size_limit(self, mock_get_downloader):
+ """Test that very large content is truncated."""
+ # 100MB of content
+ huge_content = "A" * (100 * 1024 * 1024)
+
+ mock_downloader = MagicMock()
+ mock_downloader.download_with_result.return_value = MagicMock(
+ content=huge_content.encode("utf-8"),
+ is_success=True,
+ )
+ mock_downloader.get_metadata.return_value = {}
+ mock_get_downloader.return_value = mock_downloader
+
+ fetcher = ContentFetcher()
+ result = fetcher.fetch("https://example.com/huge", max_length=10000)
+
+ assert result["status"] == "success"
+ assert (
+ len(result["content"]) <= 11000
+ ) # max_length + truncation message
+
+ def test_no_ssrf_via_url_classification(self):
+ """Test that URL classification doesn't make network requests."""
+ # These URLs should be classified without making any network requests
+ dangerous_urls = [
+ "http://169.254.169.254/latest/meta-data/", # AWS metadata
+ "http://localhost:6379/", # Redis
+ "http://127.0.0.1:22/", # SSH
+ "http://[::1]/admin", # IPv6 localhost
+ "http://0.0.0.0/", # All interfaces
+ ]
+
+ for url in dangerous_urls:
+ # Classification should work without network access
+ url_type = URLClassifier.classify(url)
+ assert url_type is not None
+
+
+class TestHTMLExtractionSafety:
+ """Test safe text extraction from HTML."""
+
+ @patch(
+ "local_deep_research.research_library.downloaders.html.HTMLDownloader._fetch_html"
+ )
+ def test_null_bytes_handled(self, mock_fetch):
+ """Test handling of null bytes in content."""
+ html_with_nulls = """
+ <html>
+ <body>
+ <article>
+ <p>Content with\x00null\x00bytes and more text here.</p>
+ <p>Additional paragraph with enough content to pass.</p>
+ </article>
+ </body>
+ </html>
+ """
+ mock_fetch.return_value = html_with_nulls
+
+ downloader = HTMLDownloader()
+ # Should not crash
+ result_bytes = downloader.download("https://example.com/page")
+ # Result should be clean
+ assert result_bytes is None or isinstance(result_bytes, bytes)
+
+ @patch(
+ "local_deep_research.research_library.downloaders.html.HTMLDownloader._fetch_html"
+ )
+ def test_deeply_nested_html(self, mock_fetch):
+ """Test handling of deeply nested HTML (potential DoS)."""
+ # Create deeply nested HTML with content
+ depth = 100 # Reduced from 1000 for reasonable test time
+ nested = (
+ "<div>" * depth
+ + "<p>Deeply nested content that should still be extracted properly.</p>"
+ + "</div>" * depth
+ )
+ html = f"<html><body><article>{nested}</article></body></html>"
+
+ mock_fetch.return_value = html
+
+ downloader = HTMLDownloader()
+ # Should not crash or hang
+ result_bytes = downloader.download("https://example.com/page")
+ # BeautifulSoup should handle this gracefully
+ assert result_bytes is None or isinstance(result_bytes, bytes)
+
+ @patch(
+ "local_deep_research.research_library.downloaders.html.HTMLDownloader._fetch_html"
+ )
+ def test_html_entity_decoding(self, mock_fetch):
+ """Test that HTML entities are properly decoded."""
+ html = """
+ <html>
+ <body>
+ <article>
+ <p>This is an article about HTML entities: &lt;script&gt;alert('XSS')&lt;/script&gt;</p>
+ <p>Special characters: &amp;amp; &quot;quotes&quot; &apos;apostrophes&apos; are handled.</p>
+ </article>
+ </body>
+ </html>
+ """
+ mock_fetch.return_value = html
+
+ downloader = HTMLDownloader()
+ result_bytes = downloader.download("https://example.com/page")
+
+ assert result_bytes is not None
+ result = result_bytes.decode("utf-8")
+ # Entities should be decoded to text, not executed
+ assert "<script>" in result or "&lt;script&gt;" in result
+ assert "alert" in result # The text content, not executed
+
+
+class TestInputValidation:
+ """Test input validation."""
+
+ def test_url_classifier_handles_none(self):
+ """Test URL classifier handles None gracefully."""
+ # This might raise an exception, which is acceptable
+ try:
+ result = URLClassifier.classify(None)
+ # If it doesn't raise, it should return a valid type
+ assert result in URLType
+ except (TypeError, AttributeError):
+ # Expected behavior
+ pass
+
+ def test_content_fetcher_validates_timeout(self):
+ """Test that content fetcher accepts valid timeout values."""
+ # Valid timeouts
+ fetcher1 = ContentFetcher(timeout=30)
+ assert fetcher1.timeout == 30
+
+ fetcher2 = ContentFetcher(timeout=1)
+ assert fetcher2.timeout == 1
+
+ fetcher3 = ContentFetcher(timeout=300)
+ assert fetcher3.timeout == 300
diff --git a/tests/content_fetcher/test_url_classifier.py b/tests/content_fetcher/test_url_classifier.py
new file mode 100644
index 0000000000..cb6fa034aa
--- /dev/null
+++ b/tests/content_fetcher/test_url_classifier.py
@@ -0,0 +1,275 @@
+"""
+Tests for URL classifier.
+"""
+
+from local_deep_research.content_fetcher.url_classifier import (
+ URLClassifier,
+ URLType,
+)
+
+
+class TestURLClassifier:
+ """Test URL classification."""
+
+ def test_classify_arxiv_abs(self):
+ """Test arXiv abstract URL classification."""
+ url = "https://arxiv.org/abs/2301.12345"
+ assert URLClassifier.classify(url) == URLType.ARXIV
+
+ def test_classify_arxiv_pdf(self):
+ """Test arXiv PDF URL classification."""
+ url = "https://arxiv.org/pdf/2301.12345.pdf"
+ assert URLClassifier.classify(url) == URLType.ARXIV
+
+ def test_classify_arxiv_html(self):
+ """Test arXiv HTML URL classification."""
+ url = "https://arxiv.org/html/2301.12345"
+ assert URLClassifier.classify(url) == URLType.ARXIV
+
+ def test_classify_arxiv_old_format(self):
+ """Test old arXiv format URL classification."""
+ url = "https://arxiv.org/abs/cond-mat/0501234"
+ assert URLClassifier.classify(url) == URLType.ARXIV
+
+ def test_classify_ar5iv(self):
+ """Test ar5iv (HTML arXiv) URL classification."""
+ url = "https://ar5iv.org/abs/2301.12345"
+ assert URLClassifier.classify(url) == URLType.ARXIV
+
+ def test_classify_pubmed(self):
+ """Test PubMed URL classification."""
+ url = "https://pubmed.ncbi.nlm.nih.gov/12345678"
+ assert URLClassifier.classify(url) == URLType.PUBMED
+
+ def test_classify_pubmed_old_format(self):
+ """Test old PubMed URL format."""
+ url = "https://www.ncbi.nlm.nih.gov/pubmed/12345678"
+ assert URLClassifier.classify(url) == URLType.PUBMED
+
+ def test_classify_pmc(self):
+ """Test PubMed Central URL classification."""
+ url = "https://www.ncbi.nlm.nih.gov/pmc/articles/PMC1234567"
+ assert URLClassifier.classify(url) == URLType.PMC
+
+ def test_classify_europe_pmc(self):
+ """Test Europe PMC URL classification."""
+ url = "https://europepmc.org/article/PMC/1234567"
+ assert URLClassifier.classify(url) == URLType.PMC
+
+ def test_classify_semantic_scholar(self):
+ """Test Semantic Scholar URL classification."""
+ # Semantic Scholar uses 40-char hex paper IDs - this is a fake test ID, not a secret
+ url = "https://www.semanticscholar.org/paper/Attention-Is-All-You-Need-Vaswani-Shazeer/a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2" # DevSkim: ignore DS173237
+ assert URLClassifier.classify(url) == URLType.SEMANTIC_SCHOLAR
+
+ def test_classify_semantic_scholar_api(self):
+ """Test Semantic Scholar API URL classification."""
+ url = "https://api.semanticscholar.org/v1/paper/abcd1234"
+ assert URLClassifier.classify(url) == URLType.SEMANTIC_SCHOLAR
+
+ def test_classify_biorxiv(self):
+ """Test bioRxiv URL classification."""
+ url = "https://www.biorxiv.org/content/10.1101/2021.01.01.12345v1"
+ assert URLClassifier.classify(url) == URLType.BIORXIV
+
+ def test_classify_medrxiv(self):
+ """Test medRxiv URL classification."""
+ url = "https://www.medrxiv.org/content/10.1101/2021.01.01.12345v1"
+ assert URLClassifier.classify(url) == URLType.MEDRXIV
+
+ def test_classify_doi(self):
+ """Test DOI URL classification."""
+ url = "https://doi.org/10.1234/example.2021.01"
+ assert URLClassifier.classify(url) == URLType.DOI
+
+ def test_classify_dx_doi(self):
+ """Test dx.doi.org URL classification."""
+ url = "https://dx.doi.org/10.1234/example"
+ assert URLClassifier.classify(url) == URLType.DOI
+
+ def test_classify_direct_pdf(self):
+ """Test direct PDF URL classification."""
+ url = "https://example.com/papers/document.pdf"
+ assert URLClassifier.classify(url) == URLType.PDF
+
+ def test_classify_html_generic(self):
+ """Test generic HTML URL classification."""
+ url = "https://www.example.com/article/123"
+ assert URLClassifier.classify(url) == URLType.HTML
+
+ def test_classify_wikipedia(self):
+ """Test Wikipedia URL (should be HTML)."""
+ url = "https://en.wikipedia.org/wiki/Machine_learning"
+ assert URLClassifier.classify(url) == URLType.HTML
+
+ def test_classify_github(self):
+ """Test GitHub URL (should be HTML)."""
+ url = "https://github.com/anthropics/claude-code"
+ assert URLClassifier.classify(url) == URLType.HTML
+
+ def test_classify_news_site(self):
+ """Test news site URL (should be HTML)."""
+ url = "https://news.ycombinator.com/item?id=12345"
+ assert URLClassifier.classify(url) == URLType.HTML
+
+
+class TestURLClassifierExtractID:
+ """Test ID extraction from URLs."""
+
+ def test_extract_arxiv_id_new_format(self):
+ """Test arXiv ID extraction (new format)."""
+ url = "https://arxiv.org/abs/2301.12345"
+ assert URLClassifier.extract_id(url) == "2301.12345"
+
+ def test_extract_arxiv_id_with_version(self):
+ """Test arXiv ID extraction with version."""
+ url = "https://arxiv.org/abs/2301.12345v2"
+ assert URLClassifier.extract_id(url) == "2301.12345v2"
+
+ def test_extract_arxiv_id_old_format(self):
+ """Test arXiv ID extraction (old format)."""
+ url = "https://arxiv.org/abs/cond-mat/0501234"
+ assert URLClassifier.extract_id(url) == "cond-mat/0501234"
+
+ def test_extract_pubmed_id(self):
+ """Test PubMed ID extraction."""
+ url = "https://pubmed.ncbi.nlm.nih.gov/12345678/"
+ assert URLClassifier.extract_id(url) == "12345678"
+
+ def test_extract_pmc_id(self):
+ """Test PMC ID extraction."""
+ url = "https://www.ncbi.nlm.nih.gov/pmc/articles/PMC1234567/"
+ assert URLClassifier.extract_id(url) == "PMC1234567"
+
+ def test_extract_semantic_scholar_id(self):
+ """Test Semantic Scholar ID extraction."""
+ # Semantic Scholar uses 40-char hex paper IDs - this is a fake test ID, not a secret
+ url = "https://www.semanticscholar.org/paper/Title/a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2" # DevSkim: ignore DS173237
+ extracted = URLClassifier.extract_id(url)
+ assert extracted == "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2"
+
+ def test_extract_doi(self):
+ """Test DOI extraction."""
+ url = "https://doi.org/10.1234/example.2021"
+ assert URLClassifier.extract_id(url) == "10.1234/example.2021"
+
+ def test_extract_id_unknown_url(self):
+ """Test ID extraction from unknown URL type."""
+ url = "https://example.com/article/123"
+ assert URLClassifier.extract_id(url) is None
+
+
+class TestURLClassifierSourceName:
+ """Test human-readable source names."""
+
+ def test_source_name_arxiv(self):
+ """Test arXiv source name."""
+ assert URLClassifier.get_source_name(URLType.ARXIV) == "arXiv"
+
+ def test_source_name_pubmed(self):
+ """Test PubMed source name."""
+ assert URLClassifier.get_source_name(URLType.PUBMED) == "PubMed"
+
+ def test_source_name_pmc(self):
+ """Test PMC source name."""
+ assert URLClassifier.get_source_name(URLType.PMC) == "PubMed Central"
+
+ def test_source_name_semantic_scholar(self):
+ """Test Semantic Scholar source name."""
+ assert (
+ URLClassifier.get_source_name(URLType.SEMANTIC_SCHOLAR)
+ == "Semantic Scholar"
+ )
+
+ def test_source_name_html(self):
+ """Test HTML source name."""
+ assert URLClassifier.get_source_name(URLType.HTML) == "Web Page"
+
+ def test_source_name_pdf(self):
+ """Test PDF source name."""
+ assert URLClassifier.get_source_name(URLType.PDF) == "PDF"
+
+
+class TestURLClassifierEdgeCases:
+ """Test edge cases and malformed URLs."""
+
+ def test_classify_empty_url(self):
+ """Test empty URL defaults to HTML."""
+ assert URLClassifier.classify("") == URLType.HTML
+
+ def test_classify_invalid_url(self):
+ """Test invalid URL defaults to HTML."""
+ assert URLClassifier.classify("not-a-valid-url") == URLType.HTML
+
+ def test_classify_case_insensitive(self):
+ """Test URL classification is case-insensitive."""
+ url = "https://ARXIV.ORG/abs/2301.12345"
+ assert URLClassifier.classify(url) == URLType.ARXIV
+
+ def test_classify_with_query_params(self):
+ """Test URL with query parameters."""
+ url = "https://arxiv.org/abs/2301.12345?ref=homepage"
+ assert URLClassifier.classify(url) == URLType.ARXIV
+
+ def test_classify_with_fragment(self):
+ """Test URL with fragment."""
+ url = "https://pubmed.ncbi.nlm.nih.gov/12345678#abstract"
+ assert URLClassifier.classify(url) == URLType.PUBMED
+
+
+class TestURLClassifierSecurity:
+ """Test security-related URL classification."""
+
+ def test_javascript_url_rejected(self):
+ """Test that javascript: URLs are classified as INVALID."""
+ url = "javascript:alert('XSS')"
+ assert URLClassifier.classify(url) == URLType.INVALID
+
+ def test_data_url_rejected(self):
+ """Test that data: URLs are classified as INVALID."""
+ url = "data:text/html,<script>alert('XSS')</script>"
+ assert URLClassifier.classify(url) == URLType.INVALID
+
+ def test_file_url_rejected(self):
+ """Test that file: URLs are classified as INVALID."""
+ url = "file:///etc/passwd"
+ assert URLClassifier.classify(url) == URLType.INVALID
+
+ def test_vbscript_url_rejected(self):
+ """Test that vbscript: URLs are classified as INVALID."""
+ url = "vbscript:msgbox('XSS')"
+ assert URLClassifier.classify(url) == URLType.INVALID
+
+ def test_about_url_rejected(self):
+ """Test that about: URLs are classified as INVALID."""
+ url = "about:blank"
+ assert URLClassifier.classify(url) == URLType.INVALID
+
+ def test_ftp_url_rejected(self):
+ """Test that ftp: URLs are classified as INVALID."""
+ url = "ftp://ftp.example.com/file.txt"
+ assert URLClassifier.classify(url) == URLType.INVALID
+
+ def test_http_url_accepted(self):
+ """Test that http: URLs are accepted."""
+ url = "http://example.com/page"
+ assert URLClassifier.classify(url) == URLType.HTML
+
+ def test_https_url_accepted(self):
+ """Test that https: URLs are accepted."""
+ url = "https://example.com/page"
+ assert URLClassifier.classify(url) == URLType.HTML
+
+ def test_invalid_source_name(self):
+ """Test INVALID URL source name."""
+ assert URLClassifier.get_source_name(URLType.INVALID) == "Invalid URL"
+
+ def test_javascript_url_case_insensitive(self):
+ """Test that JavaScript: URLs (mixed case) are rejected."""
+ url = "JavaScript:alert('XSS')"
+ assert URLClassifier.classify(url) == URLType.INVALID
+
+ def test_whitespace_trimmed(self):
+ """Test that URLs with whitespace are trimmed."""
+ url = " https://example.com/page "
+ assert URLClassifier.classify(url) == URLType.HTML
diff --git a/tests/mcp/__init__.py b/tests/mcp/__init__.py
new file mode 100644
index 0000000000..4ca9fae75c
--- /dev/null
+++ b/tests/mcp/__init__.py
@@ -0,0 +1 @@
+"""Tests for the MCP server module."""
diff --git a/tests/mcp/conftest.py b/tests/mcp/conftest.py
new file mode 100644
index 0000000000..3a5887b91b
--- /dev/null
+++ b/tests/mcp/conftest.py
@@ -0,0 +1,212 @@
+"""
+Fixtures for MCP server tests.
+"""
+
+import pytest
+from unittest.mock import patch
+
+
+def mock_quick_summary():
+ """Mock the quick_summary function."""
+ mock_result = {
+ "summary": "This is a test summary about quantum computing.",
+ "findings": [
+ {
+ "phase": "Iteration 1",
+ "content": "Quantum computing uses qubits instead of classical bits.",
+ }
+ ],
+ "iterations": 1,
+ "questions": {0: ["What is quantum computing?"]},
+ "formatted_findings": "## Findings\n\nQuantum computing uses qubits.",
+ "sources": [
+ {
+ "title": "Wikipedia - Quantum Computing",
+ "link": "https://en.wikipedia.org/wiki/Quantum_computing",
+ }
+ ],
+ }
+ with patch(
+ "local_deep_research.mcp.server.ldr_quick_summary",
+ return_value=mock_result,
+ ) as mock:
+ yield mock
+
+
+def mock_detailed_research():
+ """Mock the detailed_research function."""
+ mock_result = {
+ "query": "quantum computing applications",
+ "research_id": "test-research-123",
+ "summary": "Detailed analysis of quantum computing applications.",
+ "findings": [
+ {
+ "phase": "Iteration 1",
+ "content": "Quantum computing has applications in cryptography.",
+ },
+ {
+ "phase": "Iteration 2",
+ "content": "Drug discovery is another major application.",
+ },
+ ],
+ "iterations": 2,
+ "questions": {
+ 0: ["What are quantum computing applications?"],
+ 1: ["How is it used in cryptography?"],
+ },
+ "formatted_findings": "## Detailed Findings\n\nCryptography and drug discovery.",
+ "sources": [
+ {
+ "title": "Nature - Quantum Applications",
+ "link": "https://nature.com/quantum",
+ },
+ ],
+ "metadata": {
+ "timestamp": "2024-01-15T10:30:00Z",
+ "search_tool": "wikipedia",
+ "strategy": "source-based",
+ },
+ }
+ with patch(
+ "local_deep_research.mcp.server.ldr_detailed_research",
+ return_value=mock_result,
+ ) as mock:
+ yield mock
+
+
+def mock_generate_report():
+ """Mock the generate_report function."""
+ mock_result = {
+ "content": "# Research Report\n\n## Introduction\n\nThis report covers...",
+ "metadata": {
+ "generated_at": "2024-01-15T10:30:00Z",
+ "query": "quantum computing",
+ },
+ }
+ with patch(
+ "local_deep_research.mcp.server.ldr_generate_report",
+ return_value=mock_result,
+ ) as mock:
+ yield mock
+
+
+def mock_analyze_documents():
+ """Mock the analyze_documents function."""
+ mock_result = {
+ "summary": "Analysis of documents in the test collection.",
+ "documents": [
+ {
+ "title": "Test Document 1",
+ "content": "Content of test document 1.",
+ "link": "/path/to/doc1.pdf",
+ },
+ ],
+ "collection": "test_collection",
+ "document_count": 1,
+ }
+ with patch(
+ "local_deep_research.mcp.server.ldr_analyze_documents",
+ return_value=mock_result,
+ ) as mock:
+ yield mock
+
+
+def mock_settings_snapshot():
+ """Mock settings snapshot for configuration tests."""
+ mock_settings = {
+ "llm.provider": {"value": "openai"},
+ "llm.model": {"value": "gpt-4"},
+ "llm.temperature": {"value": 0.7},
+ "search.tool": {"value": "auto"},
+ "search.search_strategy": {"value": "source-based"},
+ "search.iterations": {"value": 2},
+ "search.questions_per_iteration": {"value": 3},
+ "search.max_results": {"value": 10},
+ }
+ with patch(
+ "local_deep_research.mcp.server.create_settings_snapshot",
+ return_value=mock_settings,
+ ) as mock:
+ yield mock
+
+
+# =============================================================================
+# Additional fixtures for edge case and integration tests
+# =============================================================================
+
+
+def sample_long_query():
+ """Generate a very long query string (10000+ chars)."""
+ return (
+ "What is quantum computing and how does it work? " * 250
+ ) # ~12500 chars
+
+
+def sample_special_chars_query():
+ """Query with unicode, emojis, special characters."""
+ return "What is 量子计算? 🔬 Test with émojis & spëcial <chars> \"quotes\" 'apostrophes'"
+
+
+def mock_api_empty_response():
+ """Mock API response with missing fields."""
+ return {}
+
+
+def mock_api_minimal_response():
+ """Mock API response with only required fields."""
+ return {
+ "summary": "Minimal response",
+ }
+
+
+def mock_api_with_nulls():
+ """Mock API response with None values."""
+ return {
+ "summary": None,
+ "findings": None,
+ "sources": None,
+ "iterations": None,
+ }
+
+
+def mock_comprehensive_research_result():
+ """Comprehensive mock research result for integration tests."""
+ return {
+ "query": "test query",
+ "research_id": "integration-test-123",
+ "summary": "This is a comprehensive test summary with multiple findings.",
+ "findings": [
+ {"phase": "Iteration 1", "content": "First finding content"},
+ {"phase": "Iteration 2", "content": "Second finding content"},
+ {"phase": "Iteration 3", "content": "Third finding content"},
+ ],
+ "iterations": 3,
+ "questions": {
+ 0: ["Question 1?", "Question 2?"],
+ 1: ["Follow-up 1?"],
+ 2: ["Final question?"],
+ },
+ "formatted_findings": "## Research Findings\n\n- Finding 1\n- Finding 2\n- Finding 3",
+ "sources": [
+ {"title": "Source 1", "link": "https://example.com/1"},
+ {"title": "Source 2", "link": "https://example.com/2"},
+ {"title": "Source 3", "link": "https://example.com/3"},
+ ],
+ "metadata": {
+ "timestamp": "2024-01-15T12:00:00Z",
+ "search_tool": "searxng",
+ "strategy": "source-based",
+ "duration_seconds": 120,
+ },
+ }
diff --git a/tests/mcp/echo_server.py b/tests/mcp/echo_server.py
new file mode 100644
index 0000000000..64538bb9f4
--- /dev/null
+++ b/tests/mcp/echo_server.py
@@ -0,0 +1,148 @@
+"""
+Simple echo MCP server for integration testing.
+
+This is a minimal MCP server that provides basic tools for testing
+client-server communication without requiring the full LDR stack.
+"""
+
+import sys
+from typing import Any, Dict
+
+from loguru import logger
+
+# Configure loguru to output to stderr to avoid stdout pollution
+# (MCP uses stdout for JSON-RPC communication)
+logger.remove() # Remove default handler
+logger.add(
+ sys.stderr,
+ level="INFO",
+ format="{time:YYYY-MM-DD HH:mm:ss} | {level: <8} | {message}",
+)
+
+
+try:
+ from mcp.server.fastmcp import FastMCP
+
+ MCP_AVAILABLE = True
+except ImportError:
+ MCP_AVAILABLE = False
+ logger.warning("MCP package not available")
+
+
+if MCP_AVAILABLE:
+ # Create FastMCP server instance
+ mcp = FastMCP(
+ "echo-test-server",
+ instructions="Simple echo server for testing MCP client-server communication",
+ )
+
+ @mcp.tool()
+ def echo(message: str) -> Dict[str, Any]:
+ """
+ Echo back the provided message.
+
+ Args:
+ message: The message to echo back.
+
+ Returns:
+ Dictionary with the echoed message.
+ """
+ logger.info(f"Echo tool called with: {message}")
+ return {
+ "status": "success",
+ "message": message,
+ "echoed": True,
+ }
+
+ @mcp.tool()
+ def add_numbers(a: int, b: int) -> Dict[str, Any]:
+ """
+ Add two numbers together.
+
+ Args:
+ a: First number.
+ b: Second number.
+
+ Returns:
+ Dictionary with the sum.
+ """
+ logger.info(f"Add tool called with: {a} + {b}")
+ return {
+ "status": "success",
+ "result": a + b,
+ }
+
+ @mcp.tool()
+ def get_info() -> Dict[str, Any]:
+ """
+ Get server information.
+
+ Returns:
+ Dictionary with server details.
+ """
+ return {
+ "status": "success",
+ "server_name": "echo-test-server",
+ "tools": [
+ "echo",
+ "add_numbers",
+ "get_info",
+ "slow_operation",
+ "fail_on_demand",
+ ],
+ }
+
+ @mcp.tool()
+ def slow_operation(delay_ms: int = 100) -> Dict[str, Any]:
+ """
+ Simulate a slow operation for timeout testing.
+
+ Args:
+ delay_ms: Delay in milliseconds (capped at 5000ms for safety).
+
+ Returns:
+ Dictionary confirming completion.
+ """
+ import time
+
+ # Cap delay to 5 seconds for safety
+ actual_delay = min(delay_ms, 5000) / 1000.0
+ logger.info(f"Slow operation sleeping for {actual_delay}s")
+ time.sleep(actual_delay)
+ return {
+ "status": "success",
+ "slept_ms": int(actual_delay * 1000),
+ }
+
+ @mcp.tool()
+ def fail_on_demand(
+ should_fail: bool = False, error_message: str = "Intentional failure"
+ ) -> Dict[str, Any]:
+ """
+ A tool that can be made to fail for error handling tests.
+
+ Args:
+ should_fail: Whether to raise an exception.
+ error_message: The error message to use if failing.
+
+ Returns:
+ Success dict or raises exception.
+ """
+ if should_fail:
+ raise ValueError(error_message)
+ return {
+ "status": "success",
+ "failed": False,
+ }
+
+ def run_server():
+ """Run the echo MCP server using STDIO transport."""
+ logger.info("Starting echo test MCP server...")
+ mcp.run(transport="stdio")
+
+
+if __name__ == "__main__":
+ if not MCP_AVAILABLE:
+ print("MCP package not available", file=sys.stderr)
+ sys.exit(1)
+ run_server()
diff --git a/tests/mcp/test_additional_coverage.py b/tests/mcp/test_additional_coverage.py
new file mode 100644
index 0000000000..cce96cc03f
--- /dev/null
+++ b/tests/mcp/test_additional_coverage.py
@@ -0,0 +1,520 @@
+"""
+Additional tests for MCP server to increase coverage.
+
+Tests for:
+- Falsy value handling in _build_settings_overrides
+- Discovery tools error paths
+- Entry point functions
+- Temperature parameter in research tools
+- Import smoke tests
+- formatted_findings field
+"""
+
+from unittest.mock import patch
+
+import pytest
+
+# Skip all tests if MCP is not available
+try:
+ import mcp # noqa: F401
+
+ MCP_AVAILABLE = True
+except ImportError:
+ MCP_AVAILABLE = False
+
+pytestmark = pytest.mark.skipif(
+ not MCP_AVAILABLE, reason="MCP package not installed"
+)
+
+
+class TestBuildSettingsOverridesFalsyValues:
+ """Tests for falsy value handling in _build_settings_overrides.
+
+ Note: The implementation uses 'is not None' checks, so falsy values
+ like 0, 0.0, and "" ARE included in the result (they are valid values).
+ """
+
+ def test_iterations_zero_is_added(self):
+ """Test that iterations=0 IS added (is not None check)."""
+ from local_deep_research.mcp.server import _build_settings_overrides
+
+ # Implementation uses 'is not None', so 0 is added
+ result = _build_settings_overrides(iterations=0)
+ assert result.get("search.iterations") == 0
+
+ def test_questions_per_iteration_zero_is_added(self):
+ """Test that questions_per_iteration=0 IS added."""
+ from local_deep_research.mcp.server import _build_settings_overrides
+
+ result = _build_settings_overrides(questions_per_iteration=0)
+ assert result.get("search.questions_per_iteration") == 0
+
+ def test_temperature_zero_is_added(self):
+ """Test that temperature=0.0 IS added (is not None check)."""
+ from local_deep_research.mcp.server import _build_settings_overrides
+
+ result = _build_settings_overrides(temperature=0.0)
+ assert result.get("llm.temperature") == 0.0
+
+ def test_empty_string_search_engine_is_stripped(self):
+ """Test that empty string search_engine is stripped and not added."""
+ from local_deep_research.mcp.server import _build_settings_overrides
+
+ result = _build_settings_overrides(search_engine="")
+ assert result == {}
+
+ def test_empty_string_strategy_is_stripped(self):
+ """Test that empty string strategy is stripped and not added."""
+ from local_deep_research.mcp.server import _build_settings_overrides
+
+ result = _build_settings_overrides(strategy="")
+ assert result == {}
+
+ def test_positive_temperature_added(self):
+ """Test that positive temperature is correctly added."""
+ from local_deep_research.mcp.server import _build_settings_overrides
+
+ result = _build_settings_overrides(temperature=0.5)
+ assert result["llm.temperature"] == 0.5
+
+ def test_temperature_one_added(self):
+ """Test that temperature=1.0 is correctly added."""
+ from local_deep_research.mcp.server import _build_settings_overrides
+
+ result = _build_settings_overrides(temperature=1.0)
+ assert result["llm.temperature"] == 1.0
+
+
+class TestDiscoveryToolsErrorPaths:
+ """Tests for error handling in discovery tools."""
+
+ def test_list_search_engines_handles_import_error(self):
+ """Test list_search_engines handles import errors gracefully."""
+ from local_deep_research.mcp.server import list_search_engines
+
+ # The function imports create_settings_snapshot inside, so we need to patch it there
+ with patch(
+ "local_deep_research.api.settings_utils.create_settings_snapshot",
+ side_effect=ImportError("Module not found"),
+ ):
+ result = list_search_engines()
+
+ assert result["status"] == "error"
+ assert result["error_type"] == "model_not_found"
+
+ def test_list_search_engines_handles_config_error(self):
+ """Test list_search_engines handles config errors gracefully."""
+ from local_deep_research.mcp.server import list_search_engines
+
+ with patch(
+ "local_deep_research.web_search_engines.search_engines_config.search_config",
+ side_effect=Exception("Config load failed"),
+ ):
+ result = list_search_engines()
+
+ assert result["status"] == "error"
+ assert result["error_type"] == "unknown"
+
+ def test_get_configuration_handles_settings_error(self):
+ """Test get_configuration handles settings errors gracefully."""
+ from local_deep_research.mcp.server import get_configuration
+
+ # Patch at the location where it's imported inside the function
+ with patch(
+ "local_deep_research.api.settings_utils.create_settings_snapshot",
+ side_effect=Exception("Settings unavailable"),
+ ):
+ result = get_configuration()
+
+ assert result["status"] == "error"
+ assert result["error_type"] == "service_unavailable"
+
+ def test_get_configuration_handles_extract_error(self):
+ """Test get_configuration handles extraction errors gracefully."""
+ from local_deep_research.mcp.server import get_configuration
+
+ # Patch at the location where it's imported inside the function
+ with patch(
+ "local_deep_research.api.settings_utils.extract_setting_value",
+ side_effect=Exception("Extract failed"),
+ ):
+ result = get_configuration()
+
+ assert result["status"] == "error"
+ assert result["error_type"] == "unknown"
+
+
+class TestEntryPoints:
+ """Tests for entry point functions."""
+
+ def test_run_server_function_is_callable(self):
+ """Test that run_server is a callable function."""
+ from local_deep_research.mcp.server import run_server
+
+ assert callable(run_server)
+
+ def test_run_server_exported_from_package(self):
+ """Test that run_server is exported from the mcp package."""
+ from local_deep_research.mcp import run_server
+
+ assert callable(run_server)
+
+ def test_mcp_instance_exported_from_package(self):
+ """Test that mcp instance is exported from the mcp package."""
+ from local_deep_research.mcp import mcp
+
+ assert mcp is not None
+ assert mcp.name == "local-deep-research"
+
+ def test_main_module_imports_run_server(self):
+ """Test that __main__.py can import run_server."""
+ # This tests that the import in __main__.py works
+ from local_deep_research.mcp.__main__ import run_server
+
+ assert callable(run_server)
+
+
+class TestTemperatureParameter:
+ """Tests for temperature parameter in research tools."""
+
+ def test_quick_research_with_temperature(self):
+ """Test quick_research passes temperature override."""
+ from local_deep_research.mcp.server import quick_research
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_quick_summary",
+ return_value={
+ "summary": "Test",
+ "findings": [],
+ "sources": [],
+ "iterations": 1,
+ },
+ ):
+ with patch(
+ "local_deep_research.mcp.server.create_settings_snapshot"
+ ) as mock_settings:
+ mock_settings.return_value = {}
+ # Note: quick_research doesn't have temperature param currently
+ # This test documents the current behavior
+ result = quick_research(query="test", iterations=2)
+
+ assert result["status"] == "success"
+
+ def test_detailed_research_with_temperature(self):
+ """Test detailed_research passes temperature override."""
+ from local_deep_research.mcp.server import detailed_research
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_detailed_research",
+ return_value={
+ "query": "test",
+ "research_id": "123",
+ "summary": "Test",
+ "findings": [],
+ "sources": [],
+ "iterations": 1,
+ },
+ ):
+ with patch(
+ "local_deep_research.mcp.server.create_settings_snapshot"
+ ) as mock_settings:
+ mock_settings.return_value = {}
+ result = detailed_research(query="test", iterations=2)
+
+ assert result["status"] == "success"
+
+
+class TestFormattedFindings:
+ """Tests for formatted_findings field in research results."""
+
+ def test_quick_research_returns_formatted_findings(self):
+ """Test quick_research returns formatted_findings field."""
+ from local_deep_research.mcp.server import quick_research
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_quick_summary",
+ return_value={
+ "summary": "Test summary",
+ "findings": [],
+ "sources": [],
+ "iterations": 1,
+ "formatted_findings": "## Formatted Content\n\nTest formatted findings",
+ },
+ ):
+ result = quick_research(query="test")
+
+ assert result["status"] == "success"
+ assert "formatted_findings" in result
+ assert (
+ result["formatted_findings"]
+ == "## Formatted Content\n\nTest formatted findings"
+ )
+
+ def test_quick_research_formatted_findings_defaults_empty(self):
+ """Test formatted_findings defaults to empty string when missing."""
+ from local_deep_research.mcp.server import quick_research
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_quick_summary",
+ return_value={
+ "summary": "Test",
+ "findings": [],
+ "sources": [],
+ "iterations": 1,
+ # No formatted_findings
+ },
+ ):
+ result = quick_research(query="test")
+
+ assert result["status"] == "success"
+ assert result["formatted_findings"] == ""
+
+ def test_detailed_research_returns_formatted_findings(self):
+ """Test detailed_research returns formatted_findings field."""
+ from local_deep_research.mcp.server import detailed_research
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_detailed_research",
+ return_value={
+ "query": "test",
+ "research_id": "123",
+ "summary": "Test",
+ "findings": [],
+ "sources": [],
+ "iterations": 1,
+ "formatted_findings": "## Detailed Formatted\n\nContent here",
+ },
+ ):
+ result = detailed_research(query="test")
+
+ assert result["status"] == "success"
+ assert "formatted_findings" in result
+ assert "Detailed Formatted" in result["formatted_findings"]
+
+
+class TestImportSmokeTests:
+ """Smoke tests to verify module imports work correctly."""
+
+ def test_server_module_imports(self):
+ """Test that server module imports without errors."""
+ from local_deep_research.mcp import server
+
+ assert hasattr(server, "mcp")
+ assert hasattr(server, "run_server")
+ assert hasattr(server, "quick_research")
+ assert hasattr(server, "detailed_research")
+ assert hasattr(server, "generate_report")
+ assert hasattr(server, "analyze_documents")
+ assert hasattr(server, "list_search_engines")
+ assert hasattr(server, "list_strategies")
+ assert hasattr(server, "get_configuration")
+
+ def test_all_tools_have_type_hints(self):
+ """Test that all tool functions have return type hints."""
+ from local_deep_research.mcp.server import (
+ quick_research,
+ detailed_research,
+ generate_report,
+ analyze_documents,
+ list_search_engines,
+ list_strategies,
+ get_configuration,
+ )
+ import typing
+
+ for func in [
+ quick_research,
+ detailed_research,
+ generate_report,
+ analyze_documents,
+ list_search_engines,
+ list_strategies,
+ get_configuration,
+ ]:
+ hints = typing.get_type_hints(func)
+ assert "return" in hints, (
+ f"{func.__name__} missing return type hint"
+ )
+
+ def test_helper_functions_exist(self):
+ """Test that helper functions exist and are importable."""
+ from local_deep_research.mcp.server import (
+ _classify_error,
+ _build_settings_overrides,
+ )
+ from local_deep_research.search_system_factory import (
+ get_available_strategies,
+ )
+
+ assert callable(_classify_error)
+ assert callable(_build_settings_overrides)
+ strategies = get_available_strategies()
+ assert isinstance(strategies, list)
+
+
+class TestAvailableStrategiesContent:
+ """Tests for get_available_strategies content validation."""
+
+ def test_all_strategies_have_unique_names(self):
+ """Test that all strategy names are unique."""
+ from local_deep_research.search_system_factory import (
+ get_available_strategies,
+ )
+
+ strategies = get_available_strategies()
+ names = [s["name"] for s in strategies]
+ assert len(names) == len(set(names)), "Duplicate strategy names found"
+
+ def test_all_strategies_have_non_empty_descriptions(self):
+ """Test that all strategies have meaningful descriptions."""
+ from local_deep_research.search_system_factory import (
+ get_available_strategies,
+ )
+
+ strategies = get_available_strategies()
+ for strategy in strategies:
+ assert len(strategy["description"]) > 10, (
+ f"Strategy {strategy['name']} has too short description"
+ )
+
+ def test_key_strategies_included(self):
+ """Test that key strategies are included."""
+ from local_deep_research.search_system_factory import (
+ get_available_strategies,
+ )
+
+ strategies = get_available_strategies()
+ names = [s["name"] for s in strategies]
+
+ # These are the actual strategies defined in the system
+ expected_strategies = [
+ "source-based",
+ "rapid",
+ "iterative",
+ "evidence",
+ "focused-iteration",
+ "mcp",
+ ]
+
+ for expected in expected_strategies:
+ assert expected in names, (
+ f"Expected strategy '{expected}' not found"
+ )
+
+
+class TestErrorClassificationAdditional:
+ """Additional error classification tests."""
+
+ def test_classify_error_case_insensitive(self):
+ """Test that error classification is case insensitive."""
+ from local_deep_research.mcp.server import _classify_error
+
+ assert _classify_error("SERVICE UNAVAILABLE") == "service_unavailable"
+ assert _classify_error("TIMEOUT error") == "timeout"
+ assert _classify_error("API KEY invalid") == "auth_error"
+
+ def test_classify_error_partial_match(self):
+ """Test that error classification works with partial matches."""
+ from local_deep_research.mcp.server import _classify_error
+
+ assert (
+ _classify_error("The authentication system rejected the request")
+ == "auth_error"
+ )
+ # The word "timeout" must be present for timeout classification
+ assert _classify_error("Request timeout after 30 seconds") == "timeout"
+ assert (
+ _classify_error("Connection refused by server")
+ == "connection_error"
+ )
+
+ def test_classify_error_empty_string(self):
+ """Test classification of empty error string."""
+ from local_deep_research.mcp.server import _classify_error
+
+ assert _classify_error("") == "unknown"
+
+ def test_classify_error_none_like(self):
+ """Test classification handles various error strings."""
+ from local_deep_research.mcp.server import _classify_error
+
+ # All unknown errors
+ assert _classify_error("Something went wrong") == "unknown"
+ assert _classify_error("Error occurred") == "unknown"
+ assert _classify_error("null pointer exception") == "unknown"
+
+
+class TestListSearchEnginesOutput:
+ """Tests for list_search_engines output structure."""
+
+ def test_engines_sorted_by_name(self):
+ """Test that engines are sorted alphabetically by name."""
+ from local_deep_research.mcp.server import list_search_engines
+
+ mock_engines = {
+ "z_engine": {"description": "Z engine"},
+ "a_engine": {"description": "A engine"},
+ "m_engine": {"description": "M engine"},
+ }
+
+ with patch(
+ "local_deep_research.web_search_engines.search_engines_config.search_config",
+ return_value=mock_engines,
+ ):
+ result = list_search_engines()
+
+ assert result["status"] == "success"
+ names = [e["name"] for e in result["engines"]]
+ assert names == sorted(names), "Engines should be sorted alphabetically"
+
+ def test_engine_info_structure(self):
+ """Test that each engine has the expected info structure."""
+ from local_deep_research.mcp.server import list_search_engines
+
+ mock_engines = {
+ "test_engine": {
+ "description": "Test engine",
+ "strengths": ["Fast", "Free"],
+ "weaknesses": ["Limited"],
+ "requires_api_key": True,
+ "is_local": False,
+ }
+ }
+
+ with patch(
+ "local_deep_research.web_search_engines.search_engines_config.search_config",
+ return_value=mock_engines,
+ ):
+ result = list_search_engines()
+
+ assert result["status"] == "success"
+ engine = result["engines"][0]
+ assert engine["name"] == "test_engine"
+ assert engine["description"] == "Test engine"
+ assert engine["strengths"] == ["Fast", "Free"]
+ assert engine["weaknesses"] == ["Limited"]
+ assert engine["requires_api_key"] is True
+ assert engine["is_local"] is False
+
+ def test_engine_info_defaults(self):
+ """Test that engine info defaults work for missing fields."""
+ from local_deep_research.mcp.server import list_search_engines
+
+ mock_engines = {
+ "minimal_engine": {} # No fields
+ }
+
+ with patch(
+ "local_deep_research.web_search_engines.search_engines_config.search_config",
+ return_value=mock_engines,
+ ):
+ result = list_search_engines()
+
+ assert result["status"] == "success"
+ engine = result["engines"][0]
+ assert engine["name"] == "minimal_engine"
+ assert engine["description"] == ""
+ assert engine["strengths"] == []
+ assert engine["weaknesses"] == []
+ assert engine["requires_api_key"] is False
+ assert engine["is_local"] is False
diff --git a/tests/mcp/test_concurrent_mcp_calls.py b/tests/mcp/test_concurrent_mcp_calls.py
new file mode 100644
index 0000000000..ecd21d51d8
--- /dev/null
+++ b/tests/mcp/test_concurrent_mcp_calls.py
@@ -0,0 +1,500 @@
+"""
+Tests for concurrent MCP tool calls and MCPClientManager.
+
+These tests verify that multiple concurrent tool calls work correctly
+without race conditions or deadlocks.
+
+Tests are organized into:
+1. Mock-based tests for fast, reliable testing of concurrency logic
+2. Subprocess tests (marked with `integration`) for real-world verification
+
+To run the subprocess tests locally:
+ pytest tests/mcp/test_concurrent_mcp_calls.py -m integration
+"""
+
+import asyncio
+import sys
+from pathlib import Path
+from unittest.mock import MagicMock, patch
+
+import pytest
+
+# Skip all tests if MCP is not available
+try:
+ import mcp # noqa: F401
+
+ MCP_AVAILABLE = True
+except ImportError:
+ MCP_AVAILABLE = False
+
+pytestmark = pytest.mark.skipif(
+ not MCP_AVAILABLE, reason="MCP package not installed"
+)
+
+# Path to the echo server for testing
+ECHO_SERVER_PATH = Path(__file__).parent / "echo_server.py"
+
+
+class TestConcurrentToolCallsWithMocks:
+ """Tests for concurrent tool calls using mocks for reliable testing."""
+
+ @pytest.fixture
+ def mock_tool_result(self):
+ """Create a mock tool result factory."""
+
+ def _make_result(text_content, is_error=False):
+ mock_item = MagicMock()
+ mock_item.text = text_content
+ mock_result = MagicMock()
+ mock_result.isError = is_error
+ mock_result.content = [mock_item]
+ return mock_result
+
+ return _make_result
+
+ @pytest.mark.asyncio
+ async def test_parallel_tool_calls_with_mock(self, mock_tool_result):
+ """Test multiple tool calls running in parallel."""
+ from local_deep_research.mcp.client import MCPClient
+
+ with patch("local_deep_research.mcp.client.MCP_AVAILABLE", True):
+ config = {"name": "mock-server", "command": "python"}
+ client = MCPClient(config)
+
+ client._connected = True
+ client._session = MagicMock()
+
+ call_order = []
+
+ async def mock_call(name, args):
+ call_order.append(f"start_{args.get('id', 0)}")
+ await asyncio.sleep(0.01) # Simulate async work
+ call_order.append(f"end_{args.get('id', 0)}")
+ return mock_tool_result(f"Result for {args.get('id', 0)}")
+
+ client._session.call_tool = mock_call
+
+ # Launch concurrent calls
+ tasks = [client.call_tool("echo", {"id": i}) for i in range(5)]
+
+ results = await asyncio.gather(*tasks)
+
+ assert len(results) == 5
+ for result in results:
+ assert result["status"] == "success"
+
+ @pytest.mark.asyncio
+ async def test_concurrent_calls_no_data_corruption_with_mock(
+ self, mock_tool_result
+ ):
+ """Test that concurrent calls don't corrupt each other's data."""
+ from local_deep_research.mcp.client import MCPClient
+
+ with patch("local_deep_research.mcp.client.MCP_AVAILABLE", True):
+ config = {"name": "mock-server", "command": "python"}
+ client = MCPClient(config)
+
+ client._connected = True
+ client._session = MagicMock()
+
+ # Track what was received
+ received_messages = []
+
+ async def mock_call(name, args):
+ msg = args.get("message", "")
+ received_messages.append(msg)
+ await asyncio.sleep(0.001) # Tiny delay
+ return mock_tool_result(f'{{"echoed": "{msg}"}}')
+
+ client._session.call_tool = mock_call
+
+ # Create unique messages
+ messages = [f"UNIQUE_{i}_MSG" for i in range(20)]
+ tasks = [
+ client.call_tool("echo", {"message": msg}) for msg in messages
+ ]
+
+ results = await asyncio.gather(*tasks)
+
+ # All messages should have been received
+ assert len(received_messages) == 20
+ assert set(received_messages) == set(messages)
+
+ # All results should succeed
+ for result in results:
+ assert result["status"] == "success"
+
+ @pytest.mark.asyncio
+ async def test_mixed_parallel_tools_with_mock(self, mock_tool_result):
+ """Test different tools called in parallel."""
+ from local_deep_research.mcp.client import MCPClient
+
+ with patch("local_deep_research.mcp.client.MCP_AVAILABLE", True):
+ config = {"name": "mock-server", "command": "python"}
+ client = MCPClient(config)
+
+ client._connected = True
+ client._session = MagicMock()
+
+ async def mock_call(name, args):
+ await asyncio.sleep(0.001)
+ if name == "echo":
+ return mock_tool_result(
+ f'{{"message": "{args.get("message", "")}"}}'
+ )
+ elif name == "add":
+ result = args.get("a", 0) + args.get("b", 0)
+ return mock_tool_result(f'{{"result": {result}}}')
+ return mock_tool_result('{"status": "unknown"}')
+
+ client._session.call_tool = mock_call
+
+ tasks = [
+ client.call_tool("echo", {"message": "hello"}),
+ client.call_tool("add", {"a": 1, "b": 2}),
+ client.call_tool("echo", {"message": "world"}),
+ client.call_tool("add", {"a": 10, "b": 20}),
+ ]
+
+ results = await asyncio.gather(*tasks)
+
+ assert len(results) == 4
+ assert all(r["status"] == "success" for r in results)
+
+
+class TestMCPClientManagerWithMocks:
+ """Tests for MCPClientManager using mocks."""
+
+ @pytest.mark.asyncio
+ async def test_manager_call_tool_on_unknown_server(self):
+ """Test calling tool on non-existent server raises error."""
+ from local_deep_research.mcp.client import (
+ MCPClientManager,
+ MCPClientError,
+ )
+
+ manager = MCPClientManager([])
+
+ async with manager.connect_all():
+ with pytest.raises(MCPClientError) as exc_info:
+ await manager.call_tool("unknown-server", "echo", {})
+
+ assert "not connected" in str(exc_info.value)
+
+ @pytest.mark.asyncio
+ async def test_manager_empty_configs(self):
+ """Test manager with empty config list."""
+ from local_deep_research.mcp.client import MCPClientManager
+
+ manager = MCPClientManager([])
+
+ async with manager.connect_all():
+ servers = manager.get_connected_servers()
+ assert servers == []
+
+ @pytest.mark.asyncio
+ async def test_manager_cleanup_tracking(self):
+ """Test that manager properly tracks cleanup."""
+ from local_deep_research.mcp.client import MCPClientManager
+
+ # Use empty configs to avoid actual connections
+ manager = MCPClientManager([])
+
+ assert len(manager._clients) == 0
+
+ async with manager.connect_all():
+ assert len(manager._clients) == 0 # No servers configured
+
+ assert len(manager._clients) == 0
+
+
+# =============================================================================
+# Subprocess-based integration tests - marked for opt-in execution
+# =============================================================================
+
+
+class TestConcurrentToolCallsSubprocess:
+ """Tests for concurrent tool calls using real subprocess."""
+
+ @pytest.fixture
+ def echo_server_config(self):
+ """Configuration for the echo test server."""
+ return {
+ "name": "echo-concurrent-test",
+ "command": sys.executable,
+ "args": [str(ECHO_SERVER_PATH)],
+ }
+
+ @pytest.mark.asyncio
+ async def test_parallel_tool_calls(self, echo_server_config):
+ """Test multiple tool calls running in parallel."""
+ from local_deep_research.mcp.client import MCPClient
+
+ client = MCPClient(echo_server_config, timeout=60.0)
+
+ async with client.connect() as connected:
+ # Launch multiple tool calls concurrently
+ tasks = [
+ connected.call_tool("echo", {"message": f"Message {i}"})
+ for i in range(5)
+ ]
+
+ results = await asyncio.gather(*tasks)
+
+ # All should succeed
+ assert len(results) == 5
+ for i, result in enumerate(results):
+ assert result["status"] == "success"
+ assert f"Message {i}" in result["content"]
+
+ @pytest.mark.asyncio
+ async def test_mixed_parallel_tool_calls(self, echo_server_config):
+ """Test different tools called in parallel."""
+ from local_deep_research.mcp.client import MCPClient
+
+ client = MCPClient(echo_server_config, timeout=60.0)
+
+ async with client.connect() as connected:
+ # Launch different tools concurrently
+ tasks = [
+ connected.call_tool("echo", {"message": "test"}),
+ connected.call_tool("add_numbers", {"a": 1, "b": 2}),
+ connected.call_tool("get_info", {}),
+ connected.call_tool("add_numbers", {"a": 10, "b": 20}),
+ ]
+
+ results = await asyncio.gather(*tasks)
+
+ # All should succeed
+ assert len(results) == 4
+ for result in results:
+ assert result["status"] == "success"
+
+ # Verify specific results
+ assert "test" in results[0]["content"]
+ assert "3" in results[1]["content"]
+ assert "echo-test-server" in results[2]["content"]
+ assert "30" in results[3]["content"]
+
+ @pytest.mark.asyncio
+ async def test_concurrent_calls_no_data_corruption(
+ self, echo_server_config
+ ):
+ """Test that concurrent calls don't corrupt each other's data."""
+ from local_deep_research.mcp.client import MCPClient
+
+ client = MCPClient(echo_server_config, timeout=60.0)
+
+ async with client.connect() as connected:
+ # Create unique messages to verify no cross-contamination
+ messages = [f"UNIQUE_{i}_MESSAGE_{i * 100}" for i in range(10)]
+
+ tasks = [
+ connected.call_tool("echo", {"message": msg})
+ for msg in messages
+ ]
+
+ results = await asyncio.gather(*tasks)
+
+ # Each result should contain its corresponding message
+ for i, (msg, result) in enumerate(zip(messages, results)):
+ assert result["status"] == "success"
+ assert msg in result["content"], f"Message {i} was corrupted"
+
+
+class TestMCPClientManagerSubprocess:
+ """Tests for MCPClientManager with real subprocess servers."""
+
+ @pytest.mark.asyncio
+ async def test_manager_connect_all_single_server(self):
+ """Test MCPClientManager connecting to a single server."""
+ from local_deep_research.mcp.client import MCPClientManager
+
+ configs = [
+ {
+ "name": "echo-1",
+ "command": sys.executable,
+ "args": [str(ECHO_SERVER_PATH)],
+ }
+ ]
+
+ manager = MCPClientManager(configs)
+
+ async with manager.connect_all():
+ servers = manager.get_connected_servers()
+ assert "echo-1" in servers
+
+ # Test calling a tool
+ result = await manager.call_tool(
+ "echo-1", "echo", {"message": "Manager test"}
+ )
+ assert result["status"] == "success"
+ assert "Manager test" in result["content"]
+
+ @pytest.mark.asyncio
+ async def test_manager_list_all_tools(self):
+ """Test listing tools from all connected servers."""
+ from local_deep_research.mcp.client import MCPClientManager
+
+ configs = [
+ {
+ "name": "echo-tools",
+ "command": sys.executable,
+ "args": [str(ECHO_SERVER_PATH)],
+ }
+ ]
+
+ manager = MCPClientManager(configs)
+
+ async with manager.connect_all():
+ all_tools = await manager.list_all_tools()
+
+ assert "echo-tools" in all_tools
+ tool_names = [t["name"] for t in all_tools["echo-tools"]]
+ assert "echo" in tool_names
+ assert "add_numbers" in tool_names
+
+ @pytest.mark.asyncio
+ async def test_manager_cleanup_on_exit(self):
+ """Test that manager properly cleans up connections."""
+ from local_deep_research.mcp.client import MCPClientManager
+
+ configs = [
+ {
+ "name": "cleanup-test",
+ "command": sys.executable,
+ "args": [str(ECHO_SERVER_PATH)],
+ }
+ ]
+
+ manager = MCPClientManager(configs)
+
+ async with manager.connect_all():
+ assert len(manager.get_connected_servers()) == 1
+
+ # After exit, should have no connected servers
+ assert len(manager._clients) == 0
+
+ @pytest.mark.asyncio
+ async def test_manager_handles_connection_failure_gracefully(self):
+ """Test that manager continues when one server fails to connect."""
+ from local_deep_research.mcp.client import MCPClientManager
+
+ configs = [
+ {
+ "name": "good-server",
+ "command": sys.executable,
+ "args": [str(ECHO_SERVER_PATH)],
+ },
+ {
+ "name": "bad-server",
+ "command": "python",
+ "args": ["/nonexistent/path.py"],
+ },
+ ]
+
+ manager = MCPClientManager(configs)
+
+ async with manager.connect_all():
+ servers = manager.get_connected_servers()
+ # The good server should be connected
+ assert "good-server" in servers
+ # The bad server should NOT be connected (failed gracefully)
+ assert "bad-server" not in servers
+
+
+class TestConcurrencyMocking:
+ """Tests for concurrent behavior using mocks (for faster/deterministic testing)."""
+
+ @pytest.mark.asyncio
+ async def test_concurrent_calls_with_mocked_session(self):
+ """Test concurrent behavior with mocked MCP session."""
+ from local_deep_research.mcp.client import MCPClient
+
+ # Create a mock that simulates some async delay
+ async def mock_call_tool(name, args):
+ await asyncio.sleep(0.01) # Small delay to test concurrency
+ mock_result = MagicMock()
+ mock_result.isError = False
+ mock_item = MagicMock()
+ mock_item.text = f"Result for {name} with {args}"
+ mock_result.content = [mock_item]
+ return mock_result
+
+ with patch("local_deep_research.mcp.client.MCP_AVAILABLE", True):
+ config = {"name": "mock-server", "command": "python"}
+ client = MCPClient(config)
+
+ # Manually set up the client as if connected
+ client._connected = True
+ client._session = MagicMock()
+ client._session.call_tool = mock_call_tool
+
+ # Run concurrent calls
+ tasks = [client.call_tool("tool", {"id": i}) for i in range(10)]
+
+ results = await asyncio.gather(*tasks)
+
+ assert len(results) == 10
+ for result in results:
+ assert result["status"] == "success"
+
+ @pytest.mark.asyncio
+ async def test_no_race_condition_on_connection_state(self):
+ """Test that connection state is properly synchronized."""
+ from local_deep_research.mcp.client import MCPClient, MCPClientError
+
+ with patch("local_deep_research.mcp.client.MCP_AVAILABLE", True):
+ config = {"name": "race-test", "command": "python"}
+ client = MCPClient(config)
+
+ # Not connected - should raise
+ async def attempt_call():
+ return await client.call_tool("test", {})
+
+ tasks = [attempt_call() for _ in range(5)]
+
+ # All should raise MCPClientError since not connected
+ results = await asyncio.gather(*tasks, return_exceptions=True)
+
+ for result in results:
+ assert isinstance(result, MCPClientError)
+ assert "Not connected" in str(result)
+
+
+class TestAsyncUtilityConcurrency:
+ """Tests for the run_async utility with concurrent scenarios."""
+
+ def test_run_async_multiple_sequential_calls(self):
+ """Test run_async handles multiple sequential calls."""
+ from local_deep_research.mcp.client import run_async
+
+ async def coro(n):
+ return n * 2
+
+ results = [run_async(coro(i)) for i in range(5)]
+
+ assert results == [0, 2, 4, 6, 8]
+
+ def test_run_async_with_exception_in_one(self):
+ """Test run_async propagates exceptions correctly."""
+ from local_deep_research.mcp.client import run_async
+
+ async def success_coro():
+ return "ok"
+
+ async def fail_coro():
+ raise ValueError("failed")
+
+ # First call succeeds
+ assert run_async(success_coro()) == "ok"
+
+ # Second call fails
+ with pytest.raises(ValueError) as exc_info:
+ run_async(fail_coro())
+ assert "failed" in str(exc_info.value)
+
+ # Third call succeeds (exception doesn't affect future calls)
+ assert run_async(success_coro()) == "ok"
diff --git a/tests/mcp/test_edge_cases.py b/tests/mcp/test_edge_cases.py
new file mode 100644
index 0000000000..cb35ec0db2
--- /dev/null
+++ b/tests/mcp/test_edge_cases.py
@@ -0,0 +1,563 @@
+"""
+Edge case tests for MCP server tools.
+
+Tests for boundary conditions, unusual inputs, and error handling.
+"""
+
+from unittest.mock import patch
+
+import pytest
+
+# Skip all tests if MCP is not available
+try:
+ import mcp # noqa: F401
+
+ MCP_AVAILABLE = True
+except ImportError:
+ MCP_AVAILABLE = False
+
+pytestmark = pytest.mark.skipif(
+ not MCP_AVAILABLE, reason="MCP package not installed"
+)
+
+
+class TestQueryEdgeCases:
+ """Tests for edge cases in query handling."""
+
+ def test_empty_query(self):
+ """Test behavior with empty string query returns validation error."""
+ from local_deep_research.mcp.server import quick_research
+
+ # Empty query should be caught by validation
+ result = quick_research(query="")
+
+ assert result["status"] == "error"
+ assert result["error_type"] == "validation_error"
+ assert "empty" in result["error"].lower()
+
+ def test_whitespace_only_query(self):
+ """Test behavior with whitespace-only query returns validation error."""
+ from local_deep_research.mcp.server import quick_research
+
+ # Whitespace-only query should be caught by validation
+ result = quick_research(query=" \t\n ")
+
+ assert result["status"] == "error"
+ assert result["error_type"] == "validation_error"
+ assert "empty" in result["error"].lower()
+
+ def test_very_long_query(self):
+ """Test behavior with very long query (>10000 chars) returns validation error."""
+ from local_deep_research.mcp.server import quick_research
+
+ long_query = "What is quantum computing? " * 500 # ~13500 chars
+
+ # Query exceeding max length should be caught by validation
+ result = quick_research(query=long_query)
+
+ assert result["status"] == "error"
+ assert result["error_type"] == "validation_error"
+ assert "exceeds maximum length" in result["error"].lower()
+
+ def test_query_with_special_characters(self):
+ """Test query with unicode, emojis, special chars."""
+ from local_deep_research.mcp.server import quick_research
+
+ special_query = (
+ 'What is 量子计算? 🔬 Test with émojis & spëcial <chars> "quotes"'
+ )
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_quick_summary",
+ return_value={
+ "summary": "Test",
+ "findings": [],
+ "sources": [],
+ "iterations": 1,
+ },
+ ):
+ result = quick_research(query=special_query)
+
+ assert result["status"] == "success"
+
+ def test_query_with_newlines(self):
+ """Test query containing newline characters."""
+ from local_deep_research.mcp.server import quick_research
+
+ query_with_newlines = "What is quantum computing?\nHow does it work?\nWhat are its applications?"
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_quick_summary",
+ return_value={
+ "summary": "Test",
+ "findings": [],
+ "sources": [],
+ "iterations": 1,
+ },
+ ):
+ result = quick_research(query=query_with_newlines)
+
+ assert result["status"] == "success"
+
+
+class TestParameterEdgeCases:
+ """Tests for edge cases in parameter handling.
+
+ Note: The implementation validates parameters upfront and returns
+ validation errors for invalid values like 0, negative, or exceeding max.
+ """
+
+ def test_iterations_zero(self):
+ """Test behavior with iterations=0 returns validation error."""
+ from local_deep_research.mcp.server import quick_research
+
+ # iterations=0 is invalid (must be positive integer)
+ result = quick_research(query="test", iterations=0)
+
+ assert result["status"] == "error"
+ assert result["error_type"] == "validation_error"
+ assert "positive integer" in result["error"].lower()
+
+ def test_iterations_negative(self):
+ """Test behavior with negative iterations returns validation error."""
+ from local_deep_research.mcp.server import quick_research
+
+ # Negative iterations are invalid
+ result = quick_research(query="test", iterations=-5)
+
+ assert result["status"] == "error"
+ assert result["error_type"] == "validation_error"
+ assert "positive integer" in result["error"].lower()
+
+ def test_iterations_very_large(self):
+ """Test behavior with very large iterations value returns validation error."""
+ from local_deep_research.mcp.server import quick_research
+
+ # iterations=10000 exceeds max of 10 for quick_research
+ result = quick_research(query="test", iterations=10000)
+
+ assert result["status"] == "error"
+ assert result["error_type"] == "validation_error"
+ assert "cannot exceed" in result["error"].lower()
+
+ def test_questions_per_iteration_zero(self):
+ """Test behavior with questions_per_iteration=0 returns validation error."""
+ from local_deep_research.mcp.server import quick_research
+
+ # questions_per_iteration=0 is invalid (must be positive integer)
+ result = quick_research(query="test", questions_per_iteration=0)
+
+ assert result["status"] == "error"
+ assert result["error_type"] == "validation_error"
+ assert "positive integer" in result["error"].lower()
+
+ def test_invalid_search_engine_name(self):
+ """Test behavior with invalid search engine name."""
+ from local_deep_research.mcp.server import quick_research
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_quick_summary",
+ side_effect=Exception("Unknown search engine: nonexistent_engine"),
+ ):
+ result = quick_research(
+ query="test", search_engine="nonexistent_engine"
+ )
+
+ assert result["status"] == "error"
+ assert "nonexistent_engine" in result["error"]
+
+ def test_invalid_strategy_name(self):
+ """Test behavior with invalid strategy name."""
+ from local_deep_research.mcp.server import quick_research
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_quick_summary",
+ side_effect=Exception("Unknown strategy: fake_strategy"),
+ ):
+ result = quick_research(query="test", strategy="fake_strategy")
+
+ assert result["status"] == "error"
+ assert "fake_strategy" in result["error"]
+
+ def test_max_results_zero(self):
+ """Test analyze_documents with max_results=0 returns validation error."""
+ from local_deep_research.mcp.server import analyze_documents
+
+ # max_results=0 is invalid (must be positive integer)
+ result = analyze_documents(
+ query="test", collection_name="test", max_results=0
+ )
+
+ assert result["status"] == "error"
+ assert result["error_type"] == "validation_error"
+ assert "positive integer" in result["error"].lower()
+
+ def test_max_results_negative(self):
+ """Test analyze_documents with negative max_results returns validation error."""
+ from local_deep_research.mcp.server import analyze_documents
+
+ # Negative max_results is invalid
+ result = analyze_documents(
+ query="test", collection_name="test", max_results=-10
+ )
+
+ assert result["status"] == "error"
+ assert result["error_type"] == "validation_error"
+ assert "positive integer" in result["error"].lower()
+
+ def test_empty_collection_name(self):
+ """Test analyze_documents with empty collection name."""
+ from local_deep_research.mcp.server import analyze_documents
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_analyze_documents",
+ side_effect=Exception("Collection name cannot be empty"),
+ ):
+ result = analyze_documents(
+ query="test", collection_name="", max_results=10
+ )
+
+ assert result["status"] == "error"
+
+
+class TestReturnValueEdgeCases:
+ """Tests for edge cases in return value handling."""
+
+ def test_handles_missing_summary_field(self):
+ """Test graceful handling when API returns no summary."""
+ from local_deep_research.mcp.server import quick_research
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_quick_summary",
+ return_value={
+ "findings": [],
+ "sources": [],
+ "iterations": 1,
+ }, # No summary
+ ):
+ result = quick_research(query="test")
+
+ assert result["status"] == "success"
+ assert result["summary"] == "" # Should default to empty string
+
+ def test_handles_missing_findings_field(self):
+ """Test graceful handling when API returns no findings."""
+ from local_deep_research.mcp.server import quick_research
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_quick_summary",
+ return_value={
+ "summary": "Test",
+ "sources": [],
+ "iterations": 1,
+ }, # No findings
+ ):
+ result = quick_research(query="test")
+
+ assert result["status"] == "success"
+ assert result["findings"] == [] # Should default to empty list
+
+ def test_handles_missing_sources_field(self):
+ """Test graceful handling when API returns no sources."""
+ from local_deep_research.mcp.server import quick_research
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_quick_summary",
+ return_value={
+ "summary": "Test",
+ "findings": [],
+ "iterations": 1,
+ }, # No sources
+ ):
+ result = quick_research(query="test")
+
+ assert result["status"] == "success"
+ assert result["sources"] == [] # Should default to empty list
+
+ def test_handles_none_summary(self):
+ """Test handling when summary is None."""
+ from local_deep_research.mcp.server import quick_research
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_quick_summary",
+ return_value={
+ "summary": None,
+ "findings": [],
+ "sources": [],
+ "iterations": 1,
+ },
+ ):
+ result = quick_research(query="test")
+
+ assert result["status"] == "success"
+ # None should be preserved or converted to empty string
+ assert result["summary"] is None or result["summary"] == ""
+
+ def test_handles_none_in_findings_list(self):
+ """Test handling of None values in findings list."""
+ from local_deep_research.mcp.server import quick_research
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_quick_summary",
+ return_value={
+ "summary": "Test",
+ "findings": [None, {"content": "valid"}, None],
+ "sources": [],
+ "iterations": 1,
+ },
+ ):
+ result = quick_research(query="test")
+
+ assert result["status"] == "success"
+ assert len(result["findings"]) == 3 # Should preserve the list as-is
+
+ def test_handles_completely_empty_response(self):
+ """Test handling of completely empty API response."""
+ from local_deep_research.mcp.server import quick_research
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_quick_summary",
+ return_value={}, # Empty dict
+ ):
+ result = quick_research(query="test")
+
+ assert result["status"] == "success"
+ assert result["summary"] == ""
+ assert result["findings"] == []
+ assert result["sources"] == []
+ assert result["iterations"] == 0
+
+ def test_handles_unexpected_extra_fields(self):
+ """Test that unexpected fields in API response don't break the tool."""
+ from local_deep_research.mcp.server import quick_research
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_quick_summary",
+ return_value={
+ "summary": "Test",
+ "findings": [],
+ "sources": [],
+ "iterations": 1,
+ "unexpected_field": "some value",
+ "another_unexpected": {"nested": "data"},
+ },
+ ):
+ result = quick_research(query="test")
+
+ assert result["status"] == "success"
+ assert result["summary"] == "Test"
+
+
+class TestDetailedResearchEdgeCases:
+ """Edge case tests specific to detailed_research."""
+
+ def test_handles_missing_research_id(self):
+ """Test handling when research_id is missing."""
+ from local_deep_research.mcp.server import detailed_research
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_detailed_research",
+ return_value={
+ "query": "test",
+ "summary": "Test",
+ "findings": [],
+ "sources": [],
+ "iterations": 1,
+ },
+ ):
+ result = detailed_research(query="test")
+
+ assert result["status"] == "success"
+ assert result["research_id"] == "" # Should default to empty string
+
+ def test_handles_missing_metadata(self):
+ """Test handling when metadata is missing."""
+ from local_deep_research.mcp.server import detailed_research
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_detailed_research",
+ return_value={
+ "query": "test",
+ "research_id": "123",
+ "summary": "Test",
+ "findings": [],
+ "sources": [],
+ "iterations": 1,
+ },
+ ):
+ result = detailed_research(query="test")
+
+ assert result["status"] == "success"
+ assert result["metadata"] == {} # Should default to empty dict
+
+
+class TestGenerateReportEdgeCases:
+ """Edge case tests specific to generate_report."""
+
+ def test_handles_missing_content(self):
+ """Test handling when report content is missing."""
+ from local_deep_research.mcp.server import generate_report
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_generate_report",
+ return_value={"metadata": {"query": "test"}}, # No content
+ ):
+ result = generate_report(query="test")
+
+ assert result["status"] == "success"
+ assert result["content"] == "" # Should default to empty string
+
+ def test_searches_per_section_zero(self):
+ """Test generate_report with searches_per_section=0 returns validation error."""
+ from local_deep_research.mcp.server import generate_report
+
+ # searches_per_section=0 is invalid (must be positive integer)
+ result = generate_report(query="test", searches_per_section=0)
+
+ assert result["status"] == "error"
+ assert result["error_type"] == "validation_error"
+ assert "positive integer" in result["error"].lower()
+
+ def test_searches_per_section_very_large(self):
+ """Test generate_report with very large searches_per_section returns validation error."""
+ from local_deep_research.mcp.server import generate_report
+
+ # searches_per_section=1000 exceeds max of 10
+ result = generate_report(query="test", searches_per_section=1000)
+
+ assert result["status"] == "error"
+ assert result["error_type"] == "validation_error"
+ assert "cannot exceed" in result["error"].lower()
+
+
+class TestConnectionErrorClassification:
+ """Tests for connection error classification."""
+
+ def test_classify_connection_error(self):
+ """Test classification of connection errors."""
+ from local_deep_research.mcp.server import _classify_error
+
+ assert _classify_error("Connection refused") == "connection_error"
+ assert (
+ _classify_error("Failed to establish connection")
+ == "connection_error"
+ )
+ assert _classify_error("Connection reset by peer") == "connection_error"
+
+ def test_classify_combined_errors(self):
+ """Test error classification with multiple error patterns."""
+ from local_deep_research.mcp.server import _classify_error
+
+ # Service unavailable should take precedence
+ assert (
+ _classify_error("Connection failed: 503 Service unavailable")
+ == "service_unavailable"
+ )
+ # Timeout should be detected
+ assert (
+ _classify_error("Connection timeout after 30 seconds") == "timeout"
+ )
+
+
+class TestMCPClientEdgeCases:
+ """Edge case tests for MCP client result handling."""
+
+ def test_result_content_none_handling(self):
+ """Test client handles None result.content gracefully."""
+ from unittest.mock import MagicMock
+
+ # Create a mock result with None content
+ mock_result = MagicMock()
+ mock_result.isError = False
+ mock_result.content = None
+
+ # Verify the handling logic works with None
+ content = []
+ if mock_result.content is not None and hasattr(
+ mock_result.content, "__iter__"
+ ):
+ for item in mock_result.content:
+ content.append(str(item))
+ elif mock_result.content is not None:
+ content.append(str(mock_result.content))
+
+ # Should produce empty content list
+ assert content == []
+
+ def test_result_content_non_iterable_handling(self):
+ """Test client handles non-iterable result.content gracefully."""
+ from unittest.mock import MagicMock
+
+ # Create a mock result with non-iterable content (e.g., an integer)
+ mock_result = MagicMock()
+ mock_result.isError = False
+ mock_result.content = 42 # Non-iterable
+
+ # Verify the handling logic works with non-iterable
+ content = []
+ if mock_result.content is not None and hasattr(
+ mock_result.content, "__iter__"
+ ):
+ for item in mock_result.content:
+ content.append(str(item))
+ elif mock_result.content is not None:
+ content.append(str(mock_result.content))
+
+ # Should convert to string
+ assert content == ["42"]
+
+ def test_result_content_string_handling(self):
+ """Test client handles string result.content (which is iterable) correctly."""
+ from unittest.mock import MagicMock
+
+ # Create a mock result with string content
+ # Note: strings are iterable but we want to treat them as a single value
+ mock_result = MagicMock()
+ mock_result.isError = False
+ mock_result.content = "test string"
+
+ content = []
+ if mock_result.content is not None and hasattr(
+ mock_result.content, "__iter__"
+ ):
+ # String has __iter__ but we iterate over characters
+ # This tests the current behavior - strings will be iterated
+ for item in mock_result.content:
+ if hasattr(item, "text"):
+ content.append(item.text)
+ elif hasattr(item, "data"):
+ content.append(str(item.data))
+ else:
+ content.append(str(item))
+
+ # Each character becomes a string
+ assert len(content) == len("test string")
+
+ def test_result_content_list_with_text_items(self):
+ """Test client handles list of items with text attribute."""
+ from unittest.mock import MagicMock
+
+ # Create mock items with text attribute
+ item1 = MagicMock()
+ item1.text = "First text"
+
+ item2 = MagicMock()
+ item2.text = "Second text"
+
+ mock_result = MagicMock()
+ mock_result.isError = False
+ mock_result.content = [item1, item2]
+
+ content = []
+ if mock_result.content is not None and hasattr(
+ mock_result.content, "__iter__"
+ ):
+ for item in mock_result.content:
+ if hasattr(item, "text"):
+ content.append(item.text)
+ elif hasattr(item, "data"):
+ content.append(str(item.data))
+ else:
+ content.append(str(item))
+
+ assert content == ["First text", "Second text"]
diff --git a/tests/mcp/test_integration.py b/tests/mcp/test_integration.py
new file mode 100644
index 0000000000..9ead13cdd2
--- /dev/null
+++ b/tests/mcp/test_integration.py
@@ -0,0 +1,398 @@
+"""
+Integration tests for MCP server.
+
+Tests for complete research workflows with realistic mocked data.
+"""
+
+from unittest.mock import patch
+
+import pytest
+
+# Skip all tests if MCP is not available
+try:
+ import mcp # noqa: F401
+
+ MCP_AVAILABLE = True
+except ImportError:
+ MCP_AVAILABLE = False
+
+pytestmark = pytest.mark.skipif(
+ not MCP_AVAILABLE, reason="MCP package not installed"
+)
+
+
+class TestSettingsFlow:
+ """Tests for settings snapshot creation and override flow."""
+
+ def test_settings_snapshot_created_for_quick_research(self):
+ """Verify settings snapshot is created when calling quick_research."""
+ from local_deep_research.mcp.server import quick_research
+
+ with patch(
+ "local_deep_research.mcp.server.create_settings_snapshot"
+ ) as mock_snapshot:
+ mock_snapshot.return_value = {"llm.provider": "openai"}
+ with patch(
+ "local_deep_research.mcp.server.ldr_quick_summary",
+ return_value={
+ "summary": "Test",
+ "findings": [],
+ "sources": [],
+ "iterations": 1,
+ },
+ ):
+ result = quick_research(query="test")
+
+ mock_snapshot.assert_called_once()
+ assert result["status"] == "success"
+
+ def test_settings_overrides_applied_to_snapshot(self):
+ """Verify overrides are passed to create_settings_snapshot."""
+ from local_deep_research.mcp.server import quick_research
+
+ with patch(
+ "local_deep_research.mcp.server.create_settings_snapshot"
+ ) as mock_snapshot:
+ mock_snapshot.return_value = {}
+ with (
+ patch(
+ "local_deep_research.mcp.server.ldr_quick_summary",
+ return_value={
+ "summary": "Test",
+ "findings": [],
+ "sources": [],
+ "iterations": 1,
+ },
+ ),
+ patch(
+ "local_deep_research.mcp.server._validate_search_engine",
+ side_effect=lambda e: e,
+ ),
+ patch(
+ "local_deep_research.mcp.server._validate_strategy",
+ side_effect=lambda s: s,
+ ),
+ ):
+ quick_research(
+ query="test",
+ search_engine="wikipedia",
+ strategy="rapid",
+ iterations=3,
+ )
+
+ # Check that overrides were passed (last call is from quick_research)
+ call_kwargs = mock_snapshot.call_args[1]
+ assert "overrides" in call_kwargs
+ overrides = call_kwargs["overrides"]
+ assert overrides["search.tool"] == "wikipedia"
+ assert overrides["search.search_strategy"] == "rapid"
+ assert overrides["search.iterations"] == 3
+
+ def test_settings_snapshot_passed_to_api(self):
+ """Verify settings snapshot is passed to the API function."""
+ from local_deep_research.mcp.server import quick_research
+
+ mock_settings = {"llm.provider": "openai", "search.tool": "wikipedia"}
+
+ with patch(
+ "local_deep_research.mcp.server.create_settings_snapshot",
+ return_value=mock_settings,
+ ):
+ with patch(
+ "local_deep_research.mcp.server.ldr_quick_summary"
+ ) as mock_api:
+ mock_api.return_value = {
+ "summary": "Test",
+ "findings": [],
+ "sources": [],
+ "iterations": 1,
+ }
+ quick_research(query="test query")
+
+ # Verify settings_snapshot was passed to API
+ call_kwargs = mock_api.call_args[1]
+ assert "settings_snapshot" in call_kwargs
+ assert call_kwargs["settings_snapshot"] == mock_settings
+
+ def test_no_overrides_when_no_params(self):
+ """Verify no overrides dict when no optional params provided."""
+ from local_deep_research.mcp.server import quick_research
+
+ with patch(
+ "local_deep_research.mcp.server.create_settings_snapshot"
+ ) as mock_snapshot:
+ mock_snapshot.return_value = {}
+ with patch(
+ "local_deep_research.mcp.server.ldr_quick_summary",
+ return_value={
+ "summary": "Test",
+ "findings": [],
+ "sources": [],
+ "iterations": 1,
+ },
+ ):
+ quick_research(query="test") # No optional params
+
+ # Should still be called (with empty overrides or no overrides kwarg)
+ mock_snapshot.assert_called_once()
+
+
+class TestResearchFlowIntegration:
+ """Tests for complete research workflows."""
+
+ def test_quick_research_complete_flow(self):
+ """Test complete quick_research flow from input to output."""
+ from local_deep_research.mcp.server import quick_research
+
+ mock_result = {
+ "summary": "Quantum computing uses qubits for computation.",
+ "findings": [
+ {"phase": "Iteration 1", "content": "Found info about qubits"},
+ {
+ "phase": "Iteration 2",
+ "content": "Found info about superposition",
+ },
+ ],
+ "sources": [
+ {"title": "Wikipedia", "link": "https://wikipedia.org/quantum"},
+ ],
+ "iterations": 2,
+ "formatted_findings": "## Findings\n\nContent here",
+ }
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_quick_summary",
+ return_value=mock_result,
+ ):
+ result = quick_research(
+ query="What is quantum computing?",
+ search_engine="wikipedia",
+ iterations=2,
+ )
+
+ assert result["status"] == "success"
+ assert result["summary"] == mock_result["summary"]
+ assert len(result["findings"]) == 2
+ assert len(result["sources"]) == 1
+ assert result["iterations"] == 2
+
+ def test_detailed_research_complete_flow(self):
+ """Test complete detailed_research flow."""
+ from local_deep_research.mcp.server import detailed_research
+
+ mock_result = {
+ "query": "machine learning applications",
+ "research_id": "research-abc-123",
+ "summary": "Machine learning has many applications...",
+ "findings": [{"content": "Finding 1"}, {"content": "Finding 2"}],
+ "sources": [{"title": "Source 1", "link": "https://example.com"}],
+ "iterations": 3,
+ "formatted_findings": "Formatted content",
+ "metadata": {
+ "timestamp": "2024-01-15T10:00:00Z",
+ "search_tool": "arxiv",
+ "strategy": "source-based",
+ },
+ }
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_detailed_research",
+ return_value=mock_result,
+ ):
+ result = detailed_research(
+ query="machine learning applications",
+ search_engine="arxiv",
+ strategy="source-based",
+ )
+
+ assert result["status"] == "success"
+ assert result["query"] == "machine learning applications"
+ assert result["research_id"] == "research-abc-123"
+ assert "metadata" in result
+ assert result["metadata"]["search_tool"] == "arxiv"
+
+ def test_generate_report_complete_flow(self):
+ """Test complete generate_report flow."""
+ from local_deep_research.mcp.server import generate_report
+
+ mock_result = {
+ "content": "# Research Report\n\n## Introduction\n\nThis report...\n\n## Findings\n\n...",
+ "metadata": {
+ "generated_at": "2024-01-15T10:00:00Z",
+ "query": "climate change",
+ },
+ }
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_generate_report",
+ return_value=mock_result,
+ ):
+ result = generate_report(
+ query="climate change impacts",
+ searches_per_section=3,
+ )
+
+ assert result["status"] == "success"
+ assert result["content"].startswith("# Research Report")
+ assert "metadata" in result
+
+
+class TestDiscoveryToolsIntegration:
+ """Integration tests for discovery tools."""
+
+ def test_list_strategies_returns_all_expected_strategies(self):
+ """Verify list_strategies returns the complete list."""
+ from local_deep_research.mcp.server import list_strategies
+
+ result = list_strategies()
+
+ assert result["status"] == "success"
+ strategy_names = [s["name"] for s in result["strategies"]]
+
+ # Check for key strategies
+ assert "source-based" in strategy_names
+ assert "rapid" in strategy_names
+ assert "iterative" in strategy_names
+ assert "evidence" in strategy_names
+
+ def test_get_configuration_structure(self):
+ """Verify get_configuration returns expected structure."""
+ from local_deep_research.mcp.server import get_configuration
+
+ result = get_configuration()
+
+ assert result["status"] == "success"
+ assert "config" in result
+
+ config = result["config"]
+ assert "llm" in config
+ assert "search" in config
+
+ # Check LLM config structure
+ assert "provider" in config["llm"]
+ assert "model" in config["llm"]
+ assert "temperature" in config["llm"]
+
+ # Check search config structure
+ assert "default_engine" in config["search"]
+ assert "default_strategy" in config["search"]
+ assert "iterations" in config["search"]
+
+
+class TestErrorFlowIntegration:
+ """Integration tests for error handling flows."""
+
+ def test_quick_research_error_flow(self):
+ """Test error handling flow in quick_research."""
+ from local_deep_research.mcp.server import quick_research
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_quick_summary",
+ side_effect=Exception("LLM service unavailable: 503"),
+ ):
+ result = quick_research(query="test")
+
+ assert result["status"] == "error"
+ assert result["error_type"] == "service_unavailable"
+
+ def test_detailed_research_error_flow(self):
+ """Test error handling flow in detailed_research."""
+ from local_deep_research.mcp.server import detailed_research
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_detailed_research",
+ side_effect=Exception("Invalid API key"),
+ ):
+ result = detailed_research(query="test")
+
+ assert result["status"] == "error"
+ assert result["error_type"] == "auth_error"
+
+ def test_generate_report_error_flow(self):
+ """Test error handling flow in generate_report."""
+ from local_deep_research.mcp.server import generate_report
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_generate_report",
+ side_effect=Exception("Request timeout after 30s"),
+ ):
+ result = generate_report(query="test")
+
+ assert result["status"] == "error"
+ assert "timeout" in result["error"].lower()
+ assert result["error_type"] == "timeout"
+
+ def test_analyze_documents_error_flow(self):
+ """Test error handling flow in analyze_documents."""
+ from local_deep_research.mcp.server import analyze_documents
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_analyze_documents",
+ side_effect=Exception("Collection 'nonexistent' not found"),
+ ):
+ result = analyze_documents(
+ query="test", collection_name="nonexistent"
+ )
+
+ assert result["status"] == "error"
+ assert result["error_type"] == "model_not_found"
+
+
+class TestMultipleCallsIsolation:
+ """Tests to verify calls don't interfere with each other."""
+
+ def test_settings_isolation_between_calls(self):
+ """Verify settings from one call don't leak to another."""
+ from local_deep_research.mcp.server import quick_research
+
+ calls = []
+
+ def capture_call(*args, **kwargs):
+ calls.append(kwargs.get("settings_snapshot", {}))
+ return {
+ "summary": "Test",
+ "findings": [],
+ "sources": [],
+ "iterations": 1,
+ }
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_quick_summary",
+ side_effect=capture_call,
+ ):
+ # First call with wikipedia
+ quick_research(query="test1", search_engine="wikipedia")
+ # Second call with arxiv
+ quick_research(query="test2", search_engine="arxiv")
+
+ # Each call should have its own settings
+ assert len(calls) == 2
+ # Settings should be different (or at least both captured)
+
+ def test_error_in_one_call_doesnt_affect_next(self):
+ """Verify an error in one call doesn't affect subsequent calls."""
+ from local_deep_research.mcp.server import quick_research
+
+ call_count = [0]
+
+ def mock_api(*args, **kwargs):
+ call_count[0] += 1
+ if call_count[0] == 1:
+ raise Exception("First call fails")
+ return {
+ "summary": "Success",
+ "findings": [],
+ "sources": [],
+ "iterations": 1,
+ }
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_quick_summary",
+ side_effect=mock_api,
+ ):
+ result1 = quick_research(query="test1")
+ result2 = quick_research(query="test2")
+
+ assert result1["status"] == "error"
+ assert result2["status"] == "success"
+ assert result2["summary"] == "Success"
diff --git a/tests/mcp/test_mcp_client.py b/tests/mcp/test_mcp_client.py
new file mode 100644
index 0000000000..ee430d6012
--- /dev/null
+++ b/tests/mcp/test_mcp_client.py
@@ -0,0 +1,310 @@
+"""
+Tests for the MCP client wrapper utilities.
+
+These tests verify:
+- MCPClient connection and tool operations
+- MCPClientManager multi-server management
+- Error handling
+- Async utilities
+"""
+
+from unittest.mock import patch
+
+import pytest
+
+# Skip all tests if MCP is not available
+try:
+ import mcp # noqa: F401
+
+ MCP_AVAILABLE = True
+except ImportError:
+ MCP_AVAILABLE = False
+
+pytestmark = pytest.mark.skipif(
+ not MCP_AVAILABLE, reason="MCP package not installed"
+)
+
+
+class TestMCPClientInit:
+ """Tests for MCPClient initialization."""
+
+ def test_init_basic(self):
+ """Test basic initialization."""
+ with patch("local_deep_research.mcp.client.MCP_AVAILABLE", True):
+ from local_deep_research.mcp.client import MCPClient
+
+ config = {
+ "name": "test-server",
+ "command": "python",
+ "args": ["-m", "test"],
+ }
+
+ client = MCPClient(config)
+
+ assert client.name == "test-server"
+ assert client.config == config
+ assert client.timeout == 60.0
+ assert not client._connected
+
+ def test_init_with_custom_timeout(self):
+ """Test initialization with custom timeout."""
+ with patch("local_deep_research.mcp.client.MCP_AVAILABLE", True):
+ from local_deep_research.mcp.client import MCPClient
+
+ config = {"name": "test", "command": "python"}
+ client = MCPClient(config, timeout=120.0)
+
+ assert client.timeout == 120.0
+
+ def test_init_unnamed_server(self):
+ """Test initialization without name uses default."""
+ with patch("local_deep_research.mcp.client.MCP_AVAILABLE", True):
+ from local_deep_research.mcp.client import MCPClient
+
+ config = {"command": "python"}
+ client = MCPClient(config)
+
+ assert client.name == "unnamed"
+
+ def test_init_mcp_not_available(self):
+ """Test initialization raises error when MCP not installed."""
+ with patch("local_deep_research.mcp.client.MCP_AVAILABLE", False):
+ # Need to reload the module to get the error
+ from local_deep_research.mcp.client import MCPClient, MCPClientError
+
+ config = {"command": "python"}
+
+ with pytest.raises(MCPClientError) as exc_info:
+ MCPClient(config)
+
+ assert "not available" in str(exc_info.value)
+
+
+class TestMCPClientError:
+ """Tests for MCPClientError exception."""
+
+ def test_error_inherits_from_exception(self):
+ """Test MCPClientError is a proper exception."""
+ from local_deep_research.mcp.client import MCPClientError
+
+ with pytest.raises(MCPClientError):
+ raise MCPClientError("Test error")
+
+ def test_error_message(self):
+ """Test error message is preserved."""
+ from local_deep_research.mcp.client import MCPClientError
+
+ error = MCPClientError("Custom error message")
+ assert str(error) == "Custom error message"
+
+
+class TestMCPClientManagerInit:
+ """Tests for MCPClientManager initialization."""
+
+ def test_init_with_configs(self):
+ """Test initialization with server configs."""
+ from local_deep_research.mcp.client import MCPClientManager
+
+ configs = [
+ {"name": "server1", "command": "command1"},
+ {"name": "server2", "command": "command2"},
+ ]
+
+ manager = MCPClientManager(configs)
+
+ assert manager.server_configs == configs
+ assert len(manager._clients) == 0 # Not connected yet
+
+ def test_init_empty_configs(self):
+ """Test initialization with empty configs."""
+ from local_deep_research.mcp.client import MCPClientManager
+
+ manager = MCPClientManager([])
+
+ assert manager.server_configs == []
+
+ def test_get_connected_servers_empty(self):
+ """Test getting connected servers when none connected."""
+ from local_deep_research.mcp.client import MCPClientManager
+
+ manager = MCPClientManager([])
+
+ assert manager.get_connected_servers() == []
+
+
+class TestRunAsync:
+ """Tests for the run_async helper function."""
+
+ def test_run_async_simple_coroutine(self):
+ """Test running a simple coroutine."""
+ from local_deep_research.mcp.client import run_async
+
+ async def simple_coro():
+ return "result"
+
+ result = run_async(simple_coro())
+
+ assert result == "result"
+
+ def test_run_async_with_exception(self):
+ """Test run_async propagates exceptions."""
+ from local_deep_research.mcp.client import run_async
+
+ async def error_coro():
+ raise ValueError("Test error")
+
+ with pytest.raises(ValueError) as exc_info:
+ run_async(error_coro())
+
+ assert "Test error" in str(exc_info.value)
+
+ def test_run_async_from_async_context(self):
+ """Test run_async works when called from within an async context.
+
+ This tests the nested event loop path that uses ThreadPoolExecutor.
+ """
+ import asyncio
+ from local_deep_research.mcp.client import run_async
+
+ async def inner_coro():
+ return "inner_result"
+
+ async def outer_coro():
+ # This simulates calling run_async from within an async context
+ # which triggers the ThreadPoolExecutor path
+ result = run_async(inner_coro())
+ return result
+
+ # Run the outer coroutine which will call run_async internally
+ result = asyncio.run(outer_coro())
+ assert result == "inner_result"
+
+ def test_run_async_nested_with_exception(self):
+ """Test run_async propagates exceptions from nested context."""
+ import asyncio
+ from local_deep_research.mcp.client import run_async
+
+ async def inner_coro():
+ raise ValueError("Nested error")
+
+ async def outer_coro():
+ return run_async(inner_coro())
+
+ with pytest.raises(ValueError) as exc_info:
+ asyncio.run(outer_coro())
+
+ assert "Nested error" in str(exc_info.value)
+
+ def test_run_async_timeout_in_nested_context(self):
+ """Test run_async respects timeout parameter in nested async context.
+
+ Note: Timeout only applies when calling from within an existing event loop,
+ where ThreadPoolExecutor is used. In the simple case (no event loop),
+ asyncio.run() is used which doesn't have timeout.
+ """
+ import asyncio
+ from local_deep_research.mcp.client import run_async, MCPClientError
+
+ async def slow_coro():
+ await asyncio.sleep(10)
+ return "never reached"
+
+ async def outer_coro():
+ # Call run_async from within an async context to trigger
+ # the ThreadPoolExecutor path which respects timeout
+ return run_async(slow_coro(), timeout=0.1)
+
+ with pytest.raises(MCPClientError) as exc_info:
+ asyncio.run(outer_coro())
+
+ assert "timed out" in str(exc_info.value)
+
+
+class TestMCPClientNotConnected:
+ """Tests for operations when client is not connected."""
+
+ def test_list_tools_not_connected(self):
+ """Test list_tools raises error when not connected."""
+ with patch("local_deep_research.mcp.client.MCP_AVAILABLE", True):
+ from local_deep_research.mcp.client import (
+ MCPClient,
+ MCPClientError,
+ run_async,
+ )
+
+ config = {"name": "test", "command": "python"}
+ client = MCPClient(config)
+
+ async def test():
+ return await client.list_tools()
+
+ with pytest.raises(MCPClientError) as exc_info:
+ run_async(test())
+
+ assert "Not connected" in str(exc_info.value)
+
+ def test_call_tool_not_connected(self):
+ """Test call_tool raises error when not connected."""
+ with patch("local_deep_research.mcp.client.MCP_AVAILABLE", True):
+ from local_deep_research.mcp.client import (
+ MCPClient,
+ MCPClientError,
+ run_async,
+ )
+
+ config = {"name": "test", "command": "python"}
+ client = MCPClient(config)
+
+ async def test():
+ return await client.call_tool("test_tool", {})
+
+ with pytest.raises(MCPClientError) as exc_info:
+ run_async(test())
+
+ assert "Not connected" in str(exc_info.value)
+
+
+class TestMCPClientManagerOperations:
+ """Tests for MCPClientManager operations."""
+
+ def test_call_tool_server_not_connected(self):
+ """Test calling tool on non-connected server raises error."""
+ from local_deep_research.mcp.client import (
+ MCPClientManager,
+ MCPClientError,
+ run_async,
+ )
+
+ manager = MCPClientManager([])
+
+ async def test():
+ return await manager.call_tool("unknown_server", "tool", {})
+
+ with pytest.raises(MCPClientError) as exc_info:
+ run_async(test())
+
+ assert "not connected" in str(exc_info.value)
+
+
+class TestModuleExports:
+ """Tests for module exports."""
+
+ def test_mcp_available_exported(self):
+ """Test MCP_AVAILABLE is exported."""
+ from local_deep_research.mcp.client import MCP_AVAILABLE
+
+ assert isinstance(MCP_AVAILABLE, bool)
+
+ def test_all_classes_exported(self):
+ """Test all main classes are exported."""
+ from local_deep_research.mcp.client import (
+ MCPClient,
+ MCPClientManager,
+ MCPClientError,
+ run_async,
+ )
+
+ assert MCPClient is not None
+ assert MCPClientManager is not None
+ assert MCPClientError is not None
+ assert callable(run_async)
diff --git a/tests/mcp/test_mcp_client_server_integration.py b/tests/mcp/test_mcp_client_server_integration.py
new file mode 100644
index 0000000000..b57fe028d4
--- /dev/null
+++ b/tests/mcp/test_mcp_client_server_integration.py
@@ -0,0 +1,448 @@
+"""
+Integration tests for MCP client-server communication.
+
+These tests verify the MCP client functionality through a combination of:
+1. Mock-based tests for fast, deterministic testing of client logic
+2. Subprocess tests (marked with `integration`) for end-to-end verification
+
+To run the subprocess tests locally:
+ pytest tests/mcp/test_mcp_client_server_integration.py -m integration
+"""
+
+import asyncio
+import sys
+from pathlib import Path
+from unittest.mock import AsyncMock, MagicMock, patch
+
+import pytest
+
+# Skip all tests if MCP is not available
+try:
+ import mcp # noqa: F401
+
+ MCP_AVAILABLE = True
+except ImportError:
+ MCP_AVAILABLE = False
+
+pytestmark = pytest.mark.skipif(
+ not MCP_AVAILABLE, reason="MCP package not installed"
+)
+
+# Path to the echo server for testing
+ECHO_SERVER_PATH = Path(__file__).parent / "echo_server.py"
+
+
+class TestMCPClientWithMockedSession:
+ """Tests for MCPClient using mocked session for fast, reliable testing."""
+
+ @pytest.fixture
+ def mock_tool_result(self):
+ """Create a mock tool result."""
+
+ def _make_result(text_content, is_error=False):
+ mock_item = MagicMock()
+ mock_item.text = text_content
+ mock_result = MagicMock()
+ mock_result.isError = is_error
+ mock_result.content = [mock_item]
+ return mock_result
+
+ return _make_result
+
+ @pytest.fixture
+ def mock_list_tools_result(self):
+ """Create a mock list tools result."""
+ mock_tool1 = MagicMock()
+ mock_tool1.name = "echo"
+ mock_tool1.description = "Echo a message"
+ mock_tool1.inputSchema = {
+ "type": "object",
+ "properties": {"message": {"type": "string"}},
+ }
+
+ mock_tool2 = MagicMock()
+ mock_tool2.name = "add_numbers"
+ mock_tool2.description = "Add two numbers"
+ mock_tool2.inputSchema = {
+ "type": "object",
+ "properties": {"a": {"type": "integer"}, "b": {"type": "integer"}},
+ }
+
+ mock_result = MagicMock()
+ mock_result.tools = [mock_tool1, mock_tool2]
+ return mock_result
+
+ @pytest.mark.asyncio
+ async def test_list_tools_with_mock(self, mock_list_tools_result):
+ """Test list_tools returns properly formatted tool list."""
+ from local_deep_research.mcp.client import MCPClient
+
+ with patch("local_deep_research.mcp.client.MCP_AVAILABLE", True):
+ config = {"name": "mock-server", "command": "python"}
+ client = MCPClient(config)
+
+ # Set up mocked connected state
+ client._connected = True
+ client._session = MagicMock()
+ client._session.list_tools = AsyncMock(
+ return_value=mock_list_tools_result
+ )
+
+ tools = await client.list_tools()
+
+ assert len(tools) == 2
+ assert tools[0]["name"] == "echo"
+ assert tools[0]["description"] == "Echo a message"
+ assert tools[1]["name"] == "add_numbers"
+
+ @pytest.mark.asyncio
+ async def test_call_tool_success_with_mock(self, mock_tool_result):
+ """Test call_tool returns success result."""
+ from local_deep_research.mcp.client import MCPClient
+
+ with patch("local_deep_research.mcp.client.MCP_AVAILABLE", True):
+ config = {"name": "mock-server", "command": "python"}
+ client = MCPClient(config)
+
+ client._connected = True
+ client._session = MagicMock()
+ client._session.call_tool = AsyncMock(
+ return_value=mock_tool_result(
+ '{"status": "success", "message": "Hello, World!"}'
+ )
+ )
+
+ result = await client.call_tool(
+ "echo", {"message": "Hello, World!"}
+ )
+
+ assert result["status"] == "success"
+ assert "Hello, World!" in result["content"]
+
+ @pytest.mark.asyncio
+ async def test_call_tool_error_result_with_mock(self, mock_tool_result):
+ """Test call_tool handles error results from server."""
+ from local_deep_research.mcp.client import MCPClient
+
+ with patch("local_deep_research.mcp.client.MCP_AVAILABLE", True):
+ config = {"name": "mock-server", "command": "python"}
+ client = MCPClient(config)
+
+ client._connected = True
+ client._session = MagicMock()
+ client._session.call_tool = AsyncMock(
+ return_value=mock_tool_result(
+ "Tool execution failed", is_error=True
+ )
+ )
+
+ result = await client.call_tool("failing_tool", {})
+
+ assert result["status"] == "error"
+
+ @pytest.mark.asyncio
+ async def test_call_tool_timeout_with_mock(self):
+ """Test call_tool raises error on timeout."""
+ from local_deep_research.mcp.client import MCPClient, MCPClientError
+
+ with patch("local_deep_research.mcp.client.MCP_AVAILABLE", True):
+ config = {"name": "mock-server", "command": "python"}
+ client = MCPClient(config, timeout=0.1)
+
+ client._connected = True
+ client._session = MagicMock()
+
+ async def slow_call(*args, **kwargs):
+ await asyncio.sleep(1.0)
+
+ client._session.call_tool = slow_call
+
+ with pytest.raises(MCPClientError) as exc_info:
+ await client.call_tool("slow_tool", {})
+
+ assert "timed out" in str(exc_info.value).lower()
+
+ @pytest.mark.asyncio
+ async def test_multiple_sequential_calls_with_mock(self, mock_tool_result):
+ """Test multiple sequential tool calls work correctly."""
+ from local_deep_research.mcp.client import MCPClient
+
+ with patch("local_deep_research.mcp.client.MCP_AVAILABLE", True):
+ config = {"name": "mock-server", "command": "python"}
+ client = MCPClient(config)
+
+ client._connected = True
+ client._session = MagicMock()
+
+ call_count = 0
+
+ async def mock_call_tool(name, args):
+ nonlocal call_count
+ call_count += 1
+ return mock_tool_result(f"Result {call_count}")
+
+ client._session.call_tool = mock_call_tool
+
+ result1 = await client.call_tool("tool1", {})
+ result2 = await client.call_tool("tool2", {})
+ result3 = await client.call_tool("tool3", {})
+
+ assert "Result 1" in result1["content"]
+ assert "Result 2" in result2["content"]
+ assert "Result 3" in result3["content"]
+ assert call_count == 3
+
+
+# =============================================================================
+# Subprocess-based integration tests - marked for opt-in execution
+# These tests spawn actual MCP servers and test real communication
+# =============================================================================
+
+
+class TestRealMCPClientServerCommunication:
+ """Tests for actual MCP client-server communication via subprocess.
+
+ These tests are slower and require subprocess spawning. Run with:
+ pytest -m integration
+ """
+
+ @pytest.fixture
+ def echo_server_config(self):
+ """Configuration for the echo test server."""
+ return {
+ "name": "echo-test",
+ "command": sys.executable,
+ "args": [str(ECHO_SERVER_PATH)],
+ }
+
+ @pytest.mark.asyncio
+ async def test_connect_to_echo_server(self, echo_server_config):
+ """Test connecting to the echo server subprocess."""
+ from local_deep_research.mcp.client import MCPClient
+
+ client = MCPClient(echo_server_config, timeout=60.0)
+
+ async with client.connect() as connected:
+ assert connected._connected is True
+
+ @pytest.mark.asyncio
+ async def test_list_tools_from_echo_server(self, echo_server_config):
+ """Test listing tools from the running echo server."""
+ from local_deep_research.mcp.client import MCPClient
+
+ client = MCPClient(echo_server_config, timeout=60.0)
+
+ async with client.connect() as connected:
+ tools = await connected.list_tools()
+
+ # Verify we got the expected tools
+ tool_names = [t["name"] for t in tools]
+ assert "echo" in tool_names
+ assert "add_numbers" in tool_names
+ assert "get_info" in tool_names
+
+ @pytest.mark.asyncio
+ async def test_call_echo_tool(self, echo_server_config):
+ """Test calling the echo tool on the real server."""
+ from local_deep_research.mcp.client import MCPClient
+
+ client = MCPClient(echo_server_config, timeout=60.0)
+
+ async with client.connect() as connected:
+ result = await connected.call_tool(
+ "echo", {"message": "Hello, MCP!"}
+ )
+
+ assert result["status"] == "success"
+ # The content should contain the echoed message
+ assert "Hello, MCP!" in result["content"]
+
+ @pytest.mark.asyncio
+ async def test_call_add_numbers_tool(self, echo_server_config):
+ """Test calling the add_numbers tool."""
+ from local_deep_research.mcp.client import MCPClient
+
+ client = MCPClient(echo_server_config, timeout=60.0)
+
+ async with client.connect() as connected:
+ result = await connected.call_tool("add_numbers", {"a": 5, "b": 3})
+
+ assert result["status"] == "success"
+ # Result should contain 8
+ assert "8" in result["content"]
+
+ @pytest.mark.asyncio
+ async def test_call_get_info_tool(self, echo_server_config):
+ """Test calling the get_info tool."""
+ from local_deep_research.mcp.client import MCPClient
+
+ client = MCPClient(echo_server_config, timeout=60.0)
+
+ async with client.connect() as connected:
+ result = await connected.call_tool("get_info", {})
+
+ assert result["status"] == "success"
+ assert "echo-test-server" in result["content"]
+
+ @pytest.mark.asyncio
+ async def test_multiple_tool_calls_sequential(self, echo_server_config):
+ """Test multiple sequential tool calls on one connection."""
+ from local_deep_research.mcp.client import MCPClient
+
+ client = MCPClient(echo_server_config, timeout=60.0)
+
+ async with client.connect() as connected:
+ # Call multiple tools sequentially
+ result1 = await connected.call_tool("echo", {"message": "First"})
+ result2 = await connected.call_tool(
+ "add_numbers", {"a": 10, "b": 20}
+ )
+ result3 = await connected.call_tool("echo", {"message": "Third"})
+
+ assert result1["status"] == "success"
+ assert "First" in result1["content"]
+ assert result2["status"] == "success"
+ assert "30" in result2["content"]
+ assert result3["status"] == "success"
+ assert "Third" in result3["content"]
+
+ @pytest.mark.asyncio
+ async def test_connection_context_manager_cleanup(self, echo_server_config):
+ """Test that connection is properly cleaned up after context exit."""
+ from local_deep_research.mcp.client import MCPClient
+
+ client = MCPClient(echo_server_config, timeout=60.0)
+
+ async with client.connect() as connected:
+ assert connected._connected is True
+
+ # After context exit, should be disconnected
+ assert client._connected is False
+ assert client._session is None
+
+
+class TestMCPClientServerErrorHandling:
+ """Tests for error handling in real client-server communication."""
+
+ @pytest.fixture
+ def echo_server_config(self):
+ """Configuration for the echo test server."""
+ return {
+ "name": "echo-test",
+ "command": sys.executable,
+ "args": [str(ECHO_SERVER_PATH)],
+ }
+
+ @pytest.mark.asyncio
+ async def test_tool_error_handling(self, echo_server_config):
+ """Test handling of errors from tools."""
+ from local_deep_research.mcp.client import MCPClient
+
+ client = MCPClient(echo_server_config, timeout=60.0)
+
+ async with client.connect() as connected:
+ # Request the tool to fail intentionally
+ result = await connected.call_tool(
+ "fail_on_demand",
+ {"should_fail": True, "error_message": "Test failure"},
+ )
+
+ # The MCP SDK returns error results, not exceptions for tool errors
+ # Check if the result indicates an error
+ assert (
+ result["status"] == "error"
+ or "error" in result.get("content", "").lower()
+ )
+
+ @pytest.mark.asyncio
+ async def test_connection_to_invalid_command(self):
+ """Test connection failure for invalid command."""
+ from local_deep_research.mcp.client import MCPClient, MCPClientError
+
+ config = {
+ "name": "invalid",
+ "command": "python",
+ "args": ["/nonexistent/path/to/server.py"],
+ }
+
+ client = MCPClient(config, timeout=10.0)
+
+ with pytest.raises(MCPClientError):
+ async with client.connect():
+ pass # Should not reach here
+
+
+class TestMCPClientValidation:
+ """Tests for client configuration validation with real commands."""
+
+ def test_allowed_commands_includes_python(self):
+ """Test that python is in allowed commands."""
+ from local_deep_research.mcp.client import ALLOWED_COMMANDS
+
+ assert "python" in ALLOWED_COMMANDS
+ assert "python3" in ALLOWED_COMMANDS
+
+ def test_disallowed_command_raises_error(self):
+ """Test that disallowed commands raise MCPClientError."""
+ from local_deep_research.mcp.client import MCPClient, MCPClientError
+
+ with patch("local_deep_research.mcp.client.MCP_AVAILABLE", True):
+ config = {
+ "name": "malicious",
+ "command": "rm", # Not in allowed list
+ "args": ["-rf", "/"],
+ }
+
+ with pytest.raises(MCPClientError) as exc_info:
+ MCPClient(config)
+
+ assert "not in allowed list" in str(exc_info.value)
+
+ def test_missing_command_raises_error(self):
+ """Test that missing command raises MCPClientError."""
+ from local_deep_research.mcp.client import MCPClient, MCPClientError
+
+ with patch("local_deep_research.mcp.client.MCP_AVAILABLE", True):
+ config = {
+ "name": "no-command",
+ # Missing 'command' key
+ }
+
+ with pytest.raises(MCPClientError) as exc_info:
+ MCPClient(config)
+
+ assert "missing" in str(exc_info.value).lower()
+
+ def test_invalid_args_type_raises_error(self):
+ """Test that non-list args raises MCPClientError."""
+ from local_deep_research.mcp.client import MCPClient, MCPClientError
+
+ with patch("local_deep_research.mcp.client.MCP_AVAILABLE", True):
+ config = {
+ "name": "bad-args",
+ "command": "python",
+ "args": "not-a-list", # Should be a list
+ }
+
+ with pytest.raises(MCPClientError) as exc_info:
+ MCPClient(config)
+
+ assert "must be a list" in str(exc_info.value)
+
+ def test_invalid_env_type_raises_error(self):
+ """Test that non-dict env raises MCPClientError."""
+ from local_deep_research.mcp.client import MCPClient, MCPClientError
+
+ with patch("local_deep_research.mcp.client.MCP_AVAILABLE", True):
+ config = {
+ "name": "bad-env",
+ "command": "python",
+ "env": ["not", "a", "dict"], # Should be a dict
+ }
+
+ with pytest.raises(MCPClientError) as exc_info:
+ MCPClient(config)
+
+ assert "must be a dictionary" in str(exc_info.value)
diff --git a/tests/mcp/test_mcp_protocol.py b/tests/mcp/test_mcp_protocol.py
new file mode 100644
index 0000000000..788abc4b8c
--- /dev/null
+++ b/tests/mcp/test_mcp_protocol.py
@@ -0,0 +1,281 @@
+"""
+MCP protocol tests for the MCP server.
+
+Tests for server setup, tool registration, and logging configuration.
+"""
+
+import sys
+import io
+from unittest.mock import patch
+
+import pytest
+
+# Skip all tests if MCP is not available
+try:
+ import mcp # noqa: F401
+
+ MCP_AVAILABLE = True
+except ImportError:
+ MCP_AVAILABLE = False
+
+pytestmark = pytest.mark.skipif(
+ not MCP_AVAILABLE, reason="MCP package not installed"
+)
+
+
+class TestMCPServerSetup:
+ """Tests for MCP server initialization and configuration."""
+
+ def test_mcp_server_instance_created(self):
+ """Verify FastMCP server instance is created correctly."""
+ from local_deep_research.mcp.server import mcp
+
+ assert mcp is not None
+ assert mcp.name == "local-deep-research"
+
+ def test_mcp_server_instructions_set(self):
+ """Verify server instructions/description is set."""
+ from local_deep_research.mcp.server import mcp
+
+ # FastMCP stores instructions
+ assert mcp.instructions is not None
+ assert "research" in mcp.instructions.lower()
+
+ def test_run_server_function_exists(self):
+ """Verify run_server function is exported."""
+ from local_deep_research.mcp import run_server
+
+ assert callable(run_server)
+
+
+class TestMCPToolRegistration:
+ """Tests for MCP tool decorators and registration."""
+
+ def test_all_expected_tools_are_defined(self):
+ """Verify all 7 expected tools are defined as functions."""
+ from local_deep_research.mcp.server import (
+ quick_research,
+ detailed_research,
+ generate_report,
+ analyze_documents,
+ list_search_engines,
+ list_strategies,
+ get_configuration,
+ )
+
+ # All tools should be callable
+ assert callable(quick_research)
+ assert callable(detailed_research)
+ assert callable(generate_report)
+ assert callable(analyze_documents)
+ assert callable(list_search_engines)
+ assert callable(list_strategies)
+ assert callable(get_configuration)
+
+ def test_quick_research_has_docstring(self):
+ """Verify quick_research has documentation."""
+ from local_deep_research.mcp.server import quick_research
+
+ assert quick_research.__doc__ is not None
+ assert len(quick_research.__doc__) > 50 # Substantial docstring
+ assert "query" in quick_research.__doc__.lower()
+
+ def test_detailed_research_has_docstring(self):
+ """Verify detailed_research has documentation."""
+ from local_deep_research.mcp.server import detailed_research
+
+ assert detailed_research.__doc__ is not None
+ assert "detailed" in detailed_research.__doc__.lower()
+
+ def test_generate_report_has_docstring(self):
+ """Verify generate_report has documentation."""
+ from local_deep_research.mcp.server import generate_report
+
+ assert generate_report.__doc__ is not None
+ assert "report" in generate_report.__doc__.lower()
+
+ def test_analyze_documents_has_docstring(self):
+ """Verify analyze_documents has documentation."""
+ from local_deep_research.mcp.server import analyze_documents
+
+ assert analyze_documents.__doc__ is not None
+ assert "document" in analyze_documents.__doc__.lower()
+
+ def test_list_search_engines_has_docstring(self):
+ """Verify list_search_engines has documentation."""
+ from local_deep_research.mcp.server import list_search_engines
+
+ assert list_search_engines.__doc__ is not None
+ assert "search" in list_search_engines.__doc__.lower()
+
+ def test_list_strategies_has_docstring(self):
+ """Verify list_strategies has documentation."""
+ from local_deep_research.mcp.server import list_strategies
+
+ assert list_strategies.__doc__ is not None
+ assert "strateg" in list_strategies.__doc__.lower()
+
+ def test_get_configuration_has_docstring(self):
+ """Verify get_configuration has documentation."""
+ from local_deep_research.mcp.server import get_configuration
+
+ assert get_configuration.__doc__ is not None
+ assert "config" in get_configuration.__doc__.lower()
+
+
+class TestMCPLogging:
+ """Tests for MCP logging configuration (critical for STDIO)."""
+
+ def test_logger_is_configured(self):
+ """Verify loguru logger is configured."""
+ from loguru import logger
+
+ # Logger should exist and have handlers
+ assert logger is not None
+
+ def test_no_stdout_pollution_from_list_strategies(self):
+ """Verify list_strategies doesn't write to stdout."""
+ from local_deep_research.mcp.server import list_strategies
+
+ # Capture stdout
+ old_stdout = sys.stdout
+ sys.stdout = captured_stdout = io.StringIO()
+
+ try:
+ result = list_strategies()
+ stdout_output = captured_stdout.getvalue()
+ finally:
+ sys.stdout = old_stdout
+
+ # Should have no stdout output (MCP uses stdout for JSON-RPC)
+ assert stdout_output == "", f"Unexpected stdout output: {stdout_output}"
+ assert result["status"] == "success"
+
+ def test_no_stdout_pollution_from_get_configuration(self):
+ """Verify get_configuration doesn't write to stdout."""
+ from local_deep_research.mcp.server import get_configuration
+
+ # Capture stdout
+ old_stdout = sys.stdout
+ sys.stdout = captured_stdout = io.StringIO()
+
+ try:
+ result = get_configuration()
+ stdout_output = captured_stdout.getvalue()
+ finally:
+ sys.stdout = old_stdout
+
+ # Should have no stdout output
+ assert stdout_output == "", f"Unexpected stdout output: {stdout_output}"
+ assert result["status"] == "success"
+
+ def test_no_stdout_pollution_during_error(self):
+ """Verify error handling doesn't write to stdout."""
+ from local_deep_research.mcp.server import quick_research
+
+ # Capture stdout
+ old_stdout = sys.stdout
+ sys.stdout = captured_stdout = io.StringIO()
+
+ try:
+ with patch(
+ "local_deep_research.mcp.server.ldr_quick_summary",
+ side_effect=Exception("Test error"),
+ ):
+ result = quick_research(query="test")
+ stdout_output = captured_stdout.getvalue()
+ finally:
+ sys.stdout = old_stdout
+
+ # Should have no stdout output even during errors
+ assert stdout_output == "", f"Unexpected stdout output: {stdout_output}"
+ assert result["status"] == "error"
+
+
+class TestAvailableStrategies:
+ """Tests for the get_available_strategies function."""
+
+ def test_available_strategies_is_list(self):
+ """Verify get_available_strategies returns a list."""
+ from local_deep_research.search_system_factory import (
+ get_available_strategies,
+ )
+
+ strategies = get_available_strategies()
+ assert isinstance(strategies, list)
+
+ def test_available_strategies_has_entries(self):
+ """Verify get_available_strategies has multiple entries."""
+ from local_deep_research.search_system_factory import (
+ get_available_strategies,
+ )
+
+ strategies = get_available_strategies()
+ assert len(strategies) >= 10 # We defined 17 strategies
+
+ def test_available_strategies_have_required_fields(self):
+ """Verify each strategy has name and description."""
+ from local_deep_research.search_system_factory import (
+ get_available_strategies,
+ )
+
+ strategies = get_available_strategies()
+ for strategy in strategies:
+ assert "name" in strategy, f"Strategy missing 'name': {strategy}"
+ assert "description" in strategy, (
+ f"Strategy missing 'description': {strategy}"
+ )
+ assert isinstance(strategy["name"], str)
+ assert isinstance(strategy["description"], str)
+ assert len(strategy["name"]) > 0
+ assert len(strategy["description"]) > 0
+
+ def test_source_based_strategy_exists(self):
+ """Verify source-based strategy is in the list."""
+ from local_deep_research.search_system_factory import (
+ get_available_strategies,
+ )
+
+ strategies = get_available_strategies()
+ strategy_names = [s["name"] for s in strategies]
+ assert "source-based" in strategy_names
+
+ def test_rapid_strategy_exists(self):
+ """Verify rapid strategy is in the list."""
+ from local_deep_research.search_system_factory import (
+ get_available_strategies,
+ )
+
+ strategies = get_available_strategies()
+ strategy_names = [s["name"] for s in strategies]
+ assert "rapid" in strategy_names
+
+
+class TestHelperFunctions:
+ """Tests for helper functions in server.py."""
+
+ def test_classify_error_is_callable(self):
+ """Verify _classify_error function exists and is callable."""
+ from local_deep_research.mcp.server import _classify_error
+
+ assert callable(_classify_error)
+
+ def test_build_settings_overrides_is_callable(self):
+ """Verify _build_settings_overrides function exists and is callable."""
+ from local_deep_research.mcp.server import _build_settings_overrides
+
+ assert callable(_build_settings_overrides)
+
+ def test_classify_error_returns_string(self):
+ """Verify _classify_error returns a string."""
+ from local_deep_research.mcp.server import _classify_error
+
+ result = _classify_error("Some error")
+ assert isinstance(result, str)
+
+ def test_build_settings_overrides_returns_dict(self):
+ """Verify _build_settings_overrides returns a dict."""
+ from local_deep_research.mcp.server import _build_settings_overrides
+
+ result = _build_settings_overrides()
+ assert isinstance(result, dict)
diff --git a/tests/mcp/test_mcp_strategy.py b/tests/mcp/test_mcp_strategy.py
new file mode 100644
index 0000000000..c3daed52b5
--- /dev/null
+++ b/tests/mcp/test_mcp_strategy.py
@@ -0,0 +1,1475 @@
+"""
+Tests for the MCP Search Strategy (ReAct pattern).
+
+These tests verify:
+- ReAct loop behavior (thought → action → observation)
+- LLM response parsing
+- Tool execution (web search, MCP tools)
+- Error handling and recovery
+- Max iteration limits
+"""
+
+from unittest.mock import MagicMock, patch
+
+import pytest
+
+# Skip all tests if MCP is not available
+try:
+ import mcp # noqa: F401
+
+ MCP_AVAILABLE = True
+except ImportError:
+ MCP_AVAILABLE = False
+
+pytestmark = pytest.mark.skipif(
+ not MCP_AVAILABLE, reason="MCP package not installed"
+)
+
+
+class TestMCPSearchStrategyInit:
+ """Tests for MCPSearchStrategy initialization."""
+
+ def test_init_with_defaults(self):
+ """Test initialization with default parameters."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ mock_model = MagicMock()
+ mock_search = MagicMock()
+
+ strategy = MCPSearchStrategy(
+ model=mock_model,
+ search=mock_search,
+ )
+
+ assert strategy.model == mock_model
+ assert strategy.search == mock_search
+ assert strategy.mcp_servers == []
+ assert strategy.max_iterations == 10
+ assert strategy.include_web_search is True
+
+ def test_init_with_custom_params(self):
+ """Test initialization with custom parameters."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ mock_model = MagicMock()
+ mock_search = MagicMock()
+ mcp_servers = [{"name": "test", "command": "test"}]
+
+ strategy = MCPSearchStrategy(
+ model=mock_model,
+ search=mock_search,
+ mcp_servers=mcp_servers,
+ max_iterations=5,
+ include_web_search=False,
+ )
+
+ assert strategy.mcp_servers == mcp_servers
+ assert strategy.max_iterations == 5
+ assert strategy.include_web_search is False
+
+ def test_init_with_settings_snapshot(self):
+ """Test initialization with settings snapshot."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ mock_model = MagicMock()
+ mock_search = MagicMock()
+ settings = {"test.setting": {"value": "test"}}
+
+ strategy = MCPSearchStrategy(
+ model=mock_model,
+ search=mock_search,
+ settings_snapshot=settings,
+ )
+
+ assert strategy.settings_snapshot == settings
+
+
+class TestResponseParsing:
+ """Tests for LLM response parsing."""
+
+ def test_parse_thought_and_answer(self):
+ """Test parsing response with thought and answer."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=MagicMock(),
+ )
+
+ response = """THOUGHT: I have gathered enough information about quantum computing.
+ANSWER: Quantum computing is a type of computation that uses quantum bits (qubits)."""
+
+ result = strategy._parse_response(response)
+
+ assert result["type"] == "answer"
+ assert "quantum" in result["thought"].lower()
+ assert "qubits" in result["content"].lower()
+
+ def test_parse_thought_and_action(self):
+ """Test parsing response with thought and action."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=MagicMock(),
+ )
+
+ response = """THOUGHT: I need to search for more information about quantum computing.
+ACTION: web_search
+ARGUMENTS: {"query": "quantum computing basics"}"""
+
+ result = strategy._parse_response(response)
+
+ assert result["type"] == "action"
+ assert result["tool"] == "web_search"
+ assert result["arguments"]["query"] == "quantum computing basics"
+
+ def test_parse_action_without_json_arguments(self):
+ """Test parsing action with non-JSON arguments format."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=MagicMock(),
+ )
+
+ response = """THOUGHT: Let me search.
+ACTION: web_search
+ARGUMENTS: query = "test query" """
+
+ result = strategy._parse_response(response)
+
+ assert result["type"] == "action"
+ assert result["tool"] == "web_search"
+ # Falls back to query extraction
+ assert result["arguments"].get("query") == "test query"
+
+ def test_parse_invalid_response(self):
+ """Test parsing invalid response."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=MagicMock(),
+ )
+
+ response = "This is just some text without proper format"
+
+ result = strategy._parse_response(response)
+
+ assert result["type"] == "error"
+ assert "Could not parse" in result["message"]
+
+ def test_parse_case_insensitive(self):
+ """Test parsing is case insensitive."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=MagicMock(),
+ )
+
+ response = """thought: I have the answer.
+answer: The answer is 42."""
+
+ result = strategy._parse_response(response)
+
+ assert result["type"] == "answer"
+ assert "42" in result["content"]
+
+
+class TestToolBuilding:
+ """Tests for tool description building."""
+
+ def test_build_tools_with_web_search(self):
+ """Test building tools includes web search when enabled."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ mock_search = MagicMock()
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=mock_search,
+ include_web_search=True,
+ )
+
+ tools = strategy._build_tool_descriptions()
+
+ assert any(t["name"] == "web_search" for t in tools)
+
+ def test_build_tools_without_web_search(self):
+ """Test building tools excludes web search when disabled."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=MagicMock(),
+ include_web_search=False,
+ )
+
+ tools = strategy._build_tool_descriptions()
+
+ assert not any(t["name"] == "web_search" for t in tools)
+
+ def test_format_tool_descriptions(self):
+ """Test formatting tool descriptions for the LLM."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=MagicMock(),
+ )
+
+ tools = [
+ {
+ "name": "test_tool",
+ "description": "A test tool",
+ "parameters": {
+ "arg1": {"type": "string"},
+ "arg2": {"type": "number"},
+ },
+ }
+ ]
+
+ formatted = strategy._format_tool_descriptions(tools)
+
+ assert "test_tool" in formatted
+ assert "A test tool" in formatted
+ assert "arg1" in formatted
+
+
+class TestWebSearchExecution:
+ """Tests for web search tool execution."""
+
+ def test_execute_web_search_success(self):
+ """Test successful web search execution."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ mock_search = MagicMock()
+ mock_search.run.return_value = [
+ {
+ "title": "Result 1",
+ "snippet": "Content 1",
+ "link": "https://example.com/1",
+ },
+ {
+ "title": "Result 2",
+ "snippet": "Content 2",
+ "link": "https://example.com/2",
+ },
+ ]
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=mock_search,
+ )
+
+ result = strategy._execute_web_search({"query": "test query"})
+
+ assert result["status"] == "success"
+ assert "Result 1" in result["content"]
+ assert "Result 2" in result["content"]
+ assert len(strategy._sources) == 2
+
+ def test_execute_web_search_empty_query(self):
+ """Test web search with empty query."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=MagicMock(),
+ )
+
+ result = strategy._execute_web_search({})
+
+ assert result["status"] == "error"
+ assert "No query" in result["content"]
+
+ def test_execute_web_search_error(self):
+ """Test web search error handling."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ mock_search = MagicMock()
+ mock_search.run.side_effect = Exception("Search API error")
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=mock_search,
+ )
+
+ result = strategy._execute_web_search({"query": "test"})
+
+ assert result["status"] == "error"
+ assert "Search failed" in result["content"]
+
+
+class TestToolExecution:
+ """Tests for general tool execution."""
+
+ def test_execute_unknown_tool(self):
+ """Test executing an unknown tool."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=MagicMock(),
+ )
+
+ tools = [
+ {"name": "web_search", "executor": strategy._execute_web_search}
+ ]
+
+ result = strategy._execute_tool("unknown_tool", {}, tools)
+
+ assert result["status"] == "error"
+ assert "Unknown tool" in result["content"]
+
+ def test_execute_tool_no_executor(self):
+ """Test executing tool without executor."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=MagicMock(),
+ )
+
+ tools = [{"name": "no_exec_tool", "description": "No executor"}]
+
+ result = strategy._execute_tool("no_exec_tool", {}, tools)
+
+ assert result["status"] == "error"
+ assert "no executor" in result["content"]
+
+
+class TestReActLoop:
+ """Tests for the main ReAct loop."""
+
+ def test_analyze_topic_immediate_answer(self):
+ """Test analyze_topic when LLM immediately provides answer."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ mock_model = MagicMock()
+ mock_response = MagicMock()
+ mock_response.content = """THOUGHT: I already know this.
+ANSWER: The capital of France is Paris."""
+ mock_response.tool_calls = []
+ mock_model.invoke.return_value = mock_response
+
+ bound_model = MagicMock()
+ bound_model.invoke.return_value = mock_response
+ mock_model.bind_tools.return_value = bound_model
+
+ strategy = MCPSearchStrategy(
+ model=mock_model,
+ search=MagicMock(),
+ )
+
+ result = strategy.analyze_topic("What is the capital of France?")
+
+ assert result["iterations"] == 1
+ assert "Paris" in result["formatted_findings"]
+ assert "Paris" in result["current_knowledge"]
+
+ def test_analyze_topic_with_search(self):
+ """Test analyze_topic with web search action."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ # First response: action, second response: answer
+ mock_model = MagicMock()
+ responses = [
+ MagicMock(
+ content="""THOUGHT: I need to search.
+ACTION: web_search
+ARGUMENTS: {"query": "quantum computing"}"""
+ ),
+ MagicMock(
+ content="""THOUGHT: Now I have enough info.
+ANSWER: Quantum computing uses qubits."""
+ ),
+ ]
+ responses[0].tool_calls = []
+ responses[1].tool_calls = []
+ mock_model.invoke.side_effect = responses
+
+ bound_model = MagicMock()
+ bound_model.invoke.side_effect = responses
+ mock_model.bind_tools.return_value = bound_model
+
+ mock_search = MagicMock()
+ mock_search.run.return_value = [
+ {
+ "title": "Quantum",
+ "snippet": "Quantum info",
+ "link": "https://example.com",
+ }
+ ]
+
+ strategy = MCPSearchStrategy(
+ model=mock_model,
+ search=mock_search,
+ )
+
+ result = strategy.analyze_topic("What is quantum computing?")
+
+ assert result["iterations"] == 2
+ assert mock_search.run.called
+ assert "qubits" in result["formatted_findings"]
+
+ def test_analyze_topic_max_iterations(self):
+ """Test analyze_topic respects max iterations limit."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ # Always return action, never answer
+ mock_model = MagicMock()
+ mock_response = MagicMock()
+ mock_response.content = """THOUGHT: Need more info.
+ACTION: web_search
+ARGUMENTS: {"query": "test"}"""
+ mock_response.tool_calls = []
+ mock_model.invoke.return_value = mock_response
+
+ bound_model = MagicMock()
+ bound_model.invoke.return_value = mock_response
+ mock_model.bind_tools.return_value = bound_model
+
+ mock_search = MagicMock()
+ mock_search.run.return_value = [
+ {"title": "T", "snippet": "S", "link": "L"}
+ ]
+
+ strategy = MCPSearchStrategy(
+ model=mock_model,
+ search=mock_search,
+ max_iterations=3,
+ )
+
+ result = strategy.analyze_topic("Test query")
+
+ # Should stop at max iterations
+ assert result["iterations"] == 3
+
+ def test_analyze_topic_still_has_research_tools(self):
+ """Test analyze_topic still works without web_search because research tools are available."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ mock_model = MagicMock()
+ mock_response = MagicMock()
+ mock_response.content = """THOUGHT: I have the information.
+ANSWER: The answer based on research."""
+ mock_model.invoke.return_value = mock_response
+
+ strategy = MCPSearchStrategy(
+ model=mock_model,
+ search=None, # No search
+ include_web_search=False, # Web search disabled
+ mcp_servers=[], # No MCP servers
+ )
+
+ # Strategy still has research tools available (sub-research and download_content)
+ # When include_sub_research=True (default) and depth < max_depth:
+ # - focused_research, source_research, quick_research, download_content
+ tools = strategy._build_tool_descriptions()
+ assert (
+ len(tools) >= 4
+ ) # focused_research, source_research, quick_research, download_content
+ assert any(t["name"] == "focused_research" for t in tools)
+ assert any(t["name"] == "source_research" for t in tools)
+ assert any(t["name"] == "quick_research" for t in tools)
+ assert any(t["name"] == "download_content" for t in tools)
+
+ def test_analyze_topic_llm_error_recovery(self):
+ """Test analyze_topic handles LLM errors."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ mock_model = MagicMock()
+ mock_model.invoke.side_effect = Exception("LLM API error")
+ mock_model.bind_tools.return_value = (
+ mock_model # bind_tools returns model that also raises
+ )
+
+ strategy = MCPSearchStrategy(
+ model=mock_model,
+ search=MagicMock(),
+ )
+
+ result = strategy.analyze_topic("Test query")
+
+ # The error should be captured in either the error key or the formatted_findings
+ error_captured = (
+ "error" in result
+ or "LLM error" in result.get("formatted_findings", "")
+ or "Error:" in result.get("formatted_findings", "")
+ or "failed" in result.get("formatted_findings", "").lower()
+ or "failed" in result.get("current_knowledge", "").lower()
+ )
+ assert error_captured, f"Error should be captured in result: {result}"
+
+
+class TestHistoryFormatting:
+ """Tests for reasoning history formatting."""
+
+ def test_format_empty_history(self):
+ """Test formatting empty history."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=MagicMock(),
+ )
+ strategy._history = []
+
+ formatted = strategy._format_history()
+
+ assert "No research done yet" in formatted
+
+ def test_format_history_with_entries(self):
+ """Test formatting history with entries."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=MagicMock(),
+ )
+ strategy._history = [
+ {
+ "role": "assistant",
+ "thought": "I need to search",
+ "action": "web_search",
+ "arguments": {"query": "test"},
+ },
+ {
+ "role": "tool",
+ "tool": "web_search",
+ "observation": "Found some results",
+ },
+ ]
+
+ formatted = strategy._format_history()
+
+ assert "THOUGHT:" in formatted
+ assert "ACTION:" in formatted
+ assert "OBSERVATION" in formatted
+
+
+class TestAnswerSynthesis:
+ """Tests for answer synthesis when max iterations reached."""
+
+ def test_synthesize_answer(self):
+ """Test answer synthesis with gathered info."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ mock_model = MagicMock()
+ mock_response = MagicMock()
+ mock_response.content = "Synthesized answer based on research."
+ mock_model.invoke.return_value = mock_response
+
+ strategy = MCPSearchStrategy(
+ model=mock_model,
+ search=MagicMock(),
+ )
+ strategy._history = [
+ {
+ "role": "tool",
+ "tool": "web_search",
+ "observation": "Some findings",
+ }
+ ]
+
+ answer = strategy._synthesize_answer("Test query")
+
+ assert "Synthesized answer" in answer
+
+ def test_synthesize_answer_error(self):
+ """Test answer synthesis error handling."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ mock_model = MagicMock()
+ mock_model.invoke.side_effect = Exception("Synthesis failed")
+
+ strategy = MCPSearchStrategy(
+ model=mock_model,
+ search=MagicMock(),
+ )
+
+ answer = strategy._synthesize_answer("Test query")
+
+ assert "synthesis failed" in answer.lower()
+
+
+class TestProgressCallback:
+ """Tests for progress callback functionality."""
+
+ def test_progress_callback_called(self):
+ """Test progress callback is called during analysis."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ mock_model = MagicMock()
+ mock_response = MagicMock()
+ mock_response.content = """THOUGHT: Done.
+ANSWER: The answer."""
+ mock_model.invoke.return_value = mock_response
+
+ strategy = MCPSearchStrategy(
+ model=mock_model,
+ search=MagicMock(),
+ )
+
+ progress_calls = []
+
+ def callback(message, progress, data):
+ progress_calls.append((message, progress, data))
+
+ strategy.set_progress_callback(callback)
+ strategy.analyze_topic("Test")
+
+ assert len(progress_calls) > 0
+ assert any("init" in str(call) for call in progress_calls)
+
+
+class TestMCPToolDiscovery:
+ """Tests for MCP tool discovery."""
+
+ def test_discover_mcp_tools_no_servers(self):
+ """Test MCP discovery with no servers configured."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=MagicMock(),
+ mcp_servers=[],
+ )
+
+ tools = strategy._discover_mcp_tools()
+
+ assert tools == []
+
+ def test_discover_mcp_tools_connection_error(self):
+ """Test MCP discovery handles connection errors gracefully."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=MagicMock(),
+ mcp_servers=[{"name": "test", "command": "nonexistent-command"}],
+ )
+
+ # The discovery should handle errors gracefully and return empty
+ # when connection fails (import is inside the method)
+ with patch(
+ "local_deep_research.mcp.client.MCPClientManager"
+ ) as mock_manager:
+ # Make the manager raise on connect
+ mock_instance = MagicMock()
+ mock_instance.connect_all.side_effect = Exception(
+ "Connection failed"
+ )
+ mock_manager.return_value = mock_instance
+
+ tools = strategy._discover_mcp_tools()
+
+ # Should return empty list on error, not raise
+ assert tools == []
+
+
+class TestStrategyExport:
+ """Tests for strategy export and import."""
+
+ def test_strategy_exported_from_package(self):
+ """Test MCPSearchStrategy is exported from strategies package."""
+ from local_deep_research.advanced_search_system.strategies import (
+ MCPSearchStrategy,
+ )
+
+ assert MCPSearchStrategy is not None
+
+ def test_strategy_registered_in_factory(self):
+ """Test strategy is registered in search_system_factory."""
+ from local_deep_research.search_system_factory import create_strategy
+
+ # Just verify the import path works - actual creation would need mocks
+ assert callable(create_strategy)
+
+
+class TestErrorResponse:
+ """Tests for error response creation."""
+
+ def test_create_error_response(self):
+ """Test error response structure."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=MagicMock(),
+ )
+
+ response = strategy._create_error_response("Test error")
+
+ assert response["findings"] == []
+ assert response["iterations"] == 0
+ assert response["questions"] == {}
+ assert "Test error" in response["formatted_findings"]
+ assert response["error"] == "Test error"
+
+
+class TestCriticalBugFixes:
+ """Tests for critical bug fixes identified in PR review."""
+
+ def test_child_strategy_inherits_depth(self):
+ """Verify child strategy gets parent.depth + 1 to prevent infinite recursion."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ # Create a parent strategy at depth 1
+ parent_strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=MagicMock(),
+ depth=1,
+ max_depth=3,
+ include_sub_research=True,
+ )
+
+ # Mock the strategy factory at the module level import
+ with patch(
+ "local_deep_research.search_system_factory.create_strategy"
+ ) as mock_create:
+ # Set up mock to return a strategy-like object
+ mock_child = MagicMock()
+ mock_child.analyze_topic.return_value = {
+ "findings": [],
+ "sources": [],
+ "formatted_findings": "test",
+ "current_knowledge": "test",
+ }
+ mock_create.return_value = mock_child
+
+ # Execute strategy research
+ parent_strategy._execute_strategy_research(
+ {"query": "test query"}, "focused-iteration"
+ )
+
+ # Verify create_strategy was called with depth=parent.depth+1
+ mock_create.assert_called_once()
+ call_kwargs = mock_create.call_args[1]
+ assert call_kwargs.get("depth") == 2, (
+ "Child strategy should have depth = parent.depth + 1"
+ )
+ assert call_kwargs.get("max_depth") == 3, (
+ "Child strategy should inherit max_depth"
+ )
+
+ def test_parse_response_missing_tool_key(self):
+ """Test graceful handling when parsed response missing 'tool' key."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ mock_model = MagicMock()
+ # Return an action-like response but with no valid tool parsing
+ mock_response = MagicMock()
+ mock_response.content = """THOUGHT: I need to do something.
+ACTION:
+ARGUMENTS: {"query": "test"}"""
+ mock_response.tool_calls = []
+
+ # Expect this to continue the loop, not crash
+ bound_model = MagicMock()
+ bound_model.invoke.return_value = mock_response
+ mock_model.bind_tools.return_value = bound_model
+
+ strategy = MCPSearchStrategy(
+ model=mock_model,
+ search=MagicMock(),
+ max_iterations=1, # Limit iterations
+ )
+
+ # This should not raise KeyError
+ result = strategy.analyze_topic("Test query")
+
+ # Should complete without crashing
+ assert "iterations" in result
+
+ def test_parse_response_empty_tool_calls_list(self):
+ """Test handling when tool_calls exists but is empty list."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=MagicMock(),
+ )
+
+ # Create a mock response with empty tool_calls list
+ mock_response = MagicMock()
+ mock_response.tool_calls = [] # Empty list (truthy but no elements)
+ mock_response.content = """THOUGHT: I have the answer.
+ANSWER: The answer is 42."""
+
+ # This should not raise IndexError
+ result = strategy._parse_response(mock_response)
+
+ # Should fall back to text-based parsing
+ assert result["type"] == "answer"
+ assert "42" in result["content"]
+
+ def test_citation_handler_returns_none(self):
+ """Test graceful fallback when citation handler returns None."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ mock_model = MagicMock()
+ mock_response = MagicMock()
+ mock_response.content = """THOUGHT: Done.
+ANSWER: The answer is here."""
+ mock_response.tool_calls = []
+ mock_model.invoke.return_value = mock_response
+
+ bound_model = MagicMock()
+ bound_model.invoke.return_value = mock_response
+ mock_model.bind_tools.return_value = bound_model
+
+ mock_citation_handler = MagicMock()
+ mock_citation_handler.analyze_followup.return_value = (
+ None # Returns None
+ )
+
+ strategy = MCPSearchStrategy(
+ model=mock_model,
+ search=MagicMock(),
+ citation_handler=mock_citation_handler,
+ )
+
+ # Add some search results to trigger citation handling
+ strategy.all_search_results = [
+ {"title": "Test", "link": "http://test.com"}
+ ]
+
+ # This should not raise AttributeError
+ result = strategy.analyze_topic("Test query")
+
+ # Should complete and have the answer
+ assert "current_knowledge" in result
+ assert result["current_knowledge"] # Should not be empty
+
+
+class TestHighPriorityBugFixes:
+ """Tests for high-priority bug fixes."""
+
+ def test_execute_web_search_empty_results(self):
+ """Test handling when search returns empty list."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ mock_search = MagicMock()
+ mock_search.run.return_value = [] # Empty results
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=mock_search,
+ )
+
+ result = strategy._execute_web_search({"query": "test query"})
+
+ assert result["status"] == "success"
+ assert "No search results found" in result["content"]
+ assert "test query" in result["content"]
+
+ def test_execute_web_search_tracks_all_sources(self):
+ """Test that all source URLs are tracked across multiple searches."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ mock_search = MagicMock()
+ # Return search results
+ mock_search.run.return_value = [
+ {
+ "title": "Result 1",
+ "snippet": "Content 1",
+ "link": "https://example.com/1",
+ },
+ {
+ "title": "Result 2",
+ "snippet": "Content 2",
+ "link": "https://example.com/2",
+ },
+ ]
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=mock_search,
+ )
+
+ # Execute twice
+ strategy._execute_web_search({"query": "test1"})
+ strategy._execute_web_search({"query": "test2"})
+
+ # All results should be tracked (deduplication is not required here,
+ # the test verifies that sources are properly tracked)
+ assert len(strategy.all_search_results) == 4
+ assert len(strategy._sources) == 4
+
+ def test_analyze_topic_large_history(self):
+ """Test ReAct loop with 10+ iterations of history doesn't cause issues."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ mock_model = MagicMock()
+
+ # Build a sequence of responses: many actions, then an answer
+ # Use proper string content instead of MagicMock
+ def make_action_response():
+ response = MagicMock()
+ response.content = """THOUGHT: Need more info.
+ACTION: web_search
+ARGUMENTS: {"query": "test"}"""
+ response.tool_calls = []
+ return response
+
+ def make_answer_response():
+ response = MagicMock()
+ response.content = """THOUGHT: Got enough info.
+ANSWER: Final answer after many iterations."""
+ response.tool_calls = []
+ return response
+
+ # 9 actions, then answer on 10th
+ responses = [make_action_response() for _ in range(9)] + [
+ make_answer_response()
+ ]
+
+ bound_model = MagicMock()
+ bound_model.invoke.side_effect = responses
+ mock_model.bind_tools.return_value = bound_model
+
+ mock_search = MagicMock()
+ mock_search.run.return_value = [
+ {"title": "T", "snippet": "S", "link": "L"}
+ ]
+
+ # Mock citation handler to return proper dict with the final answer
+ mock_citation_handler = MagicMock()
+ mock_citation_handler.analyze_followup.return_value = {
+ "content": "Final answer after many iterations.",
+ "documents": [],
+ }
+
+ strategy = MCPSearchStrategy(
+ model=mock_model,
+ search=mock_search,
+ max_iterations=10,
+ citation_handler=mock_citation_handler,
+ )
+
+ result = strategy.analyze_topic("Test query")
+
+ assert result["iterations"] == 10
+ # The test verifies we can handle 10+ iterations without errors
+ # and that the loop completes successfully
+ assert "findings" in result
+ assert len(result.get("reasoning_trace", [])) > 0
+
+ def test_synthesize_answer_no_search_results(self):
+ """Test answer synthesis when no search has been performed."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ mock_model = MagicMock()
+ mock_response = MagicMock()
+ mock_response.content = "Synthesized answer from no search results."
+ mock_model.invoke.return_value = mock_response
+
+ strategy = MCPSearchStrategy(
+ model=mock_model,
+ search=MagicMock(),
+ )
+ # No history, no search results
+ strategy._history = []
+ strategy.all_search_results = []
+
+ answer = strategy._synthesize_answer("Test query")
+
+ # Should still produce an answer
+ assert answer
+ assert "Synthesized answer" in answer
+
+
+class TestTimeoutAndRetry:
+ """Tests for timeout handling and retry logic."""
+
+ def test_run_async_timeout_parameter_exists(self):
+ """Test that run_async accepts timeout parameter."""
+ import inspect
+
+ from local_deep_research.mcp.client import run_async
+
+ # Verify run_async has timeout parameter
+ sig = inspect.signature(run_async)
+ assert "timeout" in sig.parameters
+ # Default timeout should be 300 seconds (5 minutes)
+ assert sig.parameters["timeout"].default == 300.0
+
+ def test_execute_mcp_tool_has_timeout_parameter(self):
+ """Test that _execute_mcp_tool accepts timeout parameter."""
+ import inspect
+
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ # Verify _execute_mcp_tool has timeout parameter
+ sig = inspect.signature(MCPSearchStrategy._execute_mcp_tool)
+ assert "timeout" in sig.parameters
+ # Default is None sentinel; actual timeout comes from MCP_TOOL_CALL_TIMEOUT
+ assert sig.parameters["timeout"].default is None
+ assert MCPSearchStrategy.MCP_TOOL_CALL_TIMEOUT == 60.0
+
+ def test_mcp_discovery_failure_not_permanently_cached(self):
+ """Test that MCP discovery failure doesn't permanently cache empty result."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=MagicMock(),
+ mcp_servers=[{"name": "test", "command": "nonexistent"}],
+ )
+
+ # First discovery fails
+ tools1 = strategy._discover_mcp_tools()
+ assert tools1 == []
+
+ # Cache should NOT be set on failure (allows retry)
+ assert strategy._mcp_tools_cache is None
+
+ # Second attempt should try again (not use stale cache)
+ tools2 = strategy._discover_mcp_tools()
+ # Still fails, but the point is it tried again (cache still None)
+ assert tools2 == []
+ assert strategy._mcp_tools_cache is None
+
+
+class TestMCPPartialFailure:
+ """Tests for MCP discovery and execution with partial failures."""
+
+ def test_mcp_discovery_partial_failure_returns_working_tools(self):
+ """Test when some MCP servers connect but others fail."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=MagicMock(),
+ mcp_servers=[
+ {"name": "working", "command": "python"},
+ {"name": "broken", "command": "nonexistent"},
+ ],
+ )
+
+ # Mock the client manager to simulate partial failure
+ with patch(
+ "local_deep_research.mcp.client.MCPClientManager"
+ ) as MockManager:
+ mock_instance = MagicMock()
+
+ # Simulate: working server returns tools, broken server fails silently
+ async def mock_connect_all():
+ return mock_instance
+
+ mock_instance.connect_all.return_value.__aenter__ = MagicMock(
+ return_value=mock_instance
+ )
+ mock_instance.connect_all.return_value.__aexit__ = MagicMock(
+ return_value=None
+ )
+
+ # Return tools only from working server
+ async def mock_list_tools():
+ return {
+ "working": [
+ {"name": "tool1", "description": "A working tool"}
+ ]
+ # "broken" server not in results (failed to connect)
+ }
+
+ mock_instance.list_all_tools = mock_list_tools
+ MockManager.return_value = mock_instance
+
+ # The discovery should return tools from working servers
+ # even if some servers failed
+ tools = strategy._discover_mcp_tools()
+
+ # Should have tools from working server
+ # (exact behavior depends on implementation)
+ assert isinstance(tools, list)
+
+ def test_mcp_tool_call_with_server_not_found(self):
+ """Test calling a tool on a server that doesn't exist."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=MagicMock(),
+ mcp_servers=[{"name": "real_server", "command": "python"}],
+ )
+
+ # Try to call tool on non-existent server
+ result = strategy._execute_mcp_tool(
+ "nonexistent_server", "some_tool", {"arg": "value"}
+ )
+
+ assert result["status"] == "error"
+ assert "Unknown server" in result["content"]
+
+
+class TestReActLoopRobustness:
+ """Tests for ReAct loop edge cases and robustness."""
+
+ def test_repeated_identical_searches_tracked(self):
+ """Test that repeated identical search queries are tracked in history."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ mock_model = MagicMock()
+
+ # LLM keeps requesting the same search
+ def make_same_action():
+ response = MagicMock()
+ response.content = """THOUGHT: Need to search.
+ACTION: web_search
+ARGUMENTS: {"query": "same query every time"}"""
+ response.tool_calls = []
+ return response
+
+ # After 3 identical searches, finally gives answer
+ answer_response = MagicMock()
+ answer_response.content = """THOUGHT: Done.
+ANSWER: Final answer."""
+ answer_response.tool_calls = []
+
+ responses = [make_same_action() for _ in range(3)] + [answer_response]
+
+ bound_model = MagicMock()
+ bound_model.invoke.side_effect = responses
+ mock_model.bind_tools.return_value = bound_model
+
+ mock_search = MagicMock()
+ mock_search.run.return_value = [
+ {"title": "Result", "snippet": "Content", "link": "http://test.com"}
+ ]
+
+ strategy = MCPSearchStrategy(
+ model=mock_model,
+ search=mock_search,
+ max_iterations=5,
+ )
+
+ result = strategy.analyze_topic("Test")
+
+ # Should complete and track all searches in history
+ assert result["iterations"] == 4
+ # All 3 identical searches should be in history
+ search_actions = [
+ h
+ for h in result["reasoning_trace"]
+ if h.get("action") == "web_search"
+ ]
+ assert len(search_actions) == 3
+
+ def test_nested_json_arguments_parsing(self):
+ """Test parsing action with nested JSON arguments via native tool calls."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=MagicMock(),
+ )
+
+ # Native tool calls handle nested JSON properly
+ mock_response = MagicMock()
+ mock_response.tool_calls = [
+ {
+ "name": "web_search",
+ "args": {
+ "query": "test",
+ "filters": {
+ "date": {"start": "2024-01-01", "end": "2024-12-31"},
+ "sources": ["arxiv", "pubmed"],
+ },
+ },
+ }
+ ]
+ mock_response.content = "Complex search"
+
+ result = strategy._parse_response(mock_response)
+
+ assert result["type"] == "action"
+ assert result["tool"] == "web_search"
+ assert result["arguments"]["query"] == "test"
+ assert "filters" in result["arguments"]
+ assert result["arguments"]["filters"]["date"]["start"] == "2024-01-01"
+
+ def test_multiple_tool_calls_uses_first(self):
+ """Test that when LLM returns multiple tool_calls, first is used."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=MagicMock(),
+ )
+
+ # Mock response with multiple tool calls
+ mock_response = MagicMock()
+ mock_response.tool_calls = [
+ {"name": "web_search", "args": {"query": "first query"}},
+ {"name": "web_search", "args": {"query": "second query"}},
+ {"name": "download_content", "args": {"url": "http://test.com"}},
+ ]
+ mock_response.content = "Multiple tool calls"
+
+ result = strategy._parse_response(mock_response)
+
+ # Should use the first tool call
+ assert result["type"] == "action"
+ assert result["tool"] == "web_search"
+ assert result["arguments"]["query"] == "first query"
+
+ def test_tool_execution_exception_recorded_in_history(self):
+ """Test that tool execution exceptions are properly recorded."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ mock_model = MagicMock()
+
+ # First: action that will fail, Second: answer
+ action_response = MagicMock()
+ action_response.content = """THOUGHT: Search.
+ACTION: web_search
+ARGUMENTS: {"query": "test"}"""
+ action_response.tool_calls = []
+
+ answer_response = MagicMock()
+ answer_response.content = """THOUGHT: Done.
+ANSWER: Answer after error."""
+ answer_response.tool_calls = []
+
+ bound_model = MagicMock()
+ bound_model.invoke.side_effect = [action_response, answer_response]
+ mock_model.bind_tools.return_value = bound_model
+
+ # Search raises exception
+ mock_search = MagicMock()
+ mock_search.run.side_effect = Exception("Search API unavailable")
+
+ strategy = MCPSearchStrategy(
+ model=mock_model,
+ search=mock_search,
+ max_iterations=5,
+ )
+
+ result = strategy.analyze_topic("Test")
+
+ # Should complete despite error
+ assert result["iterations"] == 2
+ # Error should be in history as observation
+ observations = [
+ h for h in result["reasoning_trace"] if h.get("role") == "tool"
+ ]
+ assert len(observations) == 1
+ # Error message format is "Search failed: <error>"
+ assert "failed" in observations[0]["observation"].lower()
+
+
+class TestSpecializedSearchEngines:
+ """Tests for specialized search engine tool execution."""
+
+ def test_execute_specialized_search_tracks_source_engine(self):
+ """Test that specialized search results include source engine info."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=MagicMock(),
+ )
+
+ # Mock the search engine factory
+ with patch(
+ "local_deep_research.web_search_engines.search_engine_factory.create_search_engine"
+ ) as mock_factory:
+ mock_engine = MagicMock()
+ mock_engine.run.return_value = [
+ {
+ "title": "arXiv Paper",
+ "snippet": "Abstract",
+ "link": "http://arxiv.org/123",
+ }
+ ]
+ mock_factory.return_value = mock_engine
+
+ result = strategy._execute_specialized_search(
+ {"query": "quantum computing"}, "arxiv"
+ )
+
+ assert result["status"] == "success"
+ # Check source engine is tracked
+ assert len(strategy.all_search_results) == 1
+ assert strategy.all_search_results[0]["source_engine"] == "arxiv"
+
+
+class TestClientContentHandling:
+ """Tests for MCP client content handling edge cases."""
+
+ def test_call_tool_with_error_response(self):
+ """Test client properly handles error responses from MCP tools."""
+
+ # Simulate the content extraction logic
+ mock_result = MagicMock()
+ mock_result.isError = True
+ mock_result.content = "Tool execution failed: invalid arguments"
+
+ # Error responses should be detected
+ assert mock_result.isError is True
+
+ def test_empty_content_list_returns_empty_string(self):
+ """Test that empty content list returns empty string, not error."""
+ # Simulate content extraction with empty list
+ content = []
+ result_content = "\n".join(content) if content else ""
+
+ assert result_content == ""
+
+
+class TestArgumentValidation:
+ """Tests for tool argument validation and sanitization."""
+
+ def test_validate_tool_arguments_truncates_long_strings(self):
+ """Test that very long argument strings are truncated."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=MagicMock(),
+ )
+
+ # Create arguments with very long string
+ long_string = "x" * 20000 # 20K chars
+ arguments = {"query": long_string, "normal": "value"}
+
+ sanitized = strategy._validate_tool_arguments(arguments)
+
+ # Long string should be truncated to MAX_ARG_LENGTH (10000)
+ assert len(sanitized["query"]) == 10000
+ assert sanitized["normal"] == "value"
+
+ def test_validate_tool_arguments_handles_non_dict(self):
+ """Test that non-dict arguments return empty dict."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=MagicMock(),
+ )
+
+ # Non-dict should return empty dict
+ assert strategy._validate_tool_arguments(None) == {}
+ assert strategy._validate_tool_arguments("string") == {}
+ assert strategy._validate_tool_arguments([1, 2, 3]) == {}
+
+ def test_validate_tool_arguments_filters_non_string_keys(self):
+ """Test that non-string keys are filtered out."""
+ from local_deep_research.advanced_search_system.strategies.mcp_strategy import (
+ MCPSearchStrategy,
+ )
+
+ strategy = MCPSearchStrategy(
+ model=MagicMock(),
+ search=MagicMock(),
+ )
+
+ # Dict with mixed key types
+ arguments = {"valid": "value", 123: "invalid_key", "also_valid": "ok"}
+
+ sanitized = strategy._validate_tool_arguments(arguments)
+
+ # Only string keys should remain
+ assert "valid" in sanitized
+ assert "also_valid" in sanitized
+ assert 123 not in sanitized
diff --git a/tests/mcp/test_server.py b/tests/mcp/test_server.py
new file mode 100644
index 0000000000..b43a5e043e
--- /dev/null
+++ b/tests/mcp/test_server.py
@@ -0,0 +1,322 @@
+"""
+Tests for the MCP server tools.
+
+These tests use mocked research functions to verify the MCP tool implementations
+without actually running research (which would take minutes).
+"""
+
+from unittest.mock import patch
+
+import pytest
+
+# Skip all tests if MCP is not available
+try:
+ import mcp # noqa: F401
+
+ MCP_AVAILABLE = True
+except ImportError:
+ MCP_AVAILABLE = False
+
+pytestmark = pytest.mark.skipif(
+ not MCP_AVAILABLE, reason="MCP package not installed"
+)
+
+
+class TestQuickResearch:
+ """Tests for the quick_research tool."""
+
+ def test_quick_research_success(self, mock_quick_summary):
+ """Test successful quick research."""
+ from local_deep_research.mcp.server import quick_research
+
+ result = quick_research(query="What is quantum computing?")
+
+ assert result["status"] == "success"
+ assert "summary" in result
+ assert (
+ result["summary"]
+ == "This is a test summary about quantum computing."
+ )
+ assert "findings" in result
+ assert "sources" in result
+ assert result["iterations"] == 1
+ mock_quick_summary.assert_called_once()
+
+ def test_quick_research_with_overrides(self, mock_quick_summary):
+ """Test quick research with parameter overrides."""
+ from local_deep_research.mcp.server import quick_research
+
+ result = quick_research(
+ query="Test query",
+ search_engine="wikipedia",
+ strategy="rapid",
+ iterations=2,
+ )
+
+ assert result["status"] == "success"
+ mock_quick_summary.assert_called_once()
+ # Verify settings_snapshot was passed
+ call_kwargs = mock_quick_summary.call_args[1]
+ assert "settings_snapshot" in call_kwargs
+
+ def test_quick_research_error_handling(self):
+ """Test error handling in quick research."""
+ from local_deep_research.mcp.server import quick_research
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_quick_summary",
+ side_effect=Exception("API key invalid"),
+ ):
+ result = quick_research(query="Test query")
+
+ assert result["status"] == "error"
+ assert "error" in result
+ assert result["error_type"] == "auth_error"
+
+
+class TestDetailedResearch:
+ """Tests for the detailed_research tool."""
+
+ def test_detailed_research_success(self, mock_detailed_research):
+ """Test successful detailed research."""
+ from local_deep_research.mcp.server import detailed_research
+
+ result = detailed_research(query="quantum computing applications")
+
+ assert result["status"] == "success"
+ assert result["query"] == "quantum computing applications"
+ assert result["research_id"] == "test-research-123"
+ assert "summary" in result
+ assert "findings" in result
+ assert len(result["findings"]) == 2
+ assert "metadata" in result
+
+ def test_detailed_research_error_handling(self):
+ """Test error handling in detailed research."""
+ from local_deep_research.mcp.server import detailed_research
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_detailed_research",
+ side_effect=Exception("Service unavailable: 503"),
+ ):
+ result = detailed_research(query="Test query")
+
+ assert result["status"] == "error"
+ assert result["error_type"] == "service_unavailable"
+
+
+class TestGenerateReport:
+ """Tests for the generate_report tool."""
+
+ def test_generate_report_success(self, mock_generate_report):
+ """Test successful report generation."""
+ from local_deep_research.mcp.server import generate_report
+
+ result = generate_report(query="quantum computing")
+
+ assert result["status"] == "success"
+ assert "content" in result
+ assert result["content"].startswith("# Research Report")
+ assert "metadata" in result
+
+ def test_generate_report_with_options(self, mock_generate_report):
+ """Test report generation with options."""
+ from local_deep_research.mcp.server import generate_report
+
+ result = generate_report(
+ query="Test query",
+ search_engine="arxiv",
+ searches_per_section=3,
+ )
+
+ assert result["status"] == "success"
+ call_kwargs = mock_generate_report.call_args[1]
+ assert call_kwargs["searches_per_section"] == 3
+
+
+class TestAnalyzeDocuments:
+ """Tests for the analyze_documents tool."""
+
+ def test_analyze_documents_success(self, mock_analyze_documents):
+ """Test successful document analysis."""
+ from local_deep_research.mcp.server import analyze_documents
+
+ result = analyze_documents(
+ query="test query",
+ collection_name="test_collection",
+ )
+
+ assert result["status"] == "success"
+ assert result["collection"] == "test_collection"
+ assert result["document_count"] == 1
+ assert "summary" in result
+ assert "documents" in result
+
+ def test_analyze_documents_error_handling(self):
+ """Test error handling in document analysis."""
+ from local_deep_research.mcp.server import analyze_documents
+
+ with patch(
+ "local_deep_research.mcp.server.ldr_analyze_documents",
+ side_effect=Exception("Collection not found"),
+ ):
+ result = analyze_documents(
+ query="test query",
+ collection_name="nonexistent",
+ )
+
+ assert result["status"] == "error"
+ assert result["error_type"] == "model_not_found"
+
+
+class TestDiscoveryTools:
+ """Tests for discovery tools (list_search_engines, list_strategies, get_configuration)."""
+
+ def test_list_strategies(self):
+ """Test listing available strategies."""
+ from local_deep_research.mcp.server import list_strategies
+
+ result = list_strategies()
+
+ assert result["status"] == "success"
+ assert "strategies" in result
+ assert len(result["strategies"]) > 0
+ # Check that each strategy has required fields
+ for strategy in result["strategies"]:
+ assert "name" in strategy
+ assert "description" in strategy
+
+ def test_list_search_engines(self):
+ """Test listing available search engines."""
+ from local_deep_research.mcp.server import list_search_engines
+
+ # Mock the search_config function at the right location
+ mock_engines = {
+ "wikipedia": {
+ "description": "Wikipedia search",
+ "strengths": ["Free", "Reliable"],
+ "weaknesses": ["Limited depth"],
+ "requires_api_key": False,
+ },
+ "arxiv": {
+ "description": "arXiv academic papers",
+ "strengths": ["Academic sources"],
+ "weaknesses": ["Science only"],
+ "requires_api_key": False,
+ },
+ }
+
+ with patch(
+ "local_deep_research.web_search_engines.search_engines_config.search_config",
+ return_value=mock_engines,
+ ):
+ result = list_search_engines()
+
+ assert result["status"] == "success"
+ assert "engines" in result
+ assert len(result["engines"]) == 2
+
+ def test_get_configuration(self, mock_settings_snapshot):
+ """Test getting server configuration."""
+ from local_deep_research.mcp.server import get_configuration
+
+ result = get_configuration()
+
+ assert result["status"] == "success"
+ assert "config" in result
+ config = result["config"]
+ assert "llm" in config
+ assert "search" in config
+
+
+class TestErrorClassification:
+ """Tests for error classification logic."""
+
+ def test_classify_service_unavailable(self):
+ """Test classification of service unavailable errors."""
+ from local_deep_research.mcp.server import _classify_error
+
+ assert (
+ _classify_error("Error 503: Service unavailable")
+ == "service_unavailable"
+ )
+ assert (
+ _classify_error("The service is unavailable")
+ == "service_unavailable"
+ )
+
+ def test_classify_model_not_found(self):
+ """Test classification of model not found errors."""
+ from local_deep_research.mcp.server import _classify_error
+
+ assert (
+ _classify_error("Error 404: Model not found") == "model_not_found"
+ )
+ assert _classify_error("Model llama3 not found") == "model_not_found"
+
+ def test_classify_auth_error(self):
+ """Test classification of authentication errors."""
+ from local_deep_research.mcp.server import _classify_error
+
+ assert _classify_error("Invalid API key") == "auth_error"
+ assert _classify_error("Authentication failed") == "auth_error"
+ assert _classify_error("Unauthorized access") == "auth_error"
+
+ def test_classify_timeout(self):
+ """Test classification of timeout errors."""
+ from local_deep_research.mcp.server import _classify_error
+
+ assert _classify_error("Request timeout") == "timeout"
+ assert _classify_error("Connection timeout after 30s") == "timeout"
+
+ def test_classify_rate_limit(self):
+ """Test classification of rate limit errors."""
+ from local_deep_research.mcp.server import _classify_error
+
+ assert _classify_error("Rate limit exceeded") == "rate_limit"
+
+ def test_classify_unknown(self):
+ """Test classification of unknown errors."""
+ from local_deep_research.mcp.server import _classify_error
+
+ assert _classify_error("Something weird happened") == "unknown"
+
+
+class TestSettingsOverrides:
+ """Tests for settings override building."""
+
+ def test_build_settings_overrides_empty(self):
+ """Test building overrides with no parameters."""
+ from local_deep_research.mcp.server import _build_settings_overrides
+
+ result = _build_settings_overrides()
+ assert result == {}
+
+ def test_build_settings_overrides_all_params(self):
+ """Test building overrides with all parameters."""
+ from local_deep_research.mcp.server import _build_settings_overrides
+
+ result = _build_settings_overrides(
+ search_engine="wikipedia",
+ strategy="rapid",
+ iterations=3,
+ questions_per_iteration=5,
+ temperature=0.5,
+ )
+
+ assert result["search.tool"] == "wikipedia"
+ assert result["search.search_strategy"] == "rapid"
+ assert result["search.iterations"] == 3
+ assert result["search.questions_per_iteration"] == 5
+ assert result["llm.temperature"] == 0.5
+
+ def test_build_settings_overrides_partial(self):
+ """Test building overrides with some parameters."""
+ from local_deep_research.mcp.server import _build_settings_overrides
+
+ result = _build_settings_overrides(search_engine="arxiv", iterations=2)
+
+ assert result["search.tool"] == "arxiv"
+ assert result["search.iterations"] == 2
+ assert "search.search_strategy" not in result
+ assert "llm.temperature" not in result
diff --git a/tests/mcp/test_validation.py b/tests/mcp/test_validation.py
new file mode 100644
index 0000000000..3ed461c139
--- /dev/null
+++ b/tests/mcp/test_validation.py
@@ -0,0 +1,431 @@
+"""
+Tests for MCP server validation functions.
+
+These tests verify input validation for all MCP tool parameters.
+"""
+
+import pytest
+
+# Skip all tests if MCP is not available
+try:
+ import mcp # noqa: F401
+
+ MCP_AVAILABLE = True
+except ImportError:
+ MCP_AVAILABLE = False
+
+pytestmark = pytest.mark.skipif(
+ not MCP_AVAILABLE, reason="MCP package not installed"
+)
+
+
+class TestValidationFunctions:
+ """Tests for parameter validation helper functions."""
+
+ def test_validate_query_valid(self):
+ """Test valid query passes validation."""
+ from local_deep_research.mcp.server import _validate_query
+
+ result = _validate_query("What is quantum computing?")
+ assert result == "What is quantum computing?"
+
+ def test_validate_query_strips_whitespace(self):
+ """Test query is stripped of whitespace."""
+ from local_deep_research.mcp.server import _validate_query
+
+ result = _validate_query(" test query ")
+ assert result == "test query"
+
+ def test_validate_query_empty_raises(self):
+ """Test empty query raises ValidationError."""
+ from local_deep_research.mcp.server import (
+ _validate_query,
+ ValidationError,
+ )
+
+ with pytest.raises(ValidationError, match="cannot be empty"):
+ _validate_query("")
+
+ def test_validate_query_whitespace_only_raises(self):
+ """Test whitespace-only query raises ValidationError."""
+ from local_deep_research.mcp.server import (
+ _validate_query,
+ ValidationError,
+ )
+
+ with pytest.raises(ValidationError, match="cannot be empty"):
+ _validate_query(" ")
+
+ def test_validate_query_too_long_raises(self):
+ """Test query exceeding max length raises ValidationError."""
+ from local_deep_research.mcp.server import (
+ _validate_query,
+ ValidationError,
+ )
+
+ long_query = "x" * 10001
+ with pytest.raises(ValidationError, match="exceeds maximum length"):
+ _validate_query(long_query)
+
+ def test_validate_query_at_max_length(self):
+ """Test query at exactly max length is valid."""
+ from local_deep_research.mcp.server import _validate_query
+
+ max_query = "x" * 10000
+ result = _validate_query(max_query)
+ assert len(result) == 10000
+
+ def test_validate_iterations_valid(self):
+ """Test valid iterations pass validation."""
+ from local_deep_research.mcp.server import _validate_iterations
+
+ assert _validate_iterations(5) == 5
+ assert _validate_iterations(1) == 1
+ assert _validate_iterations(20) == 20
+
+ def test_validate_iterations_none_allowed(self):
+ """Test None iterations returns None."""
+ from local_deep_research.mcp.server import _validate_iterations
+
+ assert _validate_iterations(None) is None
+
+ def test_validate_iterations_zero_raises(self):
+ """Test zero iterations raises ValidationError."""
+ from local_deep_research.mcp.server import (
+ _validate_iterations,
+ ValidationError,
+ )
+
+ with pytest.raises(ValidationError, match="positive integer"):
+ _validate_iterations(0)
+
+ def test_validate_iterations_negative_raises(self):
+ """Test negative iterations raises ValidationError."""
+ from local_deep_research.mcp.server import (
+ _validate_iterations,
+ ValidationError,
+ )
+
+ with pytest.raises(ValidationError, match="positive integer"):
+ _validate_iterations(-5)
+
+ def test_validate_iterations_exceeds_max_raises(self):
+ """Test iterations exceeding max raises ValidationError."""
+ from local_deep_research.mcp.server import (
+ _validate_iterations,
+ ValidationError,
+ )
+
+ with pytest.raises(ValidationError, match="cannot exceed"):
+ _validate_iterations(21, max_val=20)
+
+ def test_validate_iterations_custom_max(self):
+ """Test iterations with custom max value."""
+ from local_deep_research.mcp.server import (
+ _validate_iterations,
+ ValidationError,
+ )
+
+ assert _validate_iterations(5, max_val=10) == 5
+ with pytest.raises(ValidationError, match="cannot exceed 10"):
+ _validate_iterations(11, max_val=10)
+
+ def test_validate_questions_per_iteration_valid(self):
+ """Test valid questions_per_iteration passes validation."""
+ from local_deep_research.mcp.server import (
+ _validate_questions_per_iteration,
+ )
+
+ assert _validate_questions_per_iteration(3) == 3
+ assert _validate_questions_per_iteration(1) == 1
+ assert _validate_questions_per_iteration(10) == 10
+
+ def test_validate_questions_per_iteration_none_allowed(self):
+ """Test None questions_per_iteration returns None."""
+ from local_deep_research.mcp.server import (
+ _validate_questions_per_iteration,
+ )
+
+ assert _validate_questions_per_iteration(None) is None
+
+ def test_validate_questions_per_iteration_zero_raises(self):
+ """Test zero questions_per_iteration raises ValidationError."""
+ from local_deep_research.mcp.server import (
+ _validate_questions_per_iteration,
+ ValidationError,
+ )
+
+ with pytest.raises(ValidationError, match="positive integer"):
+ _validate_questions_per_iteration(0)
+
+ def test_validate_questions_per_iteration_exceeds_max_raises(self):
+ """Test questions_per_iteration exceeding max raises ValidationError."""
+ from local_deep_research.mcp.server import (
+ _validate_questions_per_iteration,
+ ValidationError,
+ )
+
+ with pytest.raises(ValidationError, match="cannot exceed 10"):
+ _validate_questions_per_iteration(11)
+
+ def test_validate_max_results_valid(self):
+ """Test valid max_results passes validation."""
+ from local_deep_research.mcp.server import _validate_max_results
+
+ assert _validate_max_results(10) == 10
+ assert _validate_max_results(1) == 1
+ assert _validate_max_results(100) == 100
+
+ def test_validate_max_results_zero_raises(self):
+ """Test zero max_results raises ValidationError."""
+ from local_deep_research.mcp.server import (
+ _validate_max_results,
+ ValidationError,
+ )
+
+ with pytest.raises(ValidationError, match="positive integer"):
+ _validate_max_results(0)
+
+ def test_validate_max_results_exceeds_max_raises(self):
+ """Test max_results exceeding max raises ValidationError."""
+ from local_deep_research.mcp.server import (
+ _validate_max_results,
+ ValidationError,
+ )
+
+ with pytest.raises(ValidationError, match="cannot exceed 100"):
+ _validate_max_results(101)
+
+ def test_validate_temperature_valid(self):
+ """Test valid temperature passes validation."""
+ from local_deep_research.mcp.server import _validate_temperature
+
+ assert _validate_temperature(0.7) == 0.7
+ assert _validate_temperature(0.0) == 0.0
+ assert _validate_temperature(2.0) == 2.0
+
+ def test_validate_temperature_none_allowed(self):
+ """Test None temperature returns None."""
+ from local_deep_research.mcp.server import _validate_temperature
+
+ assert _validate_temperature(None) is None
+
+ def test_validate_temperature_int_converted_to_float(self):
+ """Test integer temperature is converted to float."""
+ from local_deep_research.mcp.server import _validate_temperature
+
+ result = _validate_temperature(1)
+ assert result == 1.0
+ assert isinstance(result, float)
+
+ def test_validate_temperature_negative_raises(self):
+ """Test negative temperature raises ValidationError."""
+ from local_deep_research.mcp.server import (
+ _validate_temperature,
+ ValidationError,
+ )
+
+ with pytest.raises(ValidationError, match="between 0.0 and 2.0"):
+ _validate_temperature(-0.1)
+
+ def test_validate_temperature_exceeds_max_raises(self):
+ """Test temperature exceeding max raises ValidationError."""
+ from local_deep_research.mcp.server import (
+ _validate_temperature,
+ ValidationError,
+ )
+
+ with pytest.raises(ValidationError, match="between 0.0 and 2.0"):
+ _validate_temperature(2.1)
+
+
+class TestValidationInTools:
+ """Tests for validation being applied in tool functions."""
+
+ def test_quick_research_empty_query_returns_error(self):
+ """Test quick_research with empty query returns validation error."""
+ from local_deep_research.mcp.server import quick_research
+
+ result = quick_research(query="")
+ assert result["status"] == "error"
+ assert result["error_type"] == "validation_error"
+ assert "empty" in result["error"].lower()
+
+ def test_quick_research_invalid_iterations_returns_error(self):
+ """Test quick_research with invalid iterations returns validation error."""
+ from local_deep_research.mcp.server import quick_research
+
+ result = quick_research(query="Test query", iterations=0)
+ assert result["status"] == "error"
+ assert result["error_type"] == "validation_error"
+
+ def test_quick_research_iterations_exceeds_max_returns_error(self):
+ """Test quick_research with iterations exceeding max returns validation error."""
+ from local_deep_research.mcp.server import quick_research
+
+ result = quick_research(query="Test query", iterations=100)
+ assert result["status"] == "error"
+ assert result["error_type"] == "validation_error"
+
+ def test_detailed_research_empty_query_returns_error(self):
+ """Test detailed_research with empty query returns validation error."""
+ from local_deep_research.mcp.server import detailed_research
+
+ result = detailed_research(query=" ")
+ assert result["status"] == "error"
+ assert result["error_type"] == "validation_error"
+
+ def test_generate_report_empty_query_returns_error(self):
+ """Test generate_report with empty query returns validation error."""
+ from local_deep_research.mcp.server import generate_report
+
+ result = generate_report(query="")
+ assert result["status"] == "error"
+ assert result["error_type"] == "validation_error"
+
+ def test_generate_report_invalid_searches_per_section(self):
+ """Test generate_report with invalid searches_per_section returns error."""
+ from local_deep_research.mcp.server import generate_report
+
+ result = generate_report(query="Test query", searches_per_section=0)
+ assert result["status"] == "error"
+ assert result["error_type"] == "validation_error"
+
+ def test_generate_report_searches_per_section_exceeds_max(self):
+ """Test generate_report with searches_per_section exceeding max returns error."""
+ from local_deep_research.mcp.server import generate_report
+
+ result = generate_report(query="Test query", searches_per_section=11)
+ assert result["status"] == "error"
+ assert result["error_type"] == "validation_error"
+
+ def test_analyze_documents_empty_query_returns_error(self):
+ """Test analyze_documents with empty query returns validation error."""
+ from local_deep_research.mcp.server import analyze_documents
+
+ result = analyze_documents(query="", collection_name="test")
+ assert result["status"] == "error"
+ assert result["error_type"] == "validation_error"
+
+ def test_analyze_documents_empty_collection_returns_error(self):
+ """Test analyze_documents with empty collection returns validation error."""
+ from local_deep_research.mcp.server import analyze_documents
+
+ result = analyze_documents(query="Test", collection_name="")
+ assert result["status"] == "error"
+ assert result["error_type"] == "validation_error"
+
+ def test_analyze_documents_invalid_max_results_returns_error(self):
+ """Test analyze_documents with invalid max_results returns error."""
+ from local_deep_research.mcp.server import analyze_documents
+
+ result = analyze_documents(
+ query="Test", collection_name="test", max_results=0
+ )
+ assert result["status"] == "error"
+ assert result["error_type"] == "validation_error"
+
+
+class TestErrorClassification:
+ """Tests for the _classify_error function."""
+
+ def test_classify_service_unavailable(self):
+ """Test 503 error is classified as service_unavailable."""
+ from local_deep_research.mcp.server import _classify_error
+
+ assert (
+ _classify_error("Error 503: Service unavailable")
+ == "service_unavailable"
+ )
+ assert (
+ _classify_error("The server is unavailable")
+ == "service_unavailable"
+ )
+
+ def test_classify_model_not_found(self):
+ """Test 404 error is classified as model_not_found."""
+ from local_deep_research.mcp.server import _classify_error
+
+ assert (
+ _classify_error("Error 404: Model not found") == "model_not_found"
+ )
+ assert _classify_error("Resource not found") == "model_not_found"
+
+ def test_classify_auth_error(self):
+ """Test auth errors are classified correctly."""
+ from local_deep_research.mcp.server import _classify_error
+
+ assert _classify_error("Invalid API key") == "auth_error"
+ assert _classify_error("Authentication failed") == "auth_error"
+ assert _classify_error("Unauthorized access") == "auth_error"
+ assert _classify_error("Error 401: Unauthorized") == "auth_error"
+
+ def test_classify_timeout(self):
+ """Test timeout errors are classified correctly."""
+ from local_deep_research.mcp.server import _classify_error
+
+ assert _classify_error("Request timeout") == "timeout"
+ # "Connection timed out" matches "timed out" check which comes before
+ # the "connection" check, so it returns "timeout"
+ assert _classify_error("Connection timed out") == "timeout"
+ # "Operation timed out" also matches "timed out"
+ assert _classify_error("Operation timed out") == "timeout"
+ assert _classify_error("A timeout occurred") == "timeout"
+
+ def test_classify_rate_limit(self):
+ """Test rate limit errors are classified correctly."""
+ from local_deep_research.mcp.server import _classify_error
+
+ assert _classify_error("Rate limit exceeded") == "rate_limit"
+ assert _classify_error("Error 429: Too many requests") == "rate_limit"
+
+ def test_classify_connection_error(self):
+ """Test connection errors are classified correctly."""
+ from local_deep_research.mcp.server import _classify_error
+
+ assert _classify_error("Connection refused") == "connection_error"
+ assert (
+ _classify_error("Failed to establish connection")
+ == "connection_error"
+ )
+
+ def test_classify_validation_error(self):
+ """Test validation errors are classified correctly."""
+ from local_deep_research.mcp.server import _classify_error
+
+ assert _classify_error("Validation failed") == "validation_error"
+ assert _classify_error("Invalid parameter") == "validation_error"
+
+ def test_classify_unknown_error(self):
+ """Test unknown errors are classified as unknown."""
+ from local_deep_research.mcp.server import _classify_error
+
+ assert _classify_error("Some random error") == "unknown"
+ assert _classify_error("Unexpected exception") == "unknown"
+
+
+class TestGetAvailableStrategies:
+ """Tests for the get_available_strategies function.
+
+ Note: These tests don't require the MCP package as they test the factory module.
+ """
+
+ @pytest.mark.skipif(
+ True, reason="Tested in test_search_system_factory.py instead"
+ )
+ def test_get_available_strategies_returns_list(self):
+ """Test get_available_strategies returns a list."""
+ pass
+
+ def test_list_strategies_uses_get_available_strategies(self):
+ """Test MCP list_strategies tool uses the factory function."""
+ from local_deep_research.mcp.server import list_strategies
+ from local_deep_research.search_system_factory import (
+ get_available_strategies,
+ )
+
+ result = list_strategies()
+ expected = get_available_strategies()
+
+ assert result["status"] == "success"
+ assert result["strategies"] == expected
diff --git a/tests/run_all_tests.py b/tests/run_all_tests.py
index 442ed8e540..c2afb04302 100755
--- a/tests/run_all_tests.py
+++ b/tests/run_all_tests.py
@@ -364,6 +364,7 @@ class TestRunner:
"tests/feature_tests/",
"tests/fix_tests/",
"tests/infrastructure_tests/", # Infrastructure and architecture tests
+ "tests/content_fetcher/", # Content fetcher tests (URL classifier, HTML downloader)
# Critical stability tests - prevent breaking changes
"tests/database/test_encryption_constants.py", # Encryption params MUST NOT change
"tests/database/test_schema_stability.py", # Table names MUST NOT change
diff --git a/tests/test_search_system_factory.py b/tests/test_search_system_factory.py
new file mode 100644
index 0000000000..18e152ee49
--- /dev/null
+++ b/tests/test_search_system_factory.py
@@ -0,0 +1,193 @@
+"""
+Tests for the search_system_factory module.
+
+These tests verify that the strategy registry is consistent with the factory.
+"""
+
+import pytest
+from unittest.mock import MagicMock
+
+
+class TestAvailableStrategies:
+ """Tests for the AVAILABLE_STRATEGIES registry."""
+
+ def test_available_strategies_not_empty(self):
+ """Test AVAILABLE_STRATEGIES is not empty."""
+ from local_deep_research.search_system_factory import (
+ AVAILABLE_STRATEGIES,
+ )
+
+ assert len(AVAILABLE_STRATEGIES) > 0
+
+ def test_available_strategies_has_required_fields(self):
+ """Test each strategy has name and description."""
+ from local_deep_research.search_system_factory import (
+ AVAILABLE_STRATEGIES,
+ )
+
+ for strategy in AVAILABLE_STRATEGIES:
+ assert "name" in strategy, f"Strategy missing 'name': {strategy}"
+ assert "description" in strategy, (
+ f"Strategy missing 'description': {strategy}"
+ )
+ assert len(strategy["name"]) > 0, "Strategy name is empty"
+ assert len(strategy["description"]) > 0, (
+ "Strategy description is empty"
+ )
+
+ def test_get_available_strategies_function(self):
+ """Test get_available_strategies returns correct data."""
+ from local_deep_research.search_system_factory import (
+ get_available_strategies,
+ AVAILABLE_STRATEGIES,
+ )
+
+ result = get_available_strategies()
+ assert result == AVAILABLE_STRATEGIES
+ # Verify it's a copy
+ assert result is not AVAILABLE_STRATEGIES
+
+
+class TestStrategyCreation:
+ """Tests for create_strategy function."""
+
+ @pytest.fixture
+ def mock_model(self):
+ """Create a mock language model."""
+ model = MagicMock()
+ model.invoke = MagicMock(return_value=MagicMock(content="test"))
+ return model
+
+ @pytest.fixture
+ def mock_search(self):
+ """Create a mock search engine."""
+ search = MagicMock()
+ search.run = MagicMock(return_value=[])
+ return search
+
+ def test_create_source_based_strategy(self, mock_model, mock_search):
+ """Test creating source-based strategy."""
+ from local_deep_research.search_system_factory import create_strategy
+
+ strategy = create_strategy("source-based", mock_model, mock_search)
+ assert strategy is not None
+ assert hasattr(strategy, "analyze_topic")
+
+ def test_create_focused_iteration_strategy(self, mock_model, mock_search):
+ """Test creating focused-iteration strategy."""
+ from local_deep_research.search_system_factory import create_strategy
+
+ strategy = create_strategy("focused-iteration", mock_model, mock_search)
+ assert strategy is not None
+
+ def test_create_mcp_strategy(self, mock_model, mock_search):
+ """Test creating MCP strategy."""
+ from local_deep_research.search_system_factory import create_strategy
+
+ strategy = create_strategy("mcp", mock_model, mock_search)
+ assert strategy is not None
+
+ def test_create_rapid_strategy(self, mock_model, mock_search):
+ """Test creating rapid strategy."""
+ from local_deep_research.search_system_factory import create_strategy
+
+ strategy = create_strategy("rapid", mock_model, mock_search)
+ assert strategy is not None
+
+ def test_create_unknown_strategy_defaults_to_source_based(
+ self, mock_model, mock_search
+ ):
+ """Test unknown strategy defaults to source-based."""
+ from local_deep_research.search_system_factory import create_strategy
+
+ strategy = create_strategy("unknown-strategy", mock_model, mock_search)
+ assert strategy is not None
+ # Should be source-based type
+ assert "SourceBasedSearchStrategy" in type(strategy).__name__
+
+ def test_strategy_names_case_insensitive(self, mock_model, mock_search):
+ """Test strategy names are case insensitive."""
+ from local_deep_research.search_system_factory import create_strategy
+
+ strategy1 = create_strategy("SOURCE-BASED", mock_model, mock_search)
+ strategy2 = create_strategy("source-based", mock_model, mock_search)
+
+ assert type(strategy1).__name__ == type(strategy2).__name__
+
+ def test_strategy_names_with_underscores(self, mock_model, mock_search):
+ """Test strategy names work with underscores instead of hyphens."""
+ from local_deep_research.search_system_factory import create_strategy
+
+ strategy1 = create_strategy("source-based", mock_model, mock_search)
+ strategy2 = create_strategy("source_based", mock_model, mock_search)
+
+ assert type(strategy1).__name__ == type(strategy2).__name__
+
+
+class TestStrategyRegistryConsistency:
+ """Tests to verify the strategy registry matches available strategies."""
+
+ @pytest.fixture
+ def mock_model(self):
+ """Create a mock language model."""
+ model = MagicMock()
+ model.invoke = MagicMock(return_value=MagicMock(content="test"))
+ return model
+
+ @pytest.fixture
+ def mock_search(self):
+ """Create a mock search engine."""
+ search = MagicMock()
+ search.run = MagicMock(return_value=[])
+ return search
+
+ def test_all_registered_strategies_can_be_created(
+ self, mock_model, mock_search
+ ):
+ """Test that all strategies in AVAILABLE_STRATEGIES can be created."""
+ from local_deep_research.search_system_factory import (
+ AVAILABLE_STRATEGIES,
+ create_strategy,
+ )
+
+ # Known issues with some strategies (pre-existing bugs)
+ known_issues = {
+ "iterative": "IterativeReasoningStrategy doesn't accept settings_snapshot",
+ }
+
+ for strategy_info in AVAILABLE_STRATEGIES:
+ name = strategy_info["name"]
+ try:
+ strategy = create_strategy(name, mock_model, mock_search)
+ # Should not default to source-based (except for source-based itself)
+ if name != "source-based":
+ # Check it's not just defaulting
+ assert strategy is not None, (
+ f"Strategy '{name}' returned None"
+ )
+ except ImportError as e:
+ # Some strategies may have optional dependencies
+ pytest.skip(f"Strategy '{name}' has missing dependencies: {e}")
+ except TypeError as e:
+ # Known parameter compatibility issues
+ if name in known_issues:
+ pytest.skip(
+ f"Known issue with '{name}': {known_issues[name]}"
+ )
+ else:
+ pytest.fail(f"Failed to create strategy '{name}': {e}")
+ except Exception as e:
+ pytest.fail(f"Failed to create strategy '{name}': {e}")
+
+ def test_no_duplicate_strategy_names(self):
+ """Test there are no duplicate strategy names in the registry."""
+ from local_deep_research.search_system_factory import (
+ AVAILABLE_STRATEGIES,
+ )
+
+ names = [s["name"] for s in AVAILABLE_STRATEGIES]
+ duplicates = [name for name in names if names.count(name) > 1]
+
+ assert len(duplicates) == 0, (
+ f"Duplicate strategy names found: {set(duplicates)}"
+ )
diff --git a/tests/ui_tests/test_socket_initialization.js b/tests/ui_tests/test_socket_initialization.js
new file mode 100644
index 0000000000..c666c56844
--- /dev/null
+++ b/tests/ui_tests/test_socket_initialization.js
@@ -0,0 +1,176 @@
+/**
+ * Socket.IO Initialization Timing Test
+ *
+ * Verifies that Socket.IO does NOT block DOMContentLoaded.
+ * This test was added after a fix for CI test timeouts where Socket.IO
+ * initialization was blocking the 'domcontentloaded' event.
+ *
+ * Background: Socket.IO was causing 30-second navigation timeouts in CI because
+ * it initialized immediately on script load, blocking DOMContentLoaded detection.
+ * Fix: Defer initialization until after DOMContentLoaded fires.
+ *
+ * What this test verifies:
+ * 1. Navigation to various pages completes within the timeout (no blocking)
+ * 2. Navigation time is reasonable (<5 seconds per page)
+ * 3. Where socket console messages are available, verify conditional initialization
+ */
+
+const puppeteer = require('puppeteer');
+const AuthHelper = require('./auth_helper');
+const { getPuppeteerLaunchOptions } = require('./puppeteer_config');
+
+// Short timeout - if Socket.IO blocks DOMContentLoaded, this will fail
+// The original bug caused 30+ second delays; 10 seconds gives ample margin
+const NAVIGATION_TIMEOUT = 10000;
+
+// Warning threshold - navigation should be much faster than this
+const NAVIGATION_WARNING_THRESHOLD = 5000;
+
+// Test pages - mix of pages where socket is/isn't needed
+const TEST_PAGES = [
+ { path: '/', name: 'Home', expectSocket: false },
+ { path: '/settings/', name: 'Settings', expectSocket: false },
+ { path: '/metrics/', name: 'Metrics', expectSocket: false },
+ { path: '/news/', name: 'News', expectSocket: false },
+ { path: '/research', name: 'Research', expectSocket: true },
+];
+
+/**
+ * Simple delay function
+ */
+function delay(ms) {
+ return new Promise(resolve => setTimeout(resolve, ms));
+}
+
+async function runTest() {
+ const baseUrl = process.env.TEST_BASE_URL || 'http://127.0.0.1:5000';
+ let passed = 0;
+ let failed = 0;
+ let warnings = 0;
+
+ console.log('='.repeat(60));
+ console.log('Socket.IO Initialization Timing Test');
+ console.log('='.repeat(60));
+ console.log(`Base URL: ${baseUrl}`);
+ console.log(`Navigation timeout: ${NAVIGATION_TIMEOUT}ms`);
+ console.log(`Warning threshold: ${NAVIGATION_WARNING_THRESHOLD}ms`);
+ console.log(`Environment: ${process.env.CI ? 'CI' : 'Local'}`);
+ console.log('');
+
+ const browser = await puppeteer.launch(getPuppeteerLaunchOptions());
+ const page = await browser.newPage();
+
+ try {
+ // Authenticate
+ console.log('Authenticating...');
+ const auth = new AuthHelper(page, baseUrl);
+ const testUser = process.env.CI
+ ? { username: 'test_admin', password: 'testpass123' }
+ : { username: 'testuser', password: 'T3st!Secure#2024$LDR' };
+ await auth.ensureAuthenticated(testUser.username, testUser.password);
+ console.log('Authentication successful\n');
+
+ for (const testPage of TEST_PAGES) {
+ const url = `${baseUrl}${testPage.path}`;
+ console.log(`Testing: ${testPage.name} (${testPage.path})`);
+
+ // Collect console messages for this page only
+ const consoleMessages = [];
+ const pageErrors = [];
+ const consoleHandler = msg => consoleMessages.push(msg.text());
+ const errorHandler = err => pageErrors.push(err.message);
+
+ page.on('console', consoleHandler);
+ page.on('pageerror', errorHandler);
+
+ try {
+ // Primary test: navigation completes within timeout
+ // This is the main thing we're testing - if Socket.IO blocks
+ // DOMContentLoaded, this navigation will timeout
+ const startTime = Date.now();
+ await page.goto(url, {
+ waitUntil: 'domcontentloaded',
+ timeout: NAVIGATION_TIMEOUT
+ });
+ const navTime = Date.now() - startTime;
+
+ // Test passed if navigation completed
+ console.log(` \u2713 Navigation completed: ${navTime}ms`);
+ passed++;
+
+ // Warn if navigation was slow (but still passed)
+ if (navTime > NAVIGATION_WARNING_THRESHOLD) {
+ console.log(` \u26a0 WARNING: Navigation took ${navTime}ms (threshold: ${NAVIGATION_WARNING_THRESHOLD}ms)`);
+ warnings++;
+ }
+
+ // Wait a bit for any async socket initialization
+ await delay(300);
+
+ // Secondary check: look for socket-related console messages
+ // This helps verify the conditional initialization is working
+ const socketMessages = consoleMessages.filter(m =>
+ m.toLowerCase().includes('socket')
+ );
+
+ if (socketMessages.length > 0) {
+ // Found socket messages - check for expected behavior
+ const notNeededMsg = socketMessages.find(m =>
+ m.includes('not needed on this page')
+ );
+ const initializedMsg = socketMessages.find(m =>
+ m.includes('Socket.IO initialized')
+ );
+
+ if (!testPage.expectSocket && notNeededMsg) {
+ console.log(` \u2713 Socket correctly skipped on ${testPage.name}`);
+ } else if (testPage.expectSocket && initializedMsg) {
+ console.log(` \u2713 Socket correctly initialized on ${testPage.name}`);
+ } else if (testPage.expectSocket && !initializedMsg) {
+ // Research page didn't show initialization message
+ // This might be due to SafeLogger not being available yet
+ console.log(` \u2139 Socket initialization message not captured`);
+ }
+ }
+
+ // Note any page errors (informational only)
+ if (pageErrors.length > 0) {
+ console.log(` \u2139 Page errors: ${pageErrors.join(', ').substring(0, 100)}`);
+ }
+
+ } catch (error) {
+ console.log(` \u2717 Navigation FAILED: ${error.message}`);
+ if (error.message.includes('timeout')) {
+ console.log(' *** Socket.IO may be blocking DOMContentLoaded ***');
+ }
+ failed++;
+ } finally {
+ page.off('console', consoleHandler);
+ page.off('pageerror', errorHandler);
+ }
+
+ console.log('');
+ }
+
+ } finally {
+ await browser.close();
+ }
+
+ console.log('='.repeat(60));
+ console.log(`Results: ${passed} passed, ${failed} failed, ${warnings} warnings`);
+ console.log('');
+ if (failed === 0) {
+ console.log('SUCCESS: DOMContentLoaded is not blocked by Socket.IO');
+ } else {
+ console.log('FAILURE: Some pages failed to load within timeout');
+ console.log('This may indicate Socket.IO is blocking DOMContentLoaded');
+ }
+ console.log('='.repeat(60));
+
+ process.exit(failed > 0 ? 1 : 0);
+}
+
+runTest().catch(err => {
+ console.error('Test error:', err);
+ process.exit(1);
+});