MO

Momento MCP Server for Scalable Low Latency Caching

Boost app performance and cut costs with the Momento MCP server for scalable, low-latency caching that handles load at any scale.

Quick Install
npx -y @momentohq/mcp-momento

Overview

The Momento MCP Server is a lightweight Model Context Protocol (MCP) server implementation that connects MCP-aware tools (like MCP Inspector or LLM apps) to Momento Cache. It exposes a small set of cache and control-plane operations (get, set, list-caches, create-cache, delete-cache) so applications and developer tools can store and retrieve context quickly during model interactions.

Designed for simplicity and low latency, this server is distributed as an npm package (@gomomento/mcp-momento) and can be run directly with npx or embedded into local development workflows. It is useful when you need a minimal, standards-compatible cache endpoint backed by Momento that can handle high-throughput read/write patterns typical of model context usage.

Features

  • Minimal MCP server implementing cache read/write and basic cache management operations
  • Backed by Momento Cache for low-latency, in-memory storage
  • Supports configurable default TTL (time-to-live) for cached items
  • Control-plane operations to list, create, and delete caches (requires super user API key)
  • Quickstart-ready via npx; easy to integrate with MCP Inspector and local tools
  • Simple environment configuration for cache name and credentials

Installation / Configuration

Install the package with npm or invoke it directly with npx.

Install locally:

npm install @gomomento/mcp-momento

Run via npx (recommended for quick runs):

npx -y @gomomento/mcp-momento

Environment variables

# required
export MOMENTO_API_KEY="your-api-key"

# optional (defaults shown)
export MOMENTO_CACHE_NAME="mcp-momento"      # default: mcp-momento
export DEFAULT_TTL_SECONDS=60               # default: 60 seconds

Notes:

  • To run control-plane operations (list-caches, create-cache, delete-cache) you must use a super user Momento API key from the Momento Console.
  • The server reads MOMENTO_API_KEY at startup to authenticate to the Momento service.

Available Tools

The server exposes the following MCP tools (operations). Inputs and typical return shapes are summarized below.

ToolInputsReturns
getkey (string), cacheName (string, optional)Hit (value) / Miss / Error
setkey (string), value (string), ttl (int, optional), cacheName (string, optional)Success / Error
list-cachesSuccess (comma-separated cache names) / Error
create-cachename (string)Success / Error
delete-cachename (string)Success / Error

Example: get a key

{
  "tool": "get",
  "input": {
    "key": "session:1234",
    "cacheName": "mcp-momento"
  }
}

Example: set a value with TTL

{
  "tool": "set",
  "input": {
    "key": "session:1234",
    "value": "{\"user\":\"alice\"}",
    "ttl": 300
  }
}

Usage with MCP Inspector or NPX

Run with MCP Inspector:

# using the MCP Inspector to run the server
npx -y @modelcontextprotocol/inspector npx @gomomento/mcp-momento@latest

Example NPX integration (e.g., Claude Desktop mcpServers config)

{
  "mcpServers": {
    "momento": {
      "command": "npx",
      "args": ["-y", "@gomomento/mcp-momento"],
      "env": {
        "MOMENTO_API_KEY": "your-api-key",
        "MOMENTO_CACHE_NAME": "your-cache-name",
        "DEFAULT_TTL_SECONDS": 60
      }
    }
  }
}

Local Development

Steps to run and modify the server locally:

  1. Clone the repository: git clone https://github.com/momentohq/mcp-momento
  2. Install dependencies:
npm install
  1. Build:
npm run build
  1. Run with MCP Inspector:
export MOMENTO_API_KEY="your-api-key"
npx @modelcontextprotocol/inspector node dist/index.js

Use Cases

  • LLM conversation state: persist recent messages or dialogue state between model requests to keep context small and fast to access.
  • Shared ephemeral state: cache intermediate computations, embeddings, or retrieval results for repeated model queries.
  • Tooling and debugging: use MCP Inspector with this server to inspect cache behavior, validate TTLs, and prototype cache-backed model flows.
  • Dynamic cache management: create or delete caches programmatically from tools or CI (requires a super user API key), useful for test isolation or automated workspace setup.

Concrete example — session cache for an assistant:

  1. On user message, call set with key “session:{sessionId}” and store serialized context with TTL 600.
  2. On subsequent requests, call get to retrieve the session context and append recent messages as model context.
  3. If you need to reset a session, call delete-cache (or set an empty value) as part of session teardown.
  • GitHub: https://github.com/momentohq/mcp-momento
  • npm package: https://www.npmjs.com/package/@gomomento/mcp-momento
  • Momento Console (to create API keys): https://console.gomomento.com/
  • MCP Inspector: https://www.npmjs.com/package/@modelcontextprotocol/inspector

This MCP server is intended as a compact, easy-to-run bridge between MCP-compatible clients and Momento Cache, enabling low-latency caching patterns for model-driven applications.