Commit dbf1022
committed
Refactor MCP server with modular architecture and stateless HTTP support
Major refactoring to improve code organization, testing, and HTTP transport:
- Fix stateless HTTP mode by moving stateless_http parameter to run() method
- Extract tools into separate modules (chat.py, search.py, datasources.py)
- Add comprehensive test suite (76% coverage with 27 passing tests)
- Implement XML response transformer for 60-90% token reduction in search results
- Add shared error handling utilities and data source conversion helpers
- Create modular core components (client.py, config.py, logging.py)
- Simplify chat API to accept string IDs instead of complex objects
- Add request ID tracing for better debugging
- Clean up unnecessary files and comments
- Add .mcp.json to .gitignore for local configuration
This refactoring improves maintainability, reduces code duplication from ~1140 lines,
and ensures the server works reliably with both stdio and stateless HTTP transports.1 parent 781f545 commit dbf1022
File tree
20 files changed
+1925
-862
lines changed- src
- core
- tests
- tools
- utils
20 files changed
+1925
-862
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 13 | + | |
20 | 14 | | |
21 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
22 | 19 | | |
23 | 20 | | |
24 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
12 | 19 | | |
13 | 20 | | |
14 | 21 | | |
| |||
20 | 27 | | |
21 | 28 | | |
22 | 29 | | |
23 | | - | |
| 30 | + | |
0 commit comments