Home / MCP / Memory Cache Server
An MCP server that reduces token usage by caching data between language model interactions.
Configuration
View docs{
"mcpServers": {
"memory_cache": {
"command": "node",
"args": [
"/path/to/ib-mcp-cache-server/build/index.js"
],
"env": {
"MAX_ENTRIES": "5000",
"MAX_MEMORY": "209715200",
"DEFAULT_TTL": "7200",
"CHECK_INTERVAL": "120000",
"STATS_INTERVAL": "60000"
}
}
}
}Memory Cache Server is an MCP server that minimizes token usage by caching data between language model interactions. It works with any MCP client and supports caching across repeated reads or computations, so you get faster responses and lower token costs automatically.
You use Memory Cache Server by running it as an MCP-backed service that your MCP client talks to. The server automatically stores data when first encountered and serves cached data on subsequent requests, so repeated reads of the same content or repeated analyses become faster and cheaper in tokens.
Prerequisites: You need Node.js installed on your system. You also need an MCP client configured to communicate with MCP servers.
Manual installation steps: you can add the Memory Cache Server to your MCP client configuration so your client starts the server automatically when you begin interactions.
{
"mcpServers": {
"memory-cache": {
"command": "node",
"args": ["/path/to/ib-mcp-cache-server/build/index.js"]
}
}
}Configuration, environment overrides, and practical usage tips are provided to help you tune the server for your workload and to verify it is operating as expected.
Configure the server via a config.json file or environment variables. Key options include cache size, memory limit, default TTL, and cleanup intervals.
{
"maxEntries": 1000,
"maxMemory": 104857600,
"defaultTTL": 3600,
"checkInterval": 60000,
"statsInterval": 30000
}Override configuration using environment variables in your MCP settings. The following examples show how to set overrides for the cache parameters.
{
"mcpServers": {
"memory-cache": {
"command": "node",
"args": ["/path/to/build/index.js"],
"env": {
"MAX_ENTRIES": "5000",
"MAX_MEMORY": "209715200",
"DEFAULT_TTL": "7200",
"CHECK_INTERVAL": "120000",
"STATS_INTERVAL": "60000"
}
}
}
}Test scenarios help you verify the cache is active and providing token savings. Look for faster responses on repeated reads, consistent answers for unchanged content, and no unnecessary re-reading of data.
Fine-tune TTLs and memory limits to balance freshness and token savings. Monitor hit rates to determine whether to adjust TTLs or cache size for better performance.
The server automatically stores data on first encounter, serves cached data when available, and removes old or unused items based on your settings. It tracks statistics to help you evaluate cache effectiveness.
Treat cached data like any other sensitive data. Use appropriate access controls and avoid caching secrets or credentials in shared environments where unauthorized parties could retrieve them.
If you encounter issues, check the MCP client console for errors related to the memory-cache server. Ensure the server process is running and that the configured command and paths are correct.
Caches the contents of files when read for the first time and serves them from cache on subsequent reads to save tokens.
Stores results of computations or analyses so repeated inputs yield cached results, reducing token usage.
Keeps frequently accessed data in cache for quick retrieval across multiple requests until TTL expiry.