deepcode-hku 1.0.3__tar.gz → 1.0.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. {deepcode_hku-1.0.3/deepcode_hku.egg-info → deepcode_hku-1.0.5}/PKG-INFO +136 -22
  2. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/README.md +135 -21
  3. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/__init__.py +1 -1
  4. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/cli/cli_app.py +4 -0
  5. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/cli/cli_interface.py +105 -3
  6. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/cli/main_cli.py +40 -5
  7. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/deepcode.py +74 -1
  8. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5/deepcode_hku.egg-info}/PKG-INFO +136 -22
  9. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/deepcode_hku.egg-info/SOURCES.txt +6 -1
  10. deepcode_hku-1.0.5/mcp_agent.config.yaml +91 -0
  11. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/mcp_agent.secrets.yaml +1 -0
  12. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/prompts/code_prompts.py +833 -265
  13. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/tools/code_implementation_server.py +517 -45
  14. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/tools/code_indexer.py +1 -39
  15. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/tools/code_reference_indexer.py +12 -3
  16. deepcode_hku-1.0.5/tools/document_segmentation_server.py +1937 -0
  17. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/tools/pdf_downloader.py +11 -1
  18. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/ui/components.py +526 -349
  19. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/ui/handlers.py +221 -0
  20. deepcode_hku-1.0.5/ui/layout.py +161 -0
  21. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/ui/styles.py +1486 -87
  22. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/utils/file_processor.py +12 -0
  23. deepcode_hku-1.0.5/utils/llm_utils.py +231 -0
  24. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/workflows/agent_orchestration_engine.py +496 -52
  25. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/workflows/agents/__init__.py +0 -1
  26. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/workflows/agents/code_implementation_agent.py +108 -83
  27. deepcode_hku-1.0.5/workflows/agents/document_segmentation_agent.py +353 -0
  28. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/workflows/agents/memory_agent_concise.py +611 -45
  29. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/workflows/agents/memory_agent_concise_index.py +627 -71
  30. deepcode_hku-1.0.5/workflows/agents/memory_agent_concise_multi.py +1659 -0
  31. deepcode_hku-1.0.5/workflows/agents/requirement_analysis_agent.py +410 -0
  32. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/workflows/code_implementation_workflow.py +153 -86
  33. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/workflows/code_implementation_workflow_index.py +159 -93
  34. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/workflows/codebase_index_workflow.py +134 -128
  35. deepcode_hku-1.0.3/mcp_agent.config.yaml +0 -84
  36. deepcode_hku-1.0.3/ui/layout.py +0 -106
  37. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/.pre-commit-config.yaml +0 -0
  38. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/LICENSE +0 -0
  39. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/MANIFEST.in +0 -0
  40. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/cli/__init__.py +0 -0
  41. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/cli/cli_launcher.py +0 -0
  42. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/cli/workflows/__init__.py +0 -0
  43. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/cli/workflows/cli_workflow_adapter.py +0 -0
  44. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/deepcode_hku.egg-info/dependency_links.txt +0 -0
  45. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/deepcode_hku.egg-info/entry_points.txt +0 -0
  46. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/deepcode_hku.egg-info/requires.txt +0 -0
  47. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/deepcode_hku.egg-info/top_level.txt +0 -0
  48. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/requirements.txt +0 -0
  49. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/schema/mcp-agent.config.schema.json +0 -0
  50. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/setup.cfg +0 -0
  51. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/setup.py +0 -0
  52. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/tools/__init__.py +0 -0
  53. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/tools/bocha_search_server.py +0 -0
  54. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/tools/command_executor.py +0 -0
  55. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/tools/git_command.py +0 -0
  56. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/tools/pdf_converter.py +0 -0
  57. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/tools/pdf_utils.py +0 -0
  58. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/ui/__init__.py +0 -0
  59. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/ui/app.py +0 -0
  60. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/ui/streamlit_app.py +0 -0
  61. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/utils/__init__.py +0 -0
  62. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/utils/cli_interface.py +0 -0
  63. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/utils/dialogue_logger.py +0 -0
  64. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/utils/simple_llm_logger.py +0 -0
  65. {deepcode_hku-1.0.3 → deepcode_hku-1.0.5}/workflows/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deepcode-hku
3
- Version: 1.0.3
3
+ Version: 1.0.5
4
4
  Summary: AI Research Engine - Transform research papers into working code automatically
5
5
  Home-page: https://github.com/HKUDS/DeepCode
6
6
  Author: DeepCodeTeam
@@ -60,6 +60,10 @@ Dynamic: summary
60
60
  </tr>
61
61
  </table>
62
62
 
