Skip to content

Commit e5e43af

Browse files
committed
disable resource caching
1 parent 89e2913 commit e5e43af

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

libs/remix-ai-core/src/inferencers/mcp/mcpInferencer.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ export class MCPInferencer extends RemoteInferencer implements ICompletions, IGe
301301
private mcpClients: Map<string, MCPClient> = new Map();
302302
private connectionStatuses: Map<string, IMCPConnectionStatus> = new Map();
303303
private resourceCache: Map<string, IMCPResourceContent> = new Map();
304-
private cacheTimeout: number = 300000; // 5 minutes
304+
private cacheTimeout: number = 5000;
305305
private intentAnalyzer: IntentAnalyzer = new IntentAnalyzer();
306306
private resourceScoring: ResourceScoring = new ResourceScoring();
307307
private remixMCPServer?: any; // Internal RemixMCPServer instance
@@ -560,7 +560,7 @@ export class MCPInferencer extends RemoteInferencer implements ICompletions, IGe
560560

561561
try {
562562
// Try to get from cache first
563-
let content = this.resourceCache.get(resource.uri);
563+
let content = null //this.resourceCache.get(resource.uri);
564564
if (!content) {
565565
const client = this.mcpClients.get(serverName);
566566
if (client) {
@@ -620,15 +620,7 @@ export class MCPInferencer extends RemoteInferencer implements ICompletions, IGe
620620
continue;
621621
}
622622

623-
let content = this.resourceCache.get(resource.uri);
624-
if (!content) {
625-
content = await client.readResource(resource.uri);
626-
this.resourceCache.set(resource.uri, content);
627-
setTimeout(() => {
628-
this.resourceCache.delete(resource.uri);
629-
}, this.cacheTimeout);
630-
}
631-
623+
const content = await client.readResource(resource.uri);
632624
if (content.text) {
633625
mcpContext += `\n--- Resource: ${resource.name} (${resource.uri}) ---\n`;
634626
mcpContext += content.text;
@@ -661,7 +653,7 @@ export class MCPInferencer extends RemoteInferencer implements ICompletions, IGe
661653
console.log(`[MCP Inferencer] Sending request with ${llmFormattedTools.length} available tools in LLM format`);
662654

663655
try {
664-
const response = await super.answer(prompt, enhancedOptions);
656+
const response = await super.answer(enrichedPrompt, enhancedOptions);
665657
console.log('got initial response', response)
666658

667659
const toolExecutionCallback = async (tool_calls) => {

libs/remix-ai-core/src/remix-mcp-server/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export async function createRemixMCPServer(
9191
maxConcurrentTools: 10,
9292
toolTimeout: 30000,
9393
resourceCacheTTL: 300000,
94-
enableResourceCache: true,
94+
enableResourceCache: false,
9595
security: enableSecurity ? {
9696
enablePermissions: securityConfig.requirePermissions,
9797
enableAuditLog: securityConfig.enableAuditLog,

0 commit comments

Comments
 (0)