MemoryMesh MCP server

Store and query structured data in local knowledge graphs.
Back to servers
Provider
CheMiguel23
Release date
Dec 06, 2024
Language
TypeScript
Stats
194 stars

MemoryMesh is a knowledge graph server designed for AI models, with particular emphasis on text-based RPGs and interactive storytelling. It helps maintain consistent, structured memory across conversations by organizing information into nodes and edges, enabling richer and more dynamic interactions.

Installation

Option 1: Installing via Smithery (Recommended)

The easiest way to install MemoryMesh for Claude Desktop is via Smithery:

npx -y @smithery/cli install memorymesh --client claude

Option 2: Manual Installation

Prerequisites

  • Node.js: Version 18 or higher
  • npm: Included with Node.js
  • Claude for Desktop: Latest version

Installation Steps

  1. Clone the Repository:
git clone https://github.com/CheMiguel23/memorymesh.git
cd memorymesh
  1. Install Dependencies:
npm install
  1. Build the Project:
npm run build
  1. Configure Claude Desktop:

Open your Claude Desktop configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Add an entry for memorymesh to the mcpServers section:

"mcpServers": {
  "memorymesh": {
    "command": "node", 
    "args": ["/ABSOLUTE/PATH/TO/YOUR/PROJECT/memorymesh/dist/index.js"]
  }
}

Replace /ABSOLUTE/PATH/TO/YOUR/PROJECT/ with the actual path to your project directory.

  1. Restart Claude Desktop

Verify Installation

  1. Start Claude Desktop
  2. Open a new chat
  3. Look for the MCP plugin icon in the top-right corner
  4. Click the plugin icon - you should see "memorymesh" in the list of connected servers
  5. Click the hammer icon - you should see tools like add_npc, update_npc, etc.

Understanding MemoryMesh

Key Concepts

Nodes

Nodes represent entities within the knowledge graph. Each node has:

  • name: A unique identifier
  • nodeType: The type of the node (e.g., npc, artifact, location)
  • metadata: An array of descriptive strings
  • weight: (Optional) A numerical value between 0 and 1

Example node:

{
  "name": "Aragorn",
  "nodeType": "player_character",
  "metadata": [
    "Race: Human",
    "Class: Ranger",
    "Skills: Tracking, Swordsmanship",
    "Affiliation: Fellowship of the Ring"
  ]
}

Edges

Edges represent relationships between nodes. Each edge has:

  • from: Source node name
  • to: Target node name
  • edgeType: Relationship type (e.g., owns, located_in)

Example edge:

{
  "from": "Aragorn",
  "to": "Andúril",
  "edgeType": "owns"
}

Schemas

Schemas define the structure of your data and drive the automatic generation of tools.

Schema Location

Place schema files (.schema.json) in the dist/data/schemas directory. MemoryMesh detects and processes these on startup.

Schema Structure

File naming convention: add_[name].schema.json (e.g., add_npc.schema.json)

Schema file structure:

  • name: Schema identifier (must start with add_)
  • description: Description for the generated tool
  • properties: Defines each property with type, description, and constraints
  • additionalProperties: Boolean indicating if extra attributes are allowed

Example schema:

{
  "name": "add_npc",
  "description": "Schema for adding an NPC to the memory",
  "properties": {
    "name": {
      "type": "string",
      "description": "A unique identifier for the NPC",
      "required": true
    },
    "race": {
      "type": "string",
      "description": "The species or race of the NPC",
      "required": true,
      "enum": [
        "Human",
        "Elf",
        "Dwarf",
        "Orc",
        "Goblin"
      ]
    },
    "currentLocation": {
      "type": "string",
      "description": "The current location of the NPC",
      "required": true,
      "relationship": {
        "edgeType": "located_in",
        "description": "The current location of the NPC"
      }
    }
  },
  "additionalProperties": true
}

Dynamic Tools

MemoryMesh automatically generates three tools for each schema:

  • add_[entity]: Creates new instances
  • update_[entity]: Modifies existing entities
  • delete_[entity]: Removes entities

Usage

SchemaManager Tool

MemoryMesh includes a SchemaManager tool to simplify schema creation and editing. This visual interface makes it easy to define data structures without writing JSON directly.

Memory Viewer

The Memory Viewer helps visualize and inspect the knowledge graph contents with features like:

  • Graph visualization
  • Node inspection
  • Edge exploration
  • Search and filtering
  • Table view
  • Raw JSON view
  • Stats panel

Prompt Examples

For optimal results, use Claude's "Projects" feature with custom instructions. Example prompt:

You are a helpful AI assistant managing a knowledge graph for a text-based RPG. You have access to the following tools: add_npc, update_npc, delete_npc, add_location, update_location, delete_location, and other tools for managing the game world.

When the user provides input, first process it using your available tools to update the knowledge graph. Then, respond in a way that is appropriate for a text-based RPG.

Troubleshooting

  • Server not appearing in Claude:

    • Check paths in claude_desktop_config.json
    • Verify the dist directory contains compiled JavaScript files
    • Check Claude Desktop logs
  • Tools not showing up:

    • Ensure npm run build completed without errors
    • Verify schema files are correctly placed in dist/data/schemas
    • Check server console output for errors

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later