63
+ <div align="center">
64
+ <a href="https://trendshift.io/repositories/14665" target="_blank"><img src="https://trendshift.io/api/badge/repositories/14665" alt="HKUDS%2FDeepCode | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
65
+ </div>
66
+
63
67
  <!-- <img src="https://readme-typing-svg.herokuapp.com?font=Russo+One&size=28&duration=2000&pause=800&color=06B6D4&background=00000000&center=true&vCenter=true&width=800&height=50&lines=%E2%9A%A1+OPEN+AGENTIC+CODING+%E2%9A%A1" alt="DeepCode Tech Subtitle" style="margin-top: 5px; filter: drop-shadow(0 0 12px #06B6D4) drop-shadow(0 0 24px rgba(6,182,212,0.4));"/> -->
64
68
 
65
69
  # <img src="https://github.com/Zongwei9888/Experiment_Images/raw/43c585dca3d21b8e4b6390d835cdd34dc4b4b23d/DeepCode_images/title_logo.svg" alt="DeepCode Logo" width="32" height="32" style="vertical-align: middle; margin-right: 8px;"/> DeepCode: Open Agentic Coding
@@ -135,6 +139,32 @@ Dynamic: summary
135
139
  </tr>
136
140
  </table>
137
141
 
142
+ ---
143
+
144
+ <div align="center">
145
+
146
+ ### 🎬 **Introduction Video**
147
+
148
+ <div style="margin: 20px 0;">
149
+ <a href="https://youtu.be/PRgmP8pOI08" target="_blank">
150
+ <img src="https://img.youtube.com/vi/PRgmP8pOI08/maxresdefault.jpg"
151
+ alt="DeepCode Introduction Video"
152
+ width="75%"
153
+ style="border-radius: 12px; box-shadow: 0 8px 25px rgba(0,0,0,0.15); transition: transform 0.3s ease;"/>
154
+ </a>
155
+ </div>
156
+
157
+ *🎯 **Watch our complete introduction** - See how DeepCode transforms research papers and natural language into production-ready code*
158
+
159
+ <p>
160
+ <a href="https://youtu.be/PRgmP8pOI08" target="_blank">
161
+ <img src="https://img.shields.io/badge/▶️_Watch_Video-FF0000?style=for-the-badge&logo=youtube&logoColor=white" alt="Watch Video"/>
162
+ </a>
163
+ </p>
164
+
165
+ </div>
166
+
167
+ ---
138
168
 
139
169
 
140
170
 
@@ -316,21 +346,35 @@ Advanced retrieval-augmented generation combining semantic vector embeddings wit
316
346
 
317
347
  #### 🛠️ **Implementation Tools Matrix**
318
348
 
319
- | 🛠️ Tool | 🔧 Function | 💡 Purpose |
320
- |----------|-------------|------------|
321
- | **📄 read_code_mem** | Read code summary from memory | Efficient code context retrieval |
322
- | **✍️ write_file** | Write file contents | Code file generation |
323
- | **🐍 execute_python** | Execute Python code | Code testing and validation |
324
- | **⚡ execute_bash** | Execute bash commands | Environment setup and package management |
325
- | **🔗 search_code_reference** | Search GitHub repositories | Automated CodeRAG and repository discovery |
326
- | **📁 get_file_structure** | Get directory structure | Project organization |
327
- | **⚙️ set_workspace** | Set working directory | Environment configuration |
328
- | **📊 get_operation_history** | Track operations | Process monitoring |
329
- | **🔍 brave** | Web search via Brave API | Real-time information retrieval |
330
- | **📂 filesystem** | File system operations | File and directory management |
331
- | **🌐 fetch** | Fetch content from URLs | Web content extraction |
332
- | **📥 github-downloader** | Download GitHub repositories | Repository content acquisition |
333
- | **📋 file-downloader** | Download files and PDFs | Document processing |
349
+ **🔧 Powered by MCP (Model Context Protocol)**
350
+
351
+ DeepCode leverages the **Model Context Protocol (MCP)** standard to seamlessly integrate with various tools and services. This standardized approach ensures reliable communication between AI agents and external systems, enabling powerful automation capabilities.
352
+
353
+ ##### 📡 **MCP Servers & Tools**
354
+
355
+ | 🛠️ **MCP Server** | 🔧 **Primary Function** | 💡 **Purpose & Capabilities** |
356
+ |-------------------|-------------------------|-------------------------------|
357
+ | **🔍 brave** | Web Search Engine | Real-time information retrieval via Brave Search API |
358
+ | **🌐 bocha-mcp** | Alternative Search | Secondary search option with independent API access |
359
+ | **📂 filesystem** | File System Operations | Local file and directory management, read/write operations |
360
+ | **🌐 fetch** | Web Content Retrieval | Fetch and extract content from URLs and web resources |
361
+ | **📥 github-downloader** | Repository Management | Clone and download GitHub repositories for analysis |
362
+ | **📋 file-downloader** | Document Processing | Download and convert files (PDF, DOCX, etc.) to Markdown |
363
+ | **⚡ command-executor** | System Commands | Execute bash/shell commands for environment management |
364
+ | **🧬 code-implementation** | Code Generation Hub | Comprehensive code reproduction with execution and testing |
365
+ | **📚 code-reference-indexer** | Smart Code Search | Intelligent indexing and search of code repositories |
366
+ | **📄 document-segmentation** | Smart Document Analysis | Intelligent document segmentation for large papers and technical documents |
367
+
368
+ ##### 🔧 **Legacy Tool Functions** *(for reference)*
369
+
370
+ | 🛠️ **Function** | 🎯 **Usage Context** |
371
+ |-----------------|---------------------|
372
+ | **📄 read_code_mem** | Efficient code context retrieval from memory |
373
+ | **✍️ write_file** | Direct file content generation and modification |
374
+ | **🐍 execute_python** | Python code testing and validation |
375
+ | **📁 get_file_structure** | Project structure analysis and organization |
376
+ | **⚙️ set_workspace** | Dynamic workspace and environment configuration |
377
+ | **📊 get_operation_history** | Process monitoring and operation tracking |
334
378
 
