Skip to content

Commit c00ca24

Browse files
committed
fix the bug for file segmentation
1 parent 0b12cf8 commit c00ca24

File tree

2 files changed

+87
-69
lines changed

2 files changed

+87
-69
lines changed

mcp_agent.config.yaml

Lines changed: 81 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,102 @@
11
$schema: ./schema/mcp-agent.config.schema.json
2-
anthropic: null
3-
default_search_server: brave
2+
3+
# Default search server configuration
4+
# Options: "brave" or "bocha-mcp"
5+
default_search_server: "brave"
6+
7+
# Planning mode configuration
8+
# Options: "segmented" or "traditional"
9+
# segmented: Breaks down large tasks to avoid token truncation (recommended)
10+
# traditional: Uses parallel agents but may hit token limits
11+
planning_mode: "traditional"
12+
13+
# Document segmentation configuration
414
document_segmentation:
5-
enabled: true
6-
size_threshold_chars: 50000
15+
enabled: false # Whether to use intelligent document segmentation
16+
size_threshold_chars: 50000 # Document size threshold (in characters) to trigger segmentation
17+
# If document size > threshold and enabled=true, use segmentation workflow
18+
# If document size <= threshold or enabled=false, use traditional full-document reading
19+
720
execution_engine: asyncio
821
logger:
22+
transports: [console, file]
923
level: info
10-
path_settings:
11-
path_pattern: logs/mcp-agent-{unique_id}.jsonl
12-
timestamp_format: '%Y%m%d_%H%M%S'
13-
unique_id: timestamp
1424
progress_display: true
15-
transports:
16-
- console
17-
- file
25+
path_settings:
26+
path_pattern: "logs/mcp-agent-{unique_id}.jsonl"
27+
unique_id: "timestamp" # Options: "timestamp" or "session_id"
28+
timestamp_format: "%Y%m%d_%H%M%S"
29+
30+
31+
1832
mcp:
1933
servers:
20-
bocha-mcp:
21-
args:
22-
- tools/bocha_search_server.py
23-
command: python3
24-
env:
25-
BOCHA_API_KEY: ''
26-
PYTHONPATH: .
2734
brave:
28-
args:
29-
- -y
30-
- '@modelcontextprotocol/server-brave-search'
31-
command: npx
35+
# On windows replace the command and args line to use `node` and the absolute path to the server.
36+
# Use `npm i -g @modelcontextprotocol/server-brave-search` to install the server globally.
37+
# Use `npm -g root` to find the global node_modules path.`
38+
# command: "node"
39+
# args: ["c:/Program Files/nodejs/node_modules/@modelcontextprotocol/server-brave-search/dist/index.js"]
40+
command: "npx"
41+
args: ["-y", "@modelcontextprotocol/server-brave-search"]
3242
env:
33-
BRAVE_API_KEY: ''
34-
code-implementation:
35-
args:
36-
- tools/code_implementation_server.py
37-
command: python
38-
description: Paper code reproduction tool server - provides file operations,
39-
code execution, search and other functions
43+
# You can also place your BRAVE_API_KEY in the fastagent.secrets.yaml file.
44+
BRAVE_API_KEY: ""
45+
filesystem:
46+
# On windows update the command and arguments to use `node` and the absolute path to the server.
47+
# Use `npm i -g @modelcontextprotocol/server-filesystem` to install the server globally.
48+
# Use `npm -g root` to find the global node_modules path.`
49+
# command: "node"
50+
# args: ["c:/Program Files/nodejs/node_modules/@modelcontextprotocol/server-filesystem/dist/index.js","."]
51+
command: "npx"
52+
args: ["-y", "@modelcontextprotocol/server-filesystem"]
53+
fetch:
54+
command: "uvx"
55+
args: ["mcp-server-fetch"]
56+
github-downloader:
57+
command: "python"
58+
args: ["tools/git_command.py"]
4059
env:
41-
PYTHONPATH: .
42-
code-reference-indexer:
43-
args:
44-
- tools/code_reference_indexer.py
45-
command: python
46-
description: Code reference indexer server - Provides intelligent code reference
47-
search from indexed repositories
60+
PYTHONPATH: "."
61+
file-downloader:
62+
command: "python"
63+
args: ["tools/pdf_downloader.py"]
4864
env:
49-
PYTHONPATH: .
65+
PYTHONPATH: "."
5066
command-executor:
51-
args:
52-
- tools/command_executor.py
53-
command: python
67+
command: "python"
68+
args: ["tools/command_executor.py"]
5469
env:
55-
PYTHONPATH: .
56-
document-segmentation:
57-
args:
58-
- tools/document_segmentation_server.py
59-
command: python
60-
description: Document segmentation server - Provides intelligent document analysis
61-
and segmented reading to optimize token usage
70+
PYTHONPATH: "."
71+
code-implementation:
72+
command: "python"
73+
args: ["tools/code_implementation_server.py"]
6274
env:
63-
PYTHONPATH: .
64-
fetch:
65-
args:
66-
- mcp-server-fetch
67-
command: uvx
68-
file-downloader:
69-
args:
70-
- tools/pdf_downloader.py
71-
command: python
75+
PYTHONPATH: "."
76+
description: "Paper code reproduction tool server - provides file operations, code execution, search and other functions"
77+
code-reference-indexer:
78+
command: "python"
79+
args: ["tools/code_reference_indexer.py"]
7280
env:
73-
PYTHONPATH: .
74-
filesystem:
75-
args:
76-
- -y
77-
- '@modelcontextprotocol/server-filesystem'
78-
command: npx
79-
github-downloader:
80-
args:
81-
- tools/git_command.py
82-
command: python
81+
PYTHONPATH: "."
82+
description: "Code reference indexer server - Provides intelligent code reference search from indexed repositories"
83+
bocha-mcp:
84+
command: "python3"
85+
args: ["tools/bocha_search_server.py"]
8386
env:
84-
PYTHONPATH: .
87+
PYTHONPATH: "."
88+
BOCHA_API_KEY: ""
89+
document-segmentation:
90+
command: "python"
91+
args: ["tools/document_segmentation_server.py"]
92+
env:
93+
PYTHONPATH: "."
94+
description: "Document segmentation server - Provides intelligent document analysis and segmented reading to optimize token usage"
95+
8596
openai:
97+
# Secrets (API keys, etc.) are stored in an mcp_agent.secrets.yaml file which can be gitignored
98+
# default_model: "o3-mini"
8699
default_model: "anthropic/claude-sonnet-4"
87-
planning_mode: traditional
100+
88101

89102
anthropic:
90-
default_model: ""

utils/llm_utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,12 @@ def get_adaptive_agent_config(
187187
config["algorithm_analysis"].append("document-segmentation")
188188
if "document-segmentation" not in config["code_planner"]:
189189
config["code_planner"].append("document-segmentation")
190+
else:
191+
config["concept_analysis"] = ["filesystem"]
192+
if "filesystem" not in config["algorithm_analysis"]:
193+
config["algorithm_analysis"].append("filesystem")
194+
if "filesystem" not in config["code_planner"]:
195+
config["code_planner"].append("filesystem")
190196

191197
return config
192198

0 commit comments

Comments
 (0)