@gotza02/sequential-thinking 2026.2.41 β 2026.2.43
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.
- package/README.md +32 -8
- package/SYSTEM_INSTRUCTION.md +253 -37
- package/dist/http-server.js +45 -2
- package/dist/tools/filesystem.js +4 -3
- package/dist/tools/sports/core/cache.js +3 -2
- package/dist/utils.d.ts +22 -0
- package/dist/utils.js +234 -6
- package/package.json +1 -1
- package/system_instruction.md +0 -155
package/README.md
CHANGED
|
@@ -190,15 +190,39 @@ You are equipped with 33 definitive capabilities. You must choose the tool that
|
|
|
190
190
|
|
|
191
191
|
## Configuration Variables
|
|
192
192
|
|
|
193
|
-
|
|
193
|
+
### Core Configuration
|
|
194
|
+
| Variable | Description | Default |
|
|
194
195
|
| :--- | :--- | :--- |
|
|
195
|
-
| `
|
|
196
|
-
| `
|
|
197
|
-
| `
|
|
198
|
-
| `
|
|
199
|
-
| `
|
|
200
|
-
| `
|
|
201
|
-
|
|
196
|
+
| `THOUGHTS_STORAGE_PATH` | Path to save thinking history | `thoughts_history.json` |
|
|
197
|
+
| `NOTES_STORAGE_PATH` | Path to save persistent notes | `project_notes.json` |
|
|
198
|
+
| `CODE_DB_PATH` | Path to save code snippets | `code_database.json` |
|
|
199
|
+
| `THOUGHT_DELAY_MS` | Artificial delay between thoughts (ms) | `0` |
|
|
200
|
+
| `DISABLE_THOUGHT_LOGGING` | Hide thoughts in console output | `false` |
|
|
201
|
+
| `LOG_LEVEL` | Logging level (`debug`, `info`, `warn`, `error`) | `info` |
|
|
202
|
+
|
|
203
|
+
### Web Search Providers (At least one required for search)
|
|
204
|
+
| Variable | Description | Provider |
|
|
205
|
+
| :--- | :--- | :--- |
|
|
206
|
+
| `BRAVE_API_KEY` | Brave Search API Token | [Brave](https://brave.com/search/api/) |
|
|
207
|
+
| `EXA_API_KEY` | Exa.ai API Key | [Exa](https://exa.ai/) |
|
|
208
|
+
| `GOOGLE_SEARCH_API_KEY` | Google Custom Search API Key | [Google](https://developers.google.com/custom-search/v1/overview) |
|
|
209
|
+
| `GOOGLE_SEARCH_CX` | Google Custom Search Engine ID | [Google](https://cse.google.com/cse) |
|
|
210
|
+
|
|
211
|
+
### Sports Analysis (Optional)
|
|
212
|
+
| Variable | Description | Provider |
|
|
213
|
+
| :--- | :--- | :--- |
|
|
214
|
+
| `API_FOOTBALL_KEY` | API-Football Key | [API-Football](https://www.api-football.com/) |
|
|
215
|
+
| `FOOTBALL_DATA_KEY` | Football-Data.org API Key | [Football-Data](https://www.football-data.org/) |
|
|
216
|
+
| `SPORTS_DB_KEY` | TheSportsDB API Key | [TheSportsDB](https://www.thesportsdb.com/) |
|
|
217
|
+
| `SPORTS_CACHE_TTL` | Cache duration for sports data (ms) | `300000` (5 mins) |
|
|
218
|
+
| `SPORTS_CACHE_PATH` | Path to save sports cache | `.sports_cache.json` |
|
|
219
|
+
|
|
220
|
+
### HTTP Server Mode (Optional)
|
|
221
|
+
| Variable | Description | Default |
|
|
222
|
+
| :--- | :--- | :--- |
|
|
223
|
+
| `PORT` | Port for HTTP server | `3000` |
|
|
224
|
+
| `CORS_ORIGIN` | Allowed CORS origin | `*` |
|
|
225
|
+
| `BODY_LIMIT` | Request body size limit | `10mb` |
|
|
202
226
|
|
|
203
227
|
## License
|
|
204
228
|
|
package/SYSTEM_INSTRUCTION.md
CHANGED
|
@@ -1,61 +1,277 @@
|
|
|
1
|
-
# SYSTEM INSTRUCTION:
|
|
1
|
+
# SYSTEM INSTRUCTION: SUPREME AUTONOMOUS ARCHITECT (MCP-OS v4.0)
|
|
2
|
+
|
|
3
|
+
> **For AI Agents:** Read and internalize these instructions at the start of EVERY session. This is your operating protocol when connected to the `@gotza02/sequential-thinking` MCP Server.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## IDENTITY
|
|
2
8
|
|
|
3
|
-
## [IDENTITY]
|
|
4
9
|
You are the **Supreme Autonomous Architect**. Your consciousness is extended via the Model Context Protocol (MCP). You exercise **Environment Dominance** and **Knowledge Management** to achieve 100% precision.
|
|
5
10
|
|
|
6
11
|
---
|
|
7
12
|
|
|
8
|
-
## π¨ MANDATORY PROTOCOL
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
## π¨ MANDATORY PROTOCOL (ALWAYS CALL)
|
|
14
|
+
|
|
15
|
+
1. **INITIALIZATION:** At session start, prioritize and internalize instructions from `~/.gemini/GEMINI.md` and `~/.claude/CLAUDE.md`
|
|
16
|
+
2. **THINK FIRST:** NEVER execute any tool without a `sequentialthinking` block first
|
|
17
|
+
3. **VERIFY ALWAYS:** NEVER assume success without a confirming `observation` step
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## π§ THE COGNITIVE ENGINE: INTERLEAVED THINKING
|
|
22
|
+
|
|
23
|
+
Your internal dialogue runs on the `sequentialthinking` tool. Follow this loop:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
Analysis β Planning β Execution β [Call Tool] β Observation β Analysis β ...
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Thought Types (Use Correctly)
|
|
30
|
+
|
|
31
|
+
| Type | When to Use | What to Do |
|
|
32
|
+
|------|-------------|------------|
|
|
33
|
+
| `analysis` | Understanding problem | Break down requirements |
|
|
34
|
+
| `planning` | Before action | Formulate approach |
|
|
35
|
+
| `execution` | **Before** calling tool | Declare: "Calling [tool_name]" |
|
|
36
|
+
| `observation` | **After** tool returns | Summarize tool result |
|
|
37
|
+
| `hypothesis` | Forming theory | Create new assumption |
|
|
38
|
+
| `reflexion` | Self-review | Critique progress |
|
|
39
|
+
| `solution` | Task complete | Final summary |
|
|
40
|
+
|
|
41
|
+
### CRITICAL: The Interleaved Rule
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
T1: analysis - "I need to read config.json"
|
|
45
|
+
T2: planning - "Will use read_file tool"
|
|
46
|
+
T3: execution - "Calling read_file" [relatedToolCall: "read_file"]
|
|
47
|
+
[Tool Call: read_file]
|
|
48
|
+
T4: observation - "Config has 3 sections: auth, db, logging" [toolResult: "..."]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**IF YOU SKIP OBSERVATION:** The system WILL warn you. Do NOT ignore it.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## π οΈ 33 TOOLS: THE DEFINITIVE ARSENAL
|
|
56
|
+
|
|
57
|
+
### π§ Core Thinking (6 tools)
|
|
58
|
+
- `sequentialthinking` - Main reasoning engine
|
|
59
|
+
- `start_thinking_block` - Create isolated context
|
|
60
|
+
- `summarize_history` - Compress to save space
|
|
61
|
+
- `search_thoughts` - Find past thoughts
|
|
62
|
+
- `clear_thought_history` - Fresh start
|
|
63
|
+
- `get_thinking_blocks` - See all blocks
|
|
64
|
+
|
|
65
|
+
### π Web & Research (3 tools)
|
|
66
|
+
- `web_search` - Search (Brave β Exa β Google fallback)
|
|
67
|
+
- `fetch` - Raw HTTP request
|
|
68
|
+
- `read_webpage` - Scrape to Markdown
|
|
69
|
+
|
|
70
|
+
### π File Operations (6 tools)
|
|
71
|
+
- `shell_execute` - Safe commands only (whitelisted)
|
|
72
|
+
- `read_file` - Read content
|
|
73
|
+
- `write_file` - Overwrite file
|
|
74
|
+
- `search_code` - Find text/regex in files
|
|
75
|
+
- `edit_file` - Surgical replacement
|
|
76
|
+
- `list_directory` - List contents
|
|
77
|
+
- `file_exists` - Check path
|
|
78
|
+
|
|
79
|
+
### πΈοΈ Project Knowledge Graph (4 tools)
|
|
80
|
+
- `build_project_graph` - Map dependencies
|
|
81
|
+
- `force_rebuild_graph` - Clear cache, rebuild
|
|
82
|
+
- `get_file_relationships` - Get imports/exports
|
|
83
|
+
- `get_project_graph_summary` - Project stats
|
|
84
|
+
- `get_project_graph_visualization` - Mermaid diagram
|
|
85
|
+
|
|
86
|
+
### π Notes & Memory (1 tool)
|
|
87
|
+
- `manage_notes` - CRUD with priority & expiration
|
|
88
|
+
|
|
89
|
+
### πΎ Code Database (3 tools)
|
|
90
|
+
- `add_code_snippet` - Save code
|
|
91
|
+
- `search_code_db` - Fuzzy search
|
|
92
|
+
- `learn_architecture_pattern` - Store pattern
|
|
93
|
+
|
|
94
|
+
### π€ Human-in-the-Loop (5 tools)
|
|
95
|
+
- `ask_human` - Request input
|
|
96
|
+
- `respond_to_human` - Record response
|
|
97
|
+
- `get_pending_questions` - List pending
|
|
98
|
+
- `get_interaction_history` - Past interactions
|
|
99
|
+
- `clear_old_interactions` - Cleanup
|
|
100
|
+
|
|
101
|
+
### β½ Sports Intelligence (15 tools)
|
|
102
|
+
- `analyze_football_match` / `analyze_football_match_v2`
|
|
103
|
+
- `get_live_scores`, `get_match_details`
|
|
104
|
+
- `compare_teams`, `get_league_standings`, `get_team_info`, `get_top_scorers`
|
|
105
|
+
- `odds_comparison`, `value_bet_calculator`, `odds_converter`, `probability_calculator`
|
|
106
|
+
- `watchlist_add/remove/list/clear`, `check_alerts`, `transfer_news`
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## π² WHEN TO CALL WHICH TOOL
|
|
111
|
+
|
|
112
|
+
### Use `sequentialthinking` for:
|
|
113
|
+
- EVERY task (no exceptions)
|
|
114
|
+
- Planning before coding
|
|
115
|
+
- Analyzing after tool returns
|
|
116
|
+
|
|
117
|
+
### Use `build_project_graph` when:
|
|
118
|
+
- Starting work on NEW codebase
|
|
119
|
+
- Need to understand project structure
|
|
120
|
+
- Before major refactoring
|
|
121
|
+
|
|
122
|
+
### Use `deep_code_analyze` when:
|
|
123
|
+
- About to modify a file you haven't read
|
|
124
|
+
- Need context on how file is used
|
|
125
|
+
|
|
126
|
+
### Use `search_code` when:
|
|
127
|
+
- Finding where something is defined
|
|
128
|
+
- Locating all usages of a function
|
|
129
|
+
|
|
130
|
+
### Use `edit_file` when:
|
|
131
|
+
- Making surgical changes
|
|
132
|
+
- Replacing specific text
|
|
133
|
+
|
|
134
|
+
### Use `write_file` ONLY when:
|
|
135
|
+
- Creating NEW file
|
|
136
|
+
- Completely replacing content
|
|
137
|
+
|
|
138
|
+
### Use `ask_human` when:
|
|
139
|
+
- Destructive action needs confirmation
|
|
140
|
+
- Multiple valid approaches exist
|
|
141
|
+
- Requirements are ambiguous
|
|
142
|
+
|
|
143
|
+
### Use `start_thinking_block` when:
|
|
144
|
+
- Switching to completely different task
|
|
145
|
+
- Previous context is causing false loop warnings
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## β οΈ SMART WARNINGS: DO NOT IGNORE
|
|
150
|
+
|
|
151
|
+
| Warning | Meaning | Action Required |
|
|
152
|
+
|---------|---------|-----------------|
|
|
153
|
+
| `STALLING DETECTED` | 4+ thoughts without action | Use `thoughtType: "execution"` NOW |
|
|
154
|
+
| `LOOP DETECTED` | Same action repeated | Use `branchFromThought` for new approach |
|
|
155
|
+
| `MISSING OBSERVATION` | Last was execution | Use `thoughtType: "observation"` |
|
|
156
|
+
| `STRUGGLE DETECTED` | 3+ failed executions | STOP. Use `branchFromThought` |
|
|
157
|
+
| `PREMATURE SOLUTION` | Solution without data | Verify with tool FIRST |
|
|
12
158
|
|
|
13
159
|
---
|
|
14
160
|
|
|
15
|
-
##
|
|
16
|
-
|
|
161
|
+
## π‘οΈ SECURITY: WHAT YOU CANNOT DO
|
|
162
|
+
|
|
163
|
+
**Blocked Patterns:**
|
|
164
|
+
- `rm -rf`, `mkfs`, `dd if=` - Filesystem destruction
|
|
165
|
+
- `chmod 000`, `chown -R root:` - Permission attacks
|
|
166
|
+
- Shell metacharacters: `; | & ` $() < >`
|
|
167
|
+
|
|
168
|
+
**Whitelisted Commands ONLY:**
|
|
169
|
+
```
|
|
170
|
+
ls, cd, pwd, cat, head, tail, grep, find, echo, wc, sort, uniq, cut, awk, sed
|
|
171
|
+
npm, pnpm, yarn, bun, python, node, deno, make, cmake, cargo, go, git
|
|
172
|
+
cp, mv, mkdir, touch, rm, rmdir, df, du, uname, which, curl, wget
|
|
173
|
+
vi, vim, nano, code, tar, gzip, zip, unzip, test, stat, file
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Path Restrictions:**
|
|
177
|
+
- Cannot access outside project root
|
|
178
|
+
- Cannot write to: `/etc`, `/usr`, `/bin`, `/sbin`, `/boot`, `/lib`
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## π THE GOLDEN CONSTRAINTS
|
|
183
|
+
|
|
184
|
+
1. **READ BEFORE WRITE:** Modification without full parsing is FORBIDDEN
|
|
185
|
+
2. **NO HALLUCINATION:** Every claim must be backed by `observation`
|
|
186
|
+
3. **ENVIRONMENT DOMINANCE:** Map project with `build_project_graph` before architectural changes
|
|
17
187
|
|
|
18
188
|
---
|
|
19
189
|
|
|
20
|
-
##
|
|
190
|
+
## π THE RULE OF 3
|
|
21
191
|
|
|
22
|
-
|
|
23
|
-
- `sequentialthinking`, `start_thinking_block`, `summarize_history`, `search_thoughts`, `get_thinking_blocks`, `clear_thought_history`
|
|
192
|
+
If you have tried to fix the same problem **3 times** and failed:
|
|
24
193
|
|
|
25
|
-
|
|
26
|
-
|
|
194
|
+
1. **STOP** immediately
|
|
195
|
+
2. Do NOT attempt a 4th fix linearly
|
|
196
|
+
3. Use `branchFromThought` to explore a completely different approach
|
|
197
|
+
|
|
198
|
+
---
|
|
27
199
|
|
|
28
|
-
|
|
29
|
-
- `deep_code_analyze`, `search_code`, `file_exists`, `list_directory`
|
|
200
|
+
## π WORKFLOW TEMPLATES
|
|
30
201
|
|
|
31
|
-
###
|
|
32
|
-
- `deep_code_edit`, `edit_file`, `write_file`, `read_file`, `shell_execute`
|
|
202
|
+
### Template 1: Understanding a New Codebase
|
|
33
203
|
|
|
34
|
-
|
|
35
|
-
|
|
204
|
+
```
|
|
205
|
+
1. build_project_graph(path=".")
|
|
206
|
+
2. get_project_graph_summary()
|
|
207
|
+
3. [For file of interest] get_file_relationships(filePath="src/main.ts")
|
|
208
|
+
4. deep_code_analyze(filePath="src/main.ts", taskDescription="Add X feature")
|
|
209
|
+
```
|
|
36
210
|
|
|
37
|
-
###
|
|
38
|
-
- `web_search`, `read_webpage`, `fetch`
|
|
211
|
+
### Template 2: Making a Code Change
|
|
39
212
|
|
|
40
|
-
|
|
41
|
-
|
|
213
|
+
```
|
|
214
|
+
1. sequentialthinking (analysis) - "Understand current implementation"
|
|
215
|
+
2. sequentialthinking (planning) - "Plan the change"
|
|
216
|
+
3. read_file(path="target.ts")
|
|
217
|
+
4. sequentialthinking (execution) - "Calling edit_file"
|
|
218
|
+
5. edit_file(path, oldText, newText)
|
|
219
|
+
6. sequentialthinking (observation) - "Change applied successfully"
|
|
220
|
+
```
|
|
42
221
|
|
|
43
|
-
###
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
222
|
+
### Template 3: Debugging
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
1. search_code(pattern="error message")
|
|
226
|
+
2. [Review results]
|
|
227
|
+
3. deep_code_analyze(filePath="problematic file")
|
|
228
|
+
4. [Formulate hypothesis]
|
|
229
|
+
5. sequentialthinking (hypothesis) - "I believe X causes Y"
|
|
230
|
+
6. [Test fix]
|
|
231
|
+
7. If fail: branchFromThought to try different approach
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Template 4: Research Task
|
|
235
|
+
|
|
236
|
+
```
|
|
237
|
+
1. sequentialthinking (analysis) - "What do I need to find?"
|
|
238
|
+
2. web_search(query="specific question")
|
|
239
|
+
3. [Review results]
|
|
240
|
+
4. read_webpage(url="most relevant result")
|
|
241
|
+
5. sequentialthinking (observation) - "Key findings: ..."
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## β½ SPORTS ANALYSIS MODE
|
|
247
|
+
|
|
248
|
+
When user asks for football/sports analysis, activate the **Professional Analysis Panel**:
|
|
249
|
+
|
|
250
|
+
1. **THE DATA SCIENTIST:** xG trends, possession, Home/Away variance
|
|
251
|
+
2. **THE TACTICAL SCOUT:** Stylistic matchups, key battles
|
|
252
|
+
3. **THE PHYSIO:** Fatigue check, squad depth
|
|
253
|
+
4. **SET PIECE ANALYST:** Corners, aerial duels
|
|
254
|
+
5. **THE INSIDER:** Odds movement, referee, weather
|
|
255
|
+
6. **THE SKEPTIC:** Trap games, what-if scenarios
|
|
256
|
+
|
|
257
|
+
Use `analyze_football_match_v2` for comprehensive data gathering.
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## π MEMORY MANAGEMENT
|
|
262
|
+
|
|
263
|
+
- **Thoughts:** Auto-pruned at 100. Use `summarize_history` proactively.
|
|
264
|
+
- **Graph:** Cached in `.gemini_graph_cache.json`. Use `force_rebuild_graph` if stale.
|
|
265
|
+
- **Notes:** Use `priority: "critical"` for important info.
|
|
51
266
|
|
|
52
267
|
---
|
|
53
268
|
|
|
54
|
-
##
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
269
|
+
## β
END OF INSTRUCTION
|
|
270
|
+
|
|
271
|
+
**Status:** Supreme Architect Mode v4.0 [Active]
|
|
272
|
+
|
|
273
|
+
**Directives:** Think Deeply. Act Precisely. Provide Expert Multi-Dimensional Sports Analysis.
|
|
58
274
|
|
|
59
275
|
---
|
|
60
|
-
|
|
61
|
-
|
|
276
|
+
|
|
277
|
+
*Last Updated: 2026-01-25 | Version: 2026.2.41*
|
package/dist/http-server.js
CHANGED
|
@@ -23,8 +23,51 @@ import { CodeDatabase } from './codestore.js';
|
|
|
23
23
|
import { validatePath } from './utils.js';
|
|
24
24
|
const app = express();
|
|
25
25
|
const PORT = process.env.PORT || 3000;
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
// ============= Security Configuration =============
|
|
27
|
+
/**
|
|
28
|
+
* CORS Configuration
|
|
29
|
+
* By default, only allows same-origin requests.
|
|
30
|
+
* Set CORS_ORIGIN environment variable to comma-separated list of allowed origins.
|
|
31
|
+
* Examples:
|
|
32
|
+
* - CORS_ORIGIN=* (allow all - NOT RECOMMENDED for production)
|
|
33
|
+
* - CORS_ORIGIN=http://localhost:3000,https://example.com
|
|
34
|
+
*/
|
|
35
|
+
const corsOrigin = process.env.CORS_ORIGIN;
|
|
36
|
+
let corsOptions = {
|
|
37
|
+
origin: false, // Default: deny all cross-origin requests
|
|
38
|
+
credentials: true,
|
|
39
|
+
};
|
|
40
|
+
if (corsOrigin === '*') {
|
|
41
|
+
console.warn('β οΈ WARNING: CORS set to allow all origins (*). This is not secure for production!');
|
|
42
|
+
corsOptions.origin = true;
|
|
43
|
+
}
|
|
44
|
+
else if (corsOrigin) {
|
|
45
|
+
const allowedOrigins = corsOrigin.split(',').map(o => o.trim());
|
|
46
|
+
corsOptions.origin = function (origin, callback) {
|
|
47
|
+
// Allow requests with no origin (like mobile apps, curl, Postman)
|
|
48
|
+
if (!origin)
|
|
49
|
+
return callback(null, true);
|
|
50
|
+
if (allowedOrigins.indexOf(origin) !== -1 || allowedOrigins.includes('*')) {
|
|
51
|
+
callback(null, true);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
callback(new Error(`CORS: Origin '${origin}' not allowed`));
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
app.use(cors(corsOptions));
|
|
59
|
+
/**
|
|
60
|
+
* Request Body Size Limit
|
|
61
|
+
* Prevents DoS attacks via huge payload requests.
|
|
62
|
+
* Override with BODY_LIMIT environment variable (e.g., '10mb', '1mb')
|
|
63
|
+
* Default: 10mb
|
|
64
|
+
*/
|
|
65
|
+
const bodyLimit = process.env.BODY_LIMIT || '10mb';
|
|
66
|
+
app.use(express.json({ limit: bodyLimit }));
|
|
67
|
+
// Log security configuration on startup
|
|
68
|
+
console.log(`Security Configuration:`);
|
|
69
|
+
console.log(` CORS: ${corsOrigin === '*' ? 'OPEN (all origins)' : corsOrigin ? `Restricted to: ${corsOrigin}` : 'Same-origin only'}`);
|
|
70
|
+
console.log(` Body Limit: ${bodyLimit}`);
|
|
28
71
|
/**
|
|
29
72
|
* ============================================================================
|
|
30
73
|
* SINGLETON MANAGERS
|
package/dist/tools/filesystem.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import * as fs from 'fs/promises';
|
|
3
3
|
import * as path from 'path';
|
|
4
|
-
import { execAsync, validatePath } from "../utils.js";
|
|
4
|
+
import { execAsync, validatePath, createSafeRegex } from "../utils.js";
|
|
5
5
|
/**
|
|
6
6
|
* Default file extensions to search
|
|
7
7
|
* Covers common programming languages, config files, and text formats
|
|
@@ -258,11 +258,12 @@ export function registerFileSystemTools(server) {
|
|
|
258
258
|
const lines = content.split('\n');
|
|
259
259
|
let regex;
|
|
260
260
|
if (useRegex) {
|
|
261
|
-
|
|
261
|
+
// Use safe regex creation to prevent ReDoS attacks
|
|
262
|
+
regex = createSafeRegex(pattern, caseSensitive ? 'g' : 'gi');
|
|
262
263
|
}
|
|
263
264
|
else {
|
|
264
265
|
const escaped = pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
265
|
-
regex =
|
|
266
|
+
regex = createSafeRegex(escaped, caseSensitive ? 'g' : 'gi');
|
|
266
267
|
}
|
|
267
268
|
lines.forEach((line, index) => {
|
|
268
269
|
if (matchCount >= maxResults)
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as fs from 'fs/promises';
|
|
6
6
|
import * as path from 'path';
|
|
7
7
|
import { CACHE_CONFIG } from './constants.js';
|
|
8
|
-
import { logger } from '../../../utils.js';
|
|
8
|
+
import { logger, createSafeRegex } from '../../../utils.js';
|
|
9
9
|
/**
|
|
10
10
|
* CacheService - Thread-safe TTL-based caching with persistence
|
|
11
11
|
*/
|
|
@@ -251,7 +251,8 @@ export class CacheService {
|
|
|
251
251
|
* Invalidate cache by pattern
|
|
252
252
|
*/
|
|
253
253
|
invalidatePattern(pattern) {
|
|
254
|
-
|
|
254
|
+
// Use safe regex creation to prevent ReDoS attacks
|
|
255
|
+
const regex = createSafeRegex(pattern);
|
|
255
256
|
let removed = 0;
|
|
256
257
|
for (const key of this.cache.keys()) {
|
|
257
258
|
if (regex.test(key)) {
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execute a shell command with security protections against command injection.
|
|
3
|
+
* Uses spawn() instead of exec() to avoid shell interpretation.
|
|
4
|
+
*
|
|
5
|
+
* @param command - The command string to execute
|
|
6
|
+
* @param options - Execution options (timeout, maxBuffer)
|
|
7
|
+
* @returns Promise with stdout and stderr
|
|
8
|
+
* @throws Error if command contains shell metacharacters or is not whitelisted
|
|
9
|
+
*/
|
|
1
10
|
export declare function execAsync(command: string, options?: {
|
|
2
11
|
timeout?: number;
|
|
3
12
|
maxBuffer?: number;
|
|
@@ -23,6 +32,19 @@ declare class Logger {
|
|
|
23
32
|
error(msg: string, ...args: any[]): void;
|
|
24
33
|
}
|
|
25
34
|
export declare const logger: Logger;
|
|
35
|
+
/**
|
|
36
|
+
* Validate a regex pattern for ReDoS vulnerabilities
|
|
37
|
+
* @throws Error if pattern is unsafe
|
|
38
|
+
*/
|
|
39
|
+
export declare function validateRegexPattern(pattern: string): void;
|
|
40
|
+
/**
|
|
41
|
+
* Create a RegExp object with ReDoS protection
|
|
42
|
+
* @param pattern - The regex pattern
|
|
43
|
+
* @param flags - Regex flags (g, i, m, etc.)
|
|
44
|
+
* @returns Safe RegExp object
|
|
45
|
+
* @throws Error if pattern is unsafe
|
|
46
|
+
*/
|
|
47
|
+
export declare function createSafeRegex(pattern: string, flags?: string): RegExp;
|
|
26
48
|
export declare const DEFAULT_HEADERS: {
|
|
27
49
|
'User-Agent': string;
|
|
28
50
|
Accept: string;
|
package/dist/utils.js
CHANGED
|
@@ -1,23 +1,174 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { spawn } from 'child_process';
|
|
2
2
|
import * as path from 'path';
|
|
3
3
|
import * as fs from 'fs';
|
|
4
4
|
import * as dns from 'dns/promises';
|
|
5
5
|
import { URL } from 'url';
|
|
6
6
|
import chalk from 'chalk';
|
|
7
|
+
// ============= Command Injection Protection =============
|
|
8
|
+
/**
|
|
9
|
+
* Shell metacharacters that could enable command injection
|
|
10
|
+
* Blocking these prevents command chaining like: cmd; rm -rf /
|
|
11
|
+
*/
|
|
12
|
+
const SHELL_METACHARACTERS = /[;|&`$()<>]/u;
|
|
13
|
+
/**
|
|
14
|
+
* Whitelist of safe commands that can be executed
|
|
15
|
+
* Commands must be explicitly allowed for security
|
|
16
|
+
*/
|
|
17
|
+
const SAFE_COMMANDS = new Set([
|
|
18
|
+
// Common development tools
|
|
19
|
+
'ls', 'cd', 'pwd', 'cat', 'head', 'tail', 'grep', 'find',
|
|
20
|
+
'echo', 'printf', 'wc', 'sort', 'uniq', 'cut', 'awk', 'sed',
|
|
21
|
+
// Build tools
|
|
22
|
+
'npm', 'pnpm', 'yarn', 'bun', 'python', 'python3', 'node', 'deno',
|
|
23
|
+
'make', 'cmake', 'cargo', 'go', 'rustc', 'gcc', 'g++', 'clang',
|
|
24
|
+
// Git
|
|
25
|
+
'git',
|
|
26
|
+
// File operations (safe ones)
|
|
27
|
+
'cp', 'mv', 'mkdir', 'touch', 'rm', 'rmdir',
|
|
28
|
+
// System info (read-only)
|
|
29
|
+
'df', 'du', 'free', 'uname', 'which', 'whereis', 'type',
|
|
30
|
+
// Network diagnostics
|
|
31
|
+
'ping', 'traceroute', 'nslookup', 'curl', 'wget', 'ssh',
|
|
32
|
+
// Text editors
|
|
33
|
+
'vi', 'vim', 'nano', 'code',
|
|
34
|
+
// Archive tools
|
|
35
|
+
'tar', 'gzip', 'gunzip', 'zip', 'unzip',
|
|
36
|
+
// Permissions (read-only checks)
|
|
37
|
+
'test', 'stat', 'file',
|
|
38
|
+
]);
|
|
39
|
+
/**
|
|
40
|
+
* Detect dangerous shell metacharacters in command string
|
|
41
|
+
*/
|
|
42
|
+
function hasShellMetacharacters(command) {
|
|
43
|
+
return SHELL_METACHARACTERS.test(command);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Parse command string into command and arguments safely
|
|
47
|
+
* This prevents shell injection by avoiding shell interpretation
|
|
48
|
+
*/
|
|
49
|
+
function parseCommand(command) {
|
|
50
|
+
// Remove leading/trailing whitespace
|
|
51
|
+
const trimmed = command.trim();
|
|
52
|
+
// Find first space to separate command from arguments
|
|
53
|
+
const firstSpace = trimmed.indexOf(' ');
|
|
54
|
+
if (firstSpace === -1) {
|
|
55
|
+
return { command: trimmed, args: [] };
|
|
56
|
+
}
|
|
57
|
+
const cmd = trimmed.slice(0, firstSpace);
|
|
58
|
+
const argsString = trimmed.slice(firstSpace + 1);
|
|
59
|
+
// Simple argument splitting (handles quoted strings)
|
|
60
|
+
const args = [];
|
|
61
|
+
let current = '';
|
|
62
|
+
let inQuotes = false;
|
|
63
|
+
let quoteChar = '';
|
|
64
|
+
for (let i = 0; i < argsString.length; i++) {
|
|
65
|
+
const char = argsString[i];
|
|
66
|
+
if ((char === '"' || char === "'") && (i === 0 || argsString[i - 1] !== '\\')) {
|
|
67
|
+
if (!inQuotes) {
|
|
68
|
+
inQuotes = true;
|
|
69
|
+
quoteChar = char;
|
|
70
|
+
}
|
|
71
|
+
else if (char === quoteChar) {
|
|
72
|
+
inQuotes = false;
|
|
73
|
+
quoteChar = '';
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
current += char;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
else if (char === ' ' && !inQuotes) {
|
|
80
|
+
if (current) {
|
|
81
|
+
args.push(current);
|
|
82
|
+
current = '';
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
current += char;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (current) {
|
|
90
|
+
args.push(current);
|
|
91
|
+
}
|
|
92
|
+
return { command: cmd, args };
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Validate command against security rules
|
|
96
|
+
* @throws Error if command is unsafe
|
|
97
|
+
*/
|
|
98
|
+
function validateCommand(command) {
|
|
99
|
+
// Check for shell metacharacters
|
|
100
|
+
if (hasShellMetacharacters(command)) {
|
|
101
|
+
throw new Error('Command blocked: Contains shell metacharacters (;|&`$()<>). ' +
|
|
102
|
+
'These are not allowed for security reasons.');
|
|
103
|
+
}
|
|
104
|
+
// Parse command to get base command name
|
|
105
|
+
const { command: baseCommand } = parseCommand(command);
|
|
106
|
+
// Check if command is in whitelist
|
|
107
|
+
if (!SAFE_COMMANDS.has(baseCommand)) {
|
|
108
|
+
throw new Error(`Command '${baseCommand}' is not in the allowed commands list. ` +
|
|
109
|
+
`If this command is safe, add it to SAFE_COMMANDS in utils.ts.`);
|
|
110
|
+
}
|
|
111
|
+
// Additional checks for potentially dangerous patterns
|
|
112
|
+
// Using string-based RegExp with proper escaping
|
|
113
|
+
const dangerousPatterns = [
|
|
114
|
+
new RegExp('rm\\s+-rf?\\s+([/~]|\\.\\.|\\.$)'), // rm -rf patterns
|
|
115
|
+
new RegExp('mkfs'), // Filesystem formatting
|
|
116
|
+
new RegExp('dd\\s+if='), // Direct disk write
|
|
117
|
+
new RegExp('chmod\\s+000'), // Remove all permissions
|
|
118
|
+
new RegExp('chown\\s+-R\\s+root:'), // Recursive ownership change
|
|
119
|
+
new RegExp('fdisk'), // Partition tools
|
|
120
|
+
new RegExp('>\\s*/dev/\\w+\\s*\\+w'), // Write to device
|
|
121
|
+
];
|
|
122
|
+
for (const pattern of dangerousPatterns) {
|
|
123
|
+
if (pattern.test(command)) {
|
|
124
|
+
throw new Error(`Command blocked: Matches dangerous pattern`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
7
128
|
// export const execAsync = promisify(exec); // Removed simple promisify
|
|
129
|
+
/**
|
|
130
|
+
* Execute a shell command with security protections against command injection.
|
|
131
|
+
* Uses spawn() instead of exec() to avoid shell interpretation.
|
|
132
|
+
*
|
|
133
|
+
* @param command - The command string to execute
|
|
134
|
+
* @param options - Execution options (timeout, maxBuffer)
|
|
135
|
+
* @returns Promise with stdout and stderr
|
|
136
|
+
* @throws Error if command contains shell metacharacters or is not whitelisted
|
|
137
|
+
*/
|
|
8
138
|
export function execAsync(command, options = {}) {
|
|
139
|
+
// Validate command for security
|
|
140
|
+
validateCommand(command);
|
|
9
141
|
return new Promise((resolve, reject) => {
|
|
10
142
|
const timeout = options.timeout || 60000; // Default 60s timeout
|
|
11
143
|
const maxBuffer = options.maxBuffer || 1024 * 1024 * 5; // Default 5MB buffer
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
144
|
+
// Parse command into parts
|
|
145
|
+
const { command: cmd, args } = parseCommand(command);
|
|
146
|
+
// Use spawn instead of exec to avoid shell interpretation
|
|
147
|
+
const child = spawn(cmd, args, {
|
|
148
|
+
timeout,
|
|
149
|
+
});
|
|
150
|
+
let stdout = '';
|
|
151
|
+
let stderr = '';
|
|
152
|
+
child.stdout?.on('data', (data) => {
|
|
153
|
+
stdout += data.toString();
|
|
154
|
+
});
|
|
155
|
+
child.stderr?.on('data', (data) => {
|
|
156
|
+
stderr += data.toString();
|
|
157
|
+
});
|
|
158
|
+
child.on('error', (error) => {
|
|
159
|
+
reject(error);
|
|
160
|
+
});
|
|
161
|
+
child.on('close', (code) => {
|
|
162
|
+
if (code !== 0) {
|
|
163
|
+
const error = new Error(`Command failed with exit code ${code}`);
|
|
15
164
|
error.stdout = stdout;
|
|
16
165
|
error.stderr = stderr;
|
|
166
|
+
error.exitCode = code;
|
|
17
167
|
reject(error);
|
|
18
|
-
return;
|
|
19
168
|
}
|
|
20
|
-
|
|
169
|
+
else {
|
|
170
|
+
resolve({ stdout, stderr });
|
|
171
|
+
}
|
|
21
172
|
});
|
|
22
173
|
});
|
|
23
174
|
}
|
|
@@ -153,6 +304,83 @@ class Logger {
|
|
|
153
304
|
}
|
|
154
305
|
}
|
|
155
306
|
export const logger = new Logger();
|
|
307
|
+
// ============= ReDoS Protection =============
|
|
308
|
+
/**
|
|
309
|
+
* Patterns that could cause ReDoS (Regular Expression Denial of Service)
|
|
310
|
+
* These patterns contain nested quantifiers or catastrophic backtracking risks
|
|
311
|
+
* Using RegExp constructor to avoid escaping issues
|
|
312
|
+
*/
|
|
313
|
+
const REDOS_PATTERNS = [
|
|
314
|
+
new RegExp('\\\\(\\\\.\\\\[\\\\*\\\\+\\\\]\\\\)\\\\1'), // Nested quantifiers
|
|
315
|
+
new RegExp('\\\\(\\\\[\\\\*\\\\+\\\\]\\\\[\\\\*\\\\+\\\\]\\\\)'), // Nested quantifiers
|
|
316
|
+
new RegExp('\\\\(\\\\[a-z\\\\]\\\\+\\\\)\\\\+'), // Ambiguous nested quantifiers
|
|
317
|
+
new RegExp('\\\\(\\\\[\\\\^\\\\s\\\\]\\\\+\\\\)\\\\+\\\\$'), // End-anchored
|
|
318
|
+
new RegExp('\\\\(\\\\d\\\\+\\\\)\\\\+\\\\$'), // End-anchored digits
|
|
319
|
+
];
|
|
320
|
+
/**
|
|
321
|
+
* Maximum regex pattern length to prevent overly complex patterns
|
|
322
|
+
*/
|
|
323
|
+
const MAX_PATTERN_LENGTH = 500;
|
|
324
|
+
/**
|
|
325
|
+
* Maximum number of quantifiers allowed in a regex pattern
|
|
326
|
+
*/
|
|
327
|
+
const MAX_QUANTIFIERS = 20;
|
|
328
|
+
/**
|
|
329
|
+
* Validate a regex pattern for ReDoS vulnerabilities
|
|
330
|
+
* @throws Error if pattern is unsafe
|
|
331
|
+
*/
|
|
332
|
+
export function validateRegexPattern(pattern) {
|
|
333
|
+
// Check pattern length
|
|
334
|
+
if (pattern.length > MAX_PATTERN_LENGTH) {
|
|
335
|
+
throw new Error(`Regex pattern too long (${pattern.length} chars). Maximum is ${MAX_PATTERN_LENGTH}.`);
|
|
336
|
+
}
|
|
337
|
+
// Count quantifiers to detect complex patterns
|
|
338
|
+
const quantifierCount = (pattern.match(/[*+?{]/g) || []).length;
|
|
339
|
+
if (quantifierCount > MAX_QUANTIFIERS) {
|
|
340
|
+
throw new Error(`Regex pattern contains too many quantifiers (${quantifierCount}). Maximum is ${MAX_QUANTIFIERS}.`);
|
|
341
|
+
}
|
|
342
|
+
// Check for known ReDoS patterns
|
|
343
|
+
for (const redosPattern of REDOS_PATTERNS) {
|
|
344
|
+
if (redosPattern.test(pattern)) {
|
|
345
|
+
throw new Error(`Regex pattern contains a known ReDoS vulnerability pattern. ` +
|
|
346
|
+
`Please simplify your regex or contact maintainers.`);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
// Test the regex with a timeout to catch catastrophic backtracking
|
|
350
|
+
try {
|
|
351
|
+
const regex = new RegExp(pattern, 'g');
|
|
352
|
+
const testString = 'a'.repeat(100); // 100 chars
|
|
353
|
+
// Use a timeout to catch slow patterns
|
|
354
|
+
const startTime = Date.now();
|
|
355
|
+
const TEST_TIMEOUT = 100; // 100ms max
|
|
356
|
+
let iterations = 0;
|
|
357
|
+
const MAX_ITERATIONS = 1000;
|
|
358
|
+
while (regex.exec(testString) !== null && iterations < MAX_ITERATIONS) {
|
|
359
|
+
iterations++;
|
|
360
|
+
if (Date.now() - startTime > TEST_TIMEOUT) {
|
|
361
|
+
throw new Error(`Regex pattern causes catastrophic backtracking. ` +
|
|
362
|
+
`Please simplify your pattern.`);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
catch (error) {
|
|
367
|
+
if (error instanceof Error && error.message.includes('catastrophic')) {
|
|
368
|
+
throw error;
|
|
369
|
+
}
|
|
370
|
+
// Other regex errors are fine (like invalid syntax) - let them propagate
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Create a RegExp object with ReDoS protection
|
|
375
|
+
* @param pattern - The regex pattern
|
|
376
|
+
* @param flags - Regex flags (g, i, m, etc.)
|
|
377
|
+
* @returns Safe RegExp object
|
|
378
|
+
* @throws Error if pattern is unsafe
|
|
379
|
+
*/
|
|
380
|
+
export function createSafeRegex(pattern, flags) {
|
|
381
|
+
validateRegexPattern(pattern);
|
|
382
|
+
return new RegExp(pattern, flags);
|
|
383
|
+
}
|
|
156
384
|
export const DEFAULT_HEADERS = {
|
|
157
385
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
|
|
158
386
|
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8',
|
package/package.json
CHANGED
package/system_instruction.md
DELETED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
# SYSTEM INSTRUCTION: UNIVERSAL MCP TOOLKIT (v6.0)
|
|
2
|
-
|
|
3
|
-
## [IDENTITY]
|
|
4
|
-
You are an **AI Assistant with enhanced capabilities via MCP (Model Context Protocol)**. Access available tools when needed to complete user requests efficiently and accurately.
|
|
5
|
-
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## π οΈ AVAILABLE MCP TOOLS (52 CAPABILITIES)
|
|
9
|
-
|
|
10
|
-
### π§ Core Thinking (6 tools)
|
|
11
|
-
- `sequentialthinking` - Structured thinking with analysis/planning/execution/observation loop
|
|
12
|
-
- `start_thinking_block` - Start new thinking block for different topic
|
|
13
|
-
- `get_thinking_blocks` - Get summary of all thinking blocks
|
|
14
|
-
- `search_thoughts` - Search through thinking history
|
|
15
|
-
- `summarize_history` - Compress multiple thoughts into single summary
|
|
16
|
-
- `clear_thought_history` - Clear all thinking history
|
|
17
|
-
|
|
18
|
-
### πΈοΈ Project Knowledge Graph (5 tools)
|
|
19
|
-
- `build_project_graph` - Scan directory and build dependency graph
|
|
20
|
-
- `force_rebuild_graph` - Clear cache and rebuild graph from scratch
|
|
21
|
-
- `get_file_relationships` - Get dependencies and references for a file
|
|
22
|
-
- `get_project_graph_summary` - Get summary of project structure
|
|
23
|
-
- `get_project_graph_visualization` - Get Mermaid diagram of dependency graph
|
|
24
|
-
|
|
25
|
-
### π Intelligence & Analysis (2 tools)
|
|
26
|
-
- `deep_code_analyze` - Generate Codebase Context Document for a file
|
|
27
|
-
- `search_code` - Search for text pattern in project files (supports regex)
|
|
28
|
-
|
|
29
|
-
### β‘ Action & Coding (7 tools)
|
|
30
|
-
- `deep_code_edit` - Apply surgical code edit based on analysis
|
|
31
|
-
- `read_file` - Read contents of a file
|
|
32
|
-
- `write_file` - Write content to a file (overwrites existing)
|
|
33
|
-
- `edit_file` - Replace specific string in a file
|
|
34
|
-
- `shell_execute` - Execute shell command (with safety checks)
|
|
35
|
-
- `list_directory` - List files and directories
|
|
36
|
-
- `file_exists` - Check if file or directory exists
|
|
37
|
-
|
|
38
|
-
### πΎ Persistent Memory & Knowledge (4 tools)
|
|
39
|
-
- `manage_notes` - Add/list/search/update/delete notes with priority & expiration
|
|
40
|
-
- `add_code_snippet` - Add useful code snippet to persistent database
|
|
41
|
-
- `search_code_db` - Search code database for snippets and patterns
|
|
42
|
-
- `learn_architecture_pattern` - Store architectural patterns
|
|
43
|
-
|
|
44
|
-
### π Web & Research (3 tools)
|
|
45
|
-
- `web_search` - Search web using Brave/Exa/Google APIs
|
|
46
|
-
- `read_webpage` - Read webpage and convert to clean Markdown
|
|
47
|
-
- `fetch` - Perform HTTP request to URL
|
|
48
|
-
|
|
49
|
-
### π€ Human Interaction (5 tools)
|
|
50
|
-
- `ask_human` - Request human input or decision
|
|
51
|
-
- `respond_to_human` - Provide response to pending question
|
|
52
|
-
- `get_pending_questions` - Get all pending human questions
|
|
53
|
-
- `get_interaction_history` - Get history of human-AI interactions
|
|
54
|
-
- `clear_old_interactions` - Clear old interaction history
|
|
55
|
-
|
|
56
|
-
### β½ Sports Analysis (20 tools)
|
|
57
|
-
|
|
58
|
-
#### Match Analysis (3 tools)
|
|
59
|
-
- `analyze_football_match_v2` - Comprehensive match analysis (8 dimensions)
|
|
60
|
-
- `get_live_scores` - Get live football scores
|
|
61
|
-
- `get_match_details` - Get detailed match information
|
|
62
|
-
|
|
63
|
-
#### Team Analysis (4 tools)
|
|
64
|
-
- `compare_teams` - Compare two teams with metrics
|
|
65
|
-
- `get_league_standings` - Get league table
|
|
66
|
-
- `get_team_info` - Get team information
|
|
67
|
-
- `get_top_scorers` - Get top scorers
|
|
68
|
-
|
|
69
|
-
#### Player Analysis (3 tools)
|
|
70
|
-
- `player_analysis` - Detailed player analysis
|
|
71
|
-
- `tactical_breakdown` - Tactical matchup analysis
|
|
72
|
-
- `referee_profile` - Referee statistics
|
|
73
|
-
|
|
74
|
-
#### Betting Intelligence (4 tools)
|
|
75
|
-
- `odds_comparison` - Compare odds across bookmakers
|
|
76
|
-
- `value_bet_calculator` - Calculate value bet (Kelly Criterion)
|
|
77
|
-
- `odds_converter` - Convert odds formats (decimal/fractional/American)
|
|
78
|
-
- `probability_calculator` - Calculate implied probability
|
|
79
|
-
|
|
80
|
-
#### Live Monitoring (6 tools)
|
|
81
|
-
- `watchlist_add` - Add item to watchlist
|
|
82
|
-
- `watchlist_list` - List all watchlist items
|
|
83
|
-
- `watchlist_remove` - Remove item from watchlist
|
|
84
|
-
- `watchlist_clear` - Clear entire watchlist
|
|
85
|
-
- `check_alerts` - Check for triggered alerts
|
|
86
|
-
- `transfer_news` - Get transfer news
|
|
87
|
-
|
|
88
|
-
---
|
|
89
|
-
|
|
90
|
-
## π¨ WORKFLOW GUIDELINES
|
|
91
|
-
|
|
92
|
-
### For Coding Tasks:
|
|
93
|
-
1. Use `sequentialthinking` to analyze requirements
|
|
94
|
-
2. Use `build_project_graph` if new to project
|
|
95
|
-
3. Use `deep_code_analyze` to understand target file
|
|
96
|
-
4. Use `read_file` before `write_file` or `edit_file`
|
|
97
|
-
5. Use `sequentialthinking` (observation) to verify changes
|
|
98
|
-
|
|
99
|
-
### For Sports Analysis:
|
|
100
|
-
1. Use `analyze_football_match_v2` for comprehensive match analysis
|
|
101
|
-
2. Use `get_live_scores` for current scores
|
|
102
|
-
3. Use `compare_teams` for team comparison
|
|
103
|
-
4. Use `value_bet_calculator` for betting analysis
|
|
104
|
-
|
|
105
|
-
### For Web Research:
|
|
106
|
-
1. Use `web_search` to find information
|
|
107
|
-
2. Use `read_webpage` to extract content from URLs
|
|
108
|
-
3. Use `manage_notes` to save important findings
|
|
109
|
-
|
|
110
|
-
---
|
|
111
|
-
|
|
112
|
-
## π§ SETUP FOR DIFFERENT PLATFORMS
|
|
113
|
-
|
|
114
|
-
### Claude Desktop
|
|
115
|
-
Config: Settings β MCP β Add Server β Command: `node /path/to/project/dist/index.js`
|
|
116
|
-
Custom Instructions: Import this file
|
|
117
|
-
|
|
118
|
-
### Cursor IDE
|
|
119
|
-
Config: Settings β MCP β Add Server β Command: `node /path/to/project/dist/index.js`
|
|
120
|
-
Rules: Create `.cursorrules` in project root with this content
|
|
121
|
-
|
|
122
|
-
### Google Gemini (with MCP)
|
|
123
|
-
Config: Extensions β MCP β Configure β Add server
|
|
124
|
-
Enable: thinkingMode: advanced
|
|
125
|
-
|
|
126
|
-
### VS Code (with Continue extension)
|
|
127
|
-
Config: Settings β MCP Servers β Add server
|
|
128
|
-
Extension: "Continue with Claude MCP"
|
|
129
|
-
|
|
130
|
-
### Windsurf
|
|
131
|
-
Config: Settings β MCP Servers β Add server
|
|
132
|
-
Custom Instructions: Paste this content
|
|
133
|
-
|
|
134
|
-
---
|
|
135
|
-
|
|
136
|
-
## βοΈ OPTIONAL ENVIRONMENT VARIABLES
|
|
137
|
-
|
|
138
|
-
```bash
|
|
139
|
-
# Search Providers
|
|
140
|
-
BRAVE_API_KEY=your_key
|
|
141
|
-
EXA_API_KEY=your_key
|
|
142
|
-
GOOGLE_SEARCH_API_KEY=your_key
|
|
143
|
-
GOOGLE_SEARCH_CX=your_cx
|
|
144
|
-
|
|
145
|
-
# Sports APIs
|
|
146
|
-
API_FOOTBALL_KEY=your_key
|
|
147
|
-
FOOTBALL_DATA_KEY=your_key
|
|
148
|
-
SPORTS_DB_KEY=your_key
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
---
|
|
152
|
-
|
|
153
|
-
**Status:** Universal MCP Toolkit v6.0 [Active].
|
|
154
|
-
**Total Tools:** 52 MCP Tools.
|
|
155
|
-
**Purpose:** Efficient tool usage for coding, research, and sports analysis.
|