335
379
 
336
380
  ---
@@ -466,8 +510,15 @@ curl -O https://raw.githubusercontent.com/HKUDS/DeepCode/main/mcp_agent.secrets.
466
510
  # - openai: api_key, base_url (for OpenAI/custom endpoints)
467
511
  # - anthropic: api_key (for Claude models)
468
512
 
469
- # 🔑 Configure BRAVE_API_KEY for web search (optional)
470
- # Edit mcp_agent.config.yaml and update BRAVE_API_KEY under brave.env section
513
+ # 🔑 Configure search API keys for web search (optional)
514
+ # Edit mcp_agent.config.yaml to set your API keys:
515
+ # - For Brave Search: Set BRAVE_API_KEY: "your_key_here" in brave.env section (line ~28)
516
+ # - For Bocha-MCP: Set BOCHA_API_KEY: "your_key_here" in bocha-mcp.env section (line ~74)
517
+
518
+ # 📄 Configure document segmentation (optional)
519
+ # Edit mcp_agent.config.yaml to control document processing:
520
+ # - enabled: true/false (whether to use intelligent document segmentation)
521
+ # - size_threshold_chars: 50000 (document size threshold to trigger segmentation)
471
522
  ```
472
523
 
473
524
  #### 🔧 **Development Installation (From Source)**
@@ -495,8 +546,15 @@ uv pip install -r requirements.txt
495
546
  # - openai: api_key, base_url (for OpenAI/custom endpoints)
496
547
  # - anthropic: api_key (for Claude models)
497
548
 
498
- # 🔑 Configure BRAVE_API_KEY for web search (optional)
499
- # Edit mcp_agent.config.yaml and update BRAVE_API_KEY under brave.env section
549
+ # 🔑 Configure search API keys for web search (optional)
550
+ # Edit mcp_agent.config.yaml to set your API keys:
551
+ # - For Brave Search: Set BRAVE_API_KEY: "your_key_here" in brave.env section (line ~28)
552
+ # - For Bocha-MCP: Set BOCHA_API_KEY: "your_key_here" in bocha-mcp.env section (line ~74)
553
+
554
+ # 📄 Configure document segmentation (optional)
555
+ # Edit mcp_agent.config.yaml to control document processing:
556
+ # - enabled: true/false (whether to use intelligent document segmentation)
557
+ # - size_threshold_chars: 50000 (document size threshold to trigger segmentation)
500
558
  ```
501
559
 
502
560
  ##### 🐍 **Using Traditional pip**
@@ -514,8 +572,15 @@ pip install -r requirements.txt
514
572
  # - openai: api_key, base_url (for OpenAI/custom endpoints)
515
573
  # - anthropic: api_key (for Claude models)
516
574
 
