You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement response truncation and caching in Smart MCP Proxy. Add intelligent response handling to prevent LLM context bloat, with support for pagination and JSON structure analysis. Update README with new features and configuration options.
Copy file name to clipboardExpand all lines: README.md
+85Lines changed: 85 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -105,6 +105,9 @@ Smart MCP Proxy
105
105
-**Intelligent Tool Discovery**: Automatically discover and index tools from multiple MCP servers
106
106
-**Semantic Search**: Find relevant tools using natural language queries
107
107
-**Tool Aggregation**: Combine tools from multiple upstream servers into a single interface
108
+
-**Response Truncation & Caching**: Automatically truncate large tool responses to prevent LLM context bloat
109
+
-**Smart Pagination**: Access cached response data through pagination with the `read_cache` tool
110
+
-**JSON Structure Analysis**: Intelligent splitting of JSON responses by record arrays
108
111
-**HTTP & Stdio Support**: Connect to MCP servers via HTTP or stdio protocols
109
112
-**Persistent Storage**: Cache tool metadata and connection information
110
113
-**Configuration Management**: Flexible JSON-based configuration with environment variable support
@@ -146,6 +149,7 @@ Create a `config.json` file:
146
149
"enable_tray": true,
147
150
"top_k": 5,
148
151
"tools_limit": 15,
152
+
"tool_response_limit": 20000,
149
153
"mcpServers": [
150
154
{
151
155
"name": "Local Python Server",
@@ -218,6 +222,87 @@ curl -X POST http://localhost:8080/mcp/ \
218
222
219
223
The proxy automatically discovers and indexes tools from configured upstream servers. Tools are available through the unified interface with semantic search capabilities.
220
224
225
+
## Response Truncation & Caching
226
+
227
+
The Smart MCP Proxy includes intelligent response truncation to prevent LLM context bloat while maintaining access to complete data through caching and pagination.
228
+
229
+
### How It Works
230
+
231
+
1.**Automatic Truncation**: Tool responses exceeding the configured limit (default: 20,000 characters) are automatically truncated
232
+
2.**JSON Analysis**: The proxy analyzes JSON responses to identify record arrays for intelligent splitting
233
+
3.**Smart Caching**: Complete responses are cached with 2-hour TTL for pagination access
234
+
4.**Fallback Handling**: Non-JSON or unstructured responses get simple truncation
0 commit comments