home / mcp / memory cache server
Memory Cache Server for use with supported MCP API Clients.
Configuration
View docs{
"mcpServers": {
"ibproduct-ib-mcp-cache-server": {
"command": "node",
"args": [
"/path/to/ib-mcp-cache-server/build/index.js"
],
"env": {
"MAX_MEMORY": "209715200",
"DEFAULT_TTL": "7200",
"MAX_ENTRIES": "5000",
"CHECK_INTERVAL": "120000",
"STATS_INTERVAL": "60000"
}
}
}
}Memory Cache Server is an MCP server that reduces token usage by caching data between language model interactions. It seamlessly stores and retrieves data so repeated requests don’t need to reprocess or retranslate the same information, boosting efficiency in any MCP workflow.
You can use Memory Cache Server with any MCP client to automatically cache data as you interact with language models. Once the server is running, it transparently stores data the first time you access it and serves cached results on subsequent requests. This results in faster responses for repeated operations, especially when reading the same files, performing repeated computations, or querying frequently accessed data.
Prerequisites: you need Node.js and npm installed on your system.
Clone the project repository and enter the directory.
git clone [email protected]:ibproduct/ib-mcp-cache-server
cd ib-mcp-cache-serverInstall dependencies and build the project.
npm install
npm run buildAdd the server to your MCP client configuration. This starts the server as a local stdio process using Node and the built entry point.
{
"mcpServers": {
"memory_cache": {
"command": "node",
"args": ["/path/to/ib-mcp-cache-server/build/index.js"]
}
}
}The server will automatically start when you use your MCP client, so you don’t need a separate start command beyond adding it to your client settings.
Configuration and environment setup are designed to be flexible. You can adjust how much data is cached, how long items stay in memory, and how often the server cleans up expired entries. You can also override defaults with environment variables or a custom config file.
Environment variables you can configure include cache size, memory limits, TTLs, and check intervals. These controls help you balance memory usage against token savings and cache effectiveness.
Testing the cache in practice helps you see the benefits. Try reading the same file or performing the same data analysis multiple times and observe faster responses as the cache serves repeated results.
You can tune the server with a configuration object or environment variables. Key settings include maximum entries, maximum memory, default TTL, periodic cleanup, and statistics intervals.
Configuration example (config.json) shows default values and explanations for each setting.
{
"maxEntries": 1000,
"maxMemory": 104857600,
"defaultTTL": 3600,
"checkInterval": 60000,
"statsInterval": 30000
}Override config.json settings using environment variables in your MCP client configuration. The following environment variables are recognized by Memory Cache Server.
{
"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"
}
}
}
}Try these scenarios to observe caching behavior.
File Reading Test: read a large file, then read it again. The second read should be faster as the content is cached.
Data Analysis Test: perform a calculation or analysis, then request the same analysis again. The second result uses cached computation.
Project Navigation Test: explore a project's structure and query the same files or directories again. Directory listings and file contents will be served from cache.
Caching happens automatically as you interact with language models through your MCP client. Monitor cache effectiveness with the provided statistics to optimize hit rates and TTLs.