517
- # 🔑 Configure BRAVE_API_KEY for web search (optional)
518
- # Edit mcp_agent.config.yaml and update BRAVE_API_KEY under brave.env section
575
+ # 🔑 Configure search API keys for web search (optional)
576
+ # Edit mcp_agent.config.yaml to set your API keys:
577
+ # - For Brave Search: Set BRAVE_API_KEY: "your_key_here" in brave.env section (line ~28)
578
+ # - For Bocha-MCP: Set BOCHA_API_KEY: "your_key_here" in bocha-mcp.env section (line ~74)
579
+
580
+ # 📄 Configure document segmentation (optional)
581
+ # Edit mcp_agent.config.yaml to control document processing:
582
+ # - enabled: true/false (whether to use intelligent document segmentation)
583
+ # - size_threshold_chars: 50000 (document size threshold to trigger segmentation)
519
584
  ```
520
585
 
521
586
  </details>
@@ -548,6 +613,47 @@ mcp:
548
613
 
549
614
  > **Note**: Replace the path with your actual global node_modules path from step 2.
550
615
 
616
+ #### 🔍 **Search Server Configuration (Optional)**
617
+
618
+ DeepCode supports multiple search servers for web search functionality. You can configure your preferred option in `mcp_agent.config.yaml`:
619
+
620
+ ```yaml
621
+ # Default search server configuration
622
+ # Options: "brave" or "bocha-mcp"
623
+ default_search_server: "brave"
624
+ ```
625
+
626
+ **Available Options:**
627
+ - **🔍 Brave Search** (`"brave"`):
628
+ - Default option with high-quality search results
629
+ - Requires BRAVE_API_KEY configuration
630
+ - Recommended for most users
631
+
632
+ - **🌐 Bocha-MCP** (`"bocha-mcp"`):
633
+ - Alternative search server option
634
+ - Requires BOCHA_API_KEY configuration
635
+ - Uses local Python server implementation
636
+
637
+ **API Key Configuration in mcp_agent.config.yaml:**
638
+ ```yaml
639
+ # For Brave Search (default) - around line 28
640
+ brave:
641
+ command: "npx"
642
+ args: ["-y", "@modelcontextprotocol/server-brave-search"]
643
+ env:
644
+ BRAVE_API_KEY: "your_brave_api_key_here"
645
+
646
+ # For Bocha-MCP (alternative) - around line 74
647
+ bocha-mcp:
648
+ command: "python"
649
+ args: ["tools/bocha_search_server.py"]
650
+ env:
651
+ PYTHONPATH: "."
652
+ BOCHA_API_KEY: "your_bocha_api_key_here"
653
+ ```
654
+
655
+ > **💡 Tip**: Both search servers require API key configuration. Choose the one that best fits your API access and requirements.
656
+
551
657
  ### ⚡ **Step 2: Launch Application**
552
658
 
553
659
  #### 🚀 **Using Installed Package (Recommended)**
@@ -657,6 +763,14 @@ python cli/main_cli.py
657
763
 
658
764
 
659
765
 
766
+ ### 🆕 **Recent Updates**
767
+
768
+ #### 📄 **Smart Document Segmentation (v1.2.0)**
769
+ - **Intelligent Processing**: Automatically handles large research papers and technical documents that exceed LLM token limits
770
+ - **Configurable Control**: Toggle segmentation via configuration with size-based thresholds
771
+ - **Semantic Analysis**: Advanced content understanding with algorithm, concept, and formula preservation
772
+ - **Backward Compatibility**: Seamlessly falls back to traditional processing for smaller documents
773
+
660
774
  ### 🚀 **Coming Soon**
661
775
 
662
776
  We're continuously enhancing DeepCode with exciting new features:
@@ -16,6 +16,10 @@
16
16
  </tr>
17
17
  </table>
18
18
 
19
+ <div align="center">
20
+ <a href="https://trendshift.io/repositories/14665" target="_blank"><img src="https://trendshift.io/api/badge/repositories/14665" alt="HKUDS%2FDeepCode | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
21
+ </div>
22
+
19
23
  <!-- <img src="https://readme-typing-svg.herokuapp.com?font=Russo+One&size=28&duration=2000&pause=800&color=06B6D4&background=00000000&center=true&vCenter=true&width=800&height=50&lines=%E2%9A%A1+OPEN+AGENTIC+CODING+%E2%9A%A1" alt="DeepCode Tech Subtitle" style="margin-top: 5px; filter: drop-shadow(0 0 12px #06B6D4) drop-shadow(0 0 24px rgba(6,182,212,0.4));"/> -->
20
24
 
21
25
  # <img src="https://github.com/Zongwei9888/Experiment_Images/raw/43c585dca3d21b8e4b6390d835cdd34dc4b4b23d/DeepCode_images/title_logo.svg" alt="DeepCode Logo" width="32" height="32" style="vertical-align: middle; margin-right: 8px;"/> DeepCode: Open Agentic Coding
@@ -91,6 +95,32 @@
91
95
  </tr>
92
96
  </table>
93
97
 
98
+ ---
99
+
100
+ <div align="center">
101
+
102
+ ### 🎬 **Introduction Video**
103
+
104
+ <div style="margin: 20px 0;">
105
+ <a href="https://youtu.be/PRgmP8pOI08" target="_blank">
106
+ <img src="https://img.youtube.com/vi/PRgmP8pOI08/maxresdefault.jpg"
107
+ alt="DeepCode Introduction Video"
108
+ width="75%"
109
+ style="border-radius: 12px; box-shadow: 0 8px 25px rgba(0,0,0,0.15); transition: transform 0.3s ease;"/>
110
+ </a>
111
+ </div>
112
+
113
+ *🎯 **Watch our complete introduction** - See how DeepCode transforms research papers and natural language into production-ready code*
114
+
115
+ <p>
116
+ <a href="https://youtu.be/PRgmP8pOI08" target="_blank">
117
+ <img src="https://img.shields.io/badge/▶️_Watch_Video-FF0000?style=for-the-badge&logo=youtube&logoColor=white" alt="Watch Video"/>
118
+ </a>
119
+ </p>
120
+
121
+ </div>
122
+
123
+ ---
94
124
 
95
125
 
96
126
 
@@ -272,21 +302,35 @@ Advanced retrieval-augmented generation combining semantic vector embeddings wit
272
302
 
273
303
  #### 🛠️ **Implementation Tools Matrix**
274
304
 
275
- | 🛠️ Tool | 🔧 Function | 💡 Purpose |
276
- |----------|-------------|------------|
277
- | **📄 read_code_mem** | Read code summary from memory | Efficient code context retrieval |
278
- | **✍️ write_file** | Write file contents | Code file generation |
279
- | **🐍 execute_python** | Execute Python code | Code testing and validation |
280
- | **⚡ execute_bash** | Execute bash commands | Environment setup and package management |
281
- | **🔗 search_code_reference** | Search GitHub repositories | Automated CodeRAG and repository discovery |
282
- | **📁 get_file_structure** | Get directory structure | Project organization |
283
- | **⚙️ set_workspace** | Set working directory | Environment configuration |
284
- | **📊 get_operation_history** | Track operations | Process monitoring |
285
- | **🔍 brave** | Web search via Brave API | Real-time information retrieval |
286
- | **📂 filesystem** | File system operations | File and directory management |
287
- | **🌐 fetch** | Fetch content from URLs | Web content extraction |
288
- | **📥 github-downloader** | Download GitHub repositories | Repository content acquisition |
289
- | **📋 file-downloader** | Download files and PDFs | Document processing |
305
+ **🔧 Powered by MCP (Model Context Protocol)**
306
+
307
+ DeepCode leverages the **Model Context Protocol (MCP)** standard to seamlessly integrate with various tools and services. This standardized approach ensures reliable communication between AI agents and external systems, enabling powerful automation capabilities.
308
+
309
+ ##### 📡 **MCP Servers & Tools**
310
+
311
+ | 🛠️ **MCP Server** | 🔧 **Primary Function** | 💡 **Purpose & Capabilities** |
312
+ |-------------------|-------------------------|-------------------------------|
313
+ | **🔍 brave** | Web Search Engine | Real-time information retrieval via Brave Search API |
314
+ | **🌐 bocha-mcp** | Alternative Search | Secondary search option with independent API access |
315
+ | **📂 filesystem** | File System Operations | Local file and directory management, read/write operations |
316
+ | **🌐 fetch** | Web Content Retrieval | Fetch and extract content from URLs and web resources |
317
+ | **📥 github-downloader** | Repository Management | Clone and download GitHub repositories for analysis |
318
+ | **📋 file-downloader** | Document Processing | Download and convert files (PDF, DOCX, etc.) to Markdown |
319
+ | **⚡ command-executor** | System Commands | Execute bash/shell commands for environment management |
320
+ | **🧬 code-implementation** | Code Generation Hub | Comprehensive code reproduction with execution and testing |
321
+ | **📚 code-reference-indexer** | Smart Code Search | Intelligent indexing and search of code repositories |
322
+ | **📄 document-segmentation** | Smart Document Analysis | Intelligent document segmentation for large papers and technical documents |
323
+
324
+ ##### 🔧 **Legacy Tool Functions** *(for reference)*
325
+
326
+ | 🛠️ **Function** | 🎯 **Usage Context** |
327
+ |-----------------|---------------------|
328
+ | **📄 read_code_mem** | Efficient code context retrieval from memory |
329
+ | **✍️ write_file** | Direct file content generation and modification |
330
+ | **🐍 execute_python** | Python code testing and validation |
331
+ | **📁 get_file_structure** | Project structure analysis and organization |
332
+ | **⚙️ set_workspace** | Dynamic workspace and environment configuration |
333
+ | **📊 get_operation_history** | Process monitoring and operation tracking |
290
334
 
291
335
 
292
336
  ---
@@ -422,8 +466,15 @@ curl -O https://raw.githubusercontent.com/HKUDS/DeepCode/main/mcp_agent.secrets.
422
466
  # - openai: api_key, base_url (for OpenAI/custom endpoints)
423
467
  # - anthropic: api_key (for Claude models)
424
468
 
425
- # 🔑 Configure BRAVE_API_KEY for web search (optional)
426
- # Edit mcp_agent.config.yaml and update BRAVE_API_KEY under brave.env section
469
+ # 🔑 Configure search API keys for web search (optional)
470
+ # Edit mcp_agent.config.yaml to set your API keys:
471
+ # - For Brave Search: Set BRAVE_API_KEY: "your_key_here" in brave.env section (line ~28)
472
+ # - For Bocha-MCP: Set BOCHA_API_KEY: "your_key_here" in bocha-mcp.env section (line ~74)
473
+
474
+ # 📄 Configure document segmentation (optional)
475
+ # Edit mcp_agent.config.yaml to control document processing:
476
+ # - enabled: true/false (whether to use intelligent document segmentation)
477
+ # - size_threshold_chars: 50000 (document size threshold to trigger segmentation)
427
478
  ```
428
479
 
429
480
  #### 🔧 **Development Installation (From Source)**
@@ -451,8 +502,15 @@ uv pip install -r requirements.txt
451
502
  # - openai: api_key, base_url (for OpenAI/custom endpoints)
452
503
  # - anthropic: api_key (for Claude models)
453
504
 
454
- # 🔑 Configure BRAVE_API_KEY for web search (optional)
455
- # Edit mcp_agent.config.yaml and update BRAVE_API_KEY under brave.env section
505
+ # 🔑 Configure search API keys for web search (optional)
506
+ # Edit mcp_agent.config.yaml to set your API keys:
507
+ # - For Brave Search: Set BRAVE_API_KEY: "your_key_here" in brave.env section (line ~28)
508
+ # - For Bocha-MCP: Set BOCHA_API_KEY: "your_key_here" in bocha-mcp.env section (line ~74)
509
+
510
+ # 📄 Configure document segmentation (optional)
511
+ # Edit mcp_agent.config.yaml to control document processing:
512
+ # - enabled: true/false (whether to use intelligent document segmentation)
513
+ # - size_threshold_chars: 50000 (document size threshold to trigger segmentation)
456
514
  ```
457
515
 
458
516
  ##### 🐍 **Using Traditional pip**
@@ -470,8 +528,15 @@ pip install -r requirements.txt
470
528
  # - openai: api_key, base_url (for OpenAI/custom endpoints)
471
529
  # - anthropic: api_key (for Claude models)
472
530
 
473
- # 🔑 Configure BRAVE_API_KEY for web search (optional)
474
- # Edit mcp_agent.config.yaml and update BRAVE_API_KEY under brave.env section
531
+ # 🔑 Configure search API keys for web search (optional)
532
+ # Edit mcp_agent.config.yaml to set your API keys:
533
+ # - For Brave Search: Set BRAVE_API_KEY: "your_key_here" in brave.env section (line ~28)
534
+ # - For Bocha-MCP: Set BOCHA_API_KEY: "your_key_here" in bocha-mcp.env section (line ~74)
535
+
536
+ # 📄 Configure document segmentation (optional)
537
+ # Edit mcp_agent.config.yaml to control document processing:
538
+ # - enabled: true/false (whether to use intelligent document segmentation)
539
+ # - size_threshold_chars: 50000 (document size threshold to trigger segmentation)
475
540
  ```
476
541
 
477
542
  </details>
@@ -504,6 +569,47 @@ mcp:
504
569
 
505
570
  > **Note**: Replace the path with your actual global node_modules path from step 2.
506
571
 
572
+ #### 🔍 **Search Server Configuration (Optional)**
573
+
574
+ DeepCode supports multiple search servers for web search functionality. You can configure your preferred option in `mcp_agent.config.yaml`:
575
+
576
+ ```yaml
577
+ # Default search server configuration
578
+ # Options: "brave" or "bocha-mcp"
579
+ default_search_server: "brave"
580
+ ```
581
+
582
+ **Available Options:**
583
+ - **🔍 Brave Search** (`"brave"`):
584
+ - Default option with high-quality search results
585
+ - Requires BRAVE_API_KEY configuration
586
+ - Recommended for most users
587
+
588
+ - **🌐 Bocha-MCP** (`"bocha-mcp"`):
589
+ - Alternative search server option
590
+ - Requires BOCHA_API_KEY configuration
591
+ - Uses local Python server implementation
592
+
593
+ **API Key Configuration in mcp_agent.config.yaml:**
594
+ ```yaml
595
+ # For Brave Search (default) - around line 28
596
+ brave:
597
+ command: "npx"
598
+ args: ["-y", "@modelcontextprotocol/server-brave-search"]
599
+ env:
600
+ BRAVE_API_KEY: "your_brave_api_key_here"
601
+
602
+ # For Bocha-MCP (alternative) - around line 74
603
+ bocha-mcp:
604
+ command: "python"
605
+ args: ["tools/bocha_search_server.py"]
606
+ env:
607
+ PYTHONPATH: "."
608
+ BOCHA_API_KEY: "your_bocha_api_key_here"
609
+ ```
610
+
611
+ > **💡 Tip**: Both search servers require API key configuration. Choose the one that best fits your API access and requirements.
612
+
507
613
  ### ⚡ **Step 2: Launch Application**
508
614
 
509
615
  #### 🚀 **Using Installed Package (Recommended)**
@@ -613,6 +719,14 @@ python cli/main_cli.py
613
719
 
614
720
 
615
721
 
722
+ ### 🆕 **Recent Updates**
723
+
724
+ #### 📄 **Smart Document Segmentation (v1.2.0)**
725
+ - **Intelligent Processing**: Automatically handles large research papers and technical documents that exceed LLM token limits
726
+ - **Configurable Control**: Toggle segmentation via configuration with size-based thresholds
727
+ - **Semantic Analysis**: Advanced content understanding with algorithm, concept, and formula preservation
728
+ - **Backward Compatibility**: Seamlessly falls back to traditional processing for smaller documents
729
+
616
730
  ### 🚀 **Coming Soon**
617
731
 
618
732
  We're continuously enhancing DeepCode with exciting new features:
@@ -5,7 +5,7 @@ DeepCode - AI Research Engine
5
5
  ⚡ Transform research papers into working code automatically
6
6
  """
7
7
 
8
- __version__ = "1.0.3"
8
+ __version__ = "1.0.5"
9
9
  __author__ = "DeepCode Team"
10
10
  __url__ = "https://github.com/HKUDS/DeepCode"
11
11
 
@@ -37,6 +37,7 @@ class CLIApp:
37
37
  self.app = None # Will be initialized by workflow adapter
38
38
  self.logger = None
39
39
  self.context = None
40
+ # Document segmentation will be managed by CLI interface
40
41
 
41
42
  async def initialize_mcp_app(self):
42
43
  """初始化MCP应用 - 使用工作流适配器"""
@@ -50,6 +51,8 @@ class CLIApp:
50
51
  async def process_input(self, input_source: str, input_type: str):
51
52
  """处理输入源(URL或文件)- 使用升级版智能体编排引擎"""
52
53
  try:
54
+ # Document segmentation configuration is managed by CLI interface
55
+
53
56
  self.cli.print_separator()
54
57
  self.cli.print_status(
55
58
  "🚀 Starting intelligent agent orchestration...", "processing"
@@ -237,6 +240,7 @@ class CLIApp:
237
240
  self.cli.show_history()
238
241
 
239
242
  elif choice in ["c", "config", "configure"]:
243
+ # Show configuration menu - all settings managed by CLI interface
240
244
  self.cli.show_configuration_menu()
241
245
 
242
246
  else:
@@ -41,6 +41,66 @@ class CLIInterface:
41
41
  self.processing_history = []
42
42
  self.enable_indexing = True # Default configuration
43
43
 
44
+ # Load segmentation config from the same source as UI
45
+ self._load_segmentation_config()
46
+
47
+ # Initialize tkinter availability
48
+ self._init_tkinter()
49
+
50
+ def _load_segmentation_config(self):
51
+ """Load segmentation configuration from mcp_agent.config.yaml"""
52
+ try:
53
+ from utils.llm_utils import get_document_segmentation_config
54
+
55
+ seg_config = get_document_segmentation_config()
56
+ self.segmentation_enabled = seg_config.get("enabled", True)
57
+ self.segmentation_threshold = seg_config.get("size_threshold_chars", 50000)
58
+ except Exception as e:
59
+ print(f"⚠️ Warning: Failed to load segmentation config: {e}")
60
+ # Fall back to defaults
61
+ self.segmentation_enabled = True
62
+ self.segmentation_threshold = 50000
63
+
64
+ def _save_segmentation_config(self):
65
+ """Save segmentation configuration to mcp_agent.config.yaml"""
66
+ import yaml
67
+ import os
68
+
69
+ # Get the project root directory (where mcp_agent.config.yaml is located)
70
+ current_file = os.path.abspath(__file__)
71
+ cli_dir = os.path.dirname(current_file) # cli directory
72
+ project_root = os.path.dirname(cli_dir) # project root
73
+ config_path = os.path.join(project_root, "mcp_agent.config.yaml")
74
+
75
+ try:
76
+ # Read current config
77
+ with open(config_path, "r", encoding="utf-8") as f:
78
+ config = yaml.safe_load(f)
79
+
80
+ # Update document segmentation settings
81
+ if "document_segmentation" not in config:
82
+ config["document_segmentation"] = {}
83
+
84
+ config["document_segmentation"]["enabled"] = self.segmentation_enabled
85
+ config["document_segmentation"]["size_threshold_chars"] = (
86
+ self.segmentation_threshold
87
+ )
88
+
89
+ # Write updated config
90
+ with open(config_path, "w", encoding="utf-8") as f:
91
+ yaml.dump(config, f, default_flow_style=False, allow_unicode=True)
92
+
93
+ print(
94
+ f"{Colors.OKGREEN}✅ Document segmentation configuration updated{Colors.ENDC}"
95
+ )
96
+
97
+ except Exception as e:
98
+ print(
99
+ f"{Colors.WARNING}⚠️ Failed to update segmentation config: {str(e)}{Colors.ENDC}"
100
+ )
101
+
102
+ def _init_tkinter(self):
103
+ """Initialize tkinter availability check"""
44
104
  # Check tkinter availability for file dialogs
45
105
  self.tkinter_available = True
46
106
  try:
@@ -125,6 +185,9 @@ class CLIInterface:
125
185
  # Display current configuration
126
186
  pipeline_mode = "🧠 COMPREHENSIVE" if self.enable_indexing else "⚡ OPTIMIZED"
127
187
  index_status = "✅ Enabled" if self.enable_indexing else "🔶 Disabled"
188
+ segmentation_mode = (
189
+ "📄 SMART" if self.segmentation_enabled else "📋 TRADITIONAL"
190
+ )
128
191
 
129
192
  menu = f"""
130
193
  {Colors.BOLD}{Colors.CYAN}╔═══════════════════════════════════════════════════════════════════════════════╗
@@ -135,6 +198,7 @@ class CLIInterface:
135
198
  ║ ║
136
199
  ║ {Colors.BOLD}🤖 Current Pipeline Mode: {pipeline_mode}{Colors.CYAN} ║
137
200
  ║ {Colors.BOLD}🗂️ Codebase Indexing: {index_status}{Colors.CYAN} ║
201
+ ║ {Colors.BOLD}📄 Document Processing: {segmentation_mode}{Colors.CYAN} ║
138
202
  ║ ║
139
203
  ║ {Colors.YELLOW}📝 URL Processing:{Colors.CYAN} ║
140
204
  ║ {Colors.YELLOW} ▶ Enter research paper URL (arXiv, IEEE, ACM, etc.) {Colors.CYAN}║
@@ -693,6 +757,11 @@ class CLIInterface:
693
757
  def show_configuration_menu(self):
694
758
  """Show configuration options menu"""
695
759
  self.clear_screen()
760
+
761
+ # Get segmentation config status
762
+ segmentation_enabled = getattr(self, "segmentation_enabled", True)
763
+ segmentation_threshold = getattr(self, "segmentation_threshold", 50000)
764
+
696
765
  print(f"""
697
766
  {Colors.BOLD}{Colors.CYAN}╔═══════════════════════════════════════════════════════════════════════════════╗
698
767
  ║ CONFIGURATION MENU ║
@@ -716,9 +785,23 @@ class CLIInterface:
716
785
  ║ ✗ Repository Acquisition (Skipped) ║
717
786
  ║ ✗ Codebase Intelligence Orchestration (Skipped) ║
718
787
  ║ ║
719
- ║ {Colors.YELLOW}Current Setting:{Colors.CYAN} {'🧠 Comprehensive Mode' if self.enable_indexing else '⚡ Optimized Mode'} ║
788
+ ║ {Colors.OKCYAN}[2] Document Processing:{Colors.CYAN} ║
789
+ ║ {Colors.BOLD}📄 Smart Segmentation{Colors.CYAN} - Intelligent document analysis (Default) ║
790
+ ║ ✓ Semantic boundary detection ║
791
+ ║ ✓ Algorithm integrity preservation ║
792
+ ║ ✓ Formula chain recognition ║
793
+ ║ ✓ Adaptive character limits ║
794
+ ║ ║
795
+ ║ {Colors.BOLD}📋 Traditional Processing{Colors.CYAN} - Full document reading ║
796
+ ║ ✓ Complete document analysis ║
797
+ ║ ✗ Smart segmentation (Disabled) ║
720
798
  ║ ║
721
- ║ {Colors.OKGREEN}[T] Toggle Pipeline Mode {Colors.CYAN}│ {Colors.FAIL}[B] Back to Main Menu{Colors.CYAN} ║
799
+ ║ {Colors.YELLOW}Current Settings:{Colors.CYAN} ║
800
+ ║ Pipeline: {'🧠 Comprehensive Mode' if self.enable_indexing else '⚡ Optimized Mode'} ║
801
+ ║ Document: {'📄 Smart Segmentation' if segmentation_enabled else '📋 Traditional Processing'} ║
802
+ ║ Threshold: {segmentation_threshold} characters ║
803
+ ║ ║
804
+ ║ {Colors.OKGREEN}[T] Toggle Pipeline {Colors.BLUE}[S] Toggle Segmentation {Colors.FAIL}[B] Back{Colors.CYAN} ║
722
805
  ╚═══════════════════════════════════════════════════════════════════════════════╝{Colors.ENDC}
723
806
  """)
724
807
 
@@ -737,8 +820,27 @@ class CLIInterface:
737
820
  self.show_configuration_menu()
738
821
  return
739
822
 
823
+ elif choice in ["s", "segmentation"]:
824
+ current_state = getattr(self, "segmentation_enabled", True)
825
+ self.segmentation_enabled = not current_state
826
+ # Save the configuration to file
827
+ self._save_segmentation_config()
828
+ seg_mode = (
829
+ "📄 Smart Segmentation"
830
+ if self.segmentation_enabled
831
+ else "📋 Traditional Processing"
832
+ )
833
+ self.print_status(
834
+ f"Document processing switched to: {seg_mode}", "success"
835
+ )
836
+ time.sleep(1)
837
+ self.show_configuration_menu()
838
+ return
839
+
740
840
  elif choice in ["b", "back"]:
741
841
  return
742
842
 
743
843
  else:
744
- self.print_status("Invalid choice. Please enter 'T' or 'B'.", "warning")
844
+ self.print_status(
845
+ "Invalid choice. Please enter 'T', 'S', or 'B'.", "warning"
846
+ )