0.2.0 • Published 7 months ago

@nakamurau1/memory-bank-mcp-server v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Memory Bank MCP Server

Model Context Protocol (MCP) server for interacting with Cline's Memory Bank documentation system.

Installation

Using Docker

# Build the Docker image
docker build -t memory-bank-mcp-server .

# Run the Docker container
docker run -i --rm \
  --mount type=bind,src=/absolute/path/to/your/project,dst=/projects/your-project \
  memory-bank-mcp-server /projects

Using npm

npm install @nakamurau1/memory-bank-mcp-server

Using npx (No Installation Required)

You can run the server directly without installation using npx:

npx @nakamurau1/memory-bank-mcp-server

A shorter alias is also available:

npx --package=@nakamurau1/memory-bank-mcp-server mbmcp

Features

  • loadMemoryBank tool: Loads and combines core Memory Bank files from a specified project directory.

Usage

Command Line

Run the server directly from the command line:

npx @nakamurau1/memory-bank-mcp-server

The server will start and listen for MCP requests on standard input/output.

Configuration with Claude Desktop or other MCP clients

Using NPX

Add this to your claude_desktop_config.json or similar configuration file:

{
  "mcpServers": {
    "memoryBank": {
      "command": "npx",
      "args": [
        "-y",
        "--package=@nakamurau1/memory-bank-mcp-server",
        "memory-bank-mcp-server"
      ]
    }
  }
}

You can also use the shorter alias command:

{
  "mcpServers": {
    "memoryBank": {
      "command": "npx",
      "args": [
        "-y",
        "--package=@nakamurau1/memory-bank-mcp-server",
        "mbmcp"
      ]
    }
  }
}

Using Docker

Add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "memoryBank": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "--mount",
        "type=bind,src=/absolute/path/to/your/project,dst=/projects/your-project",
        "memory-bank-mcp-server",
        "/projects"
      ]
    }
  }
}

Note: All directories must be mounted to /projects by default. You can mount multiple directories by adding more --mount arguments. Using the ro flag will make the directory read-only (e.g., dst=/projects/your-project,ro).

As an MCP Server in Code

// Example server startup
import { startServer } from '@nakamurau1/memory-bank-mcp-server';

// Start the server with default settings
startServer();

From a Client

// Example client code using @modelcontextprotocol/sdk
import { McpClient, StdioClientTransport } from '@modelcontextprotocol/sdk';

// Connect to the server
const transport = new StdioClientTransport({ command: 'npx @nakamurau1/memory-bank-mcp-server' });
const client = new McpClient({ transport });

// Call the loadMemoryBank tool
const result = await client.callTool("loadMemoryBank", {
  projectPath: "/absolute/path/to/your/project",
  memoryBankDir: "memory-bank" // Optional, defaults to "memory-bank"
});

console.log(result);

File Format

The loadMemoryBank tool uses the following format for separating files in the output:

=== [1/6] MEMORY BANK: projectbrief.md ===

[Content of projectbrief.md]

=== [2/6] MEMORY BANK: productContext.md ===

[Content of productContext.md]

...

Development

Docker Build

Build the Docker image:

docker build -t memory-bank-mcp-server .

Setup

  1. Clone the repository
  2. Install dependencies:
    npm install
  3. Build the project:
    npm run build

Testing

Run the tests:

npm test

This will run the integration tests which verify the server's functionality by:

  • Starting the MCP server as a child process
  • Sending JSONRPC requests to the server
  • Verifying the response contains properly formatted Memory Bank content

Note: The tests expect the output to be formatted as shown in the "File Format" section above. If you modify the output format in memoryBankLoader.ts, make sure to update the test expectations in integration.test.ts accordingly.

Configuration

Tool Parameters

  • projectPath (required): Absolute path to your project directory.
  • memoryBankDir (optional): Name of the directory containing Memory Bank files (defaults to "memory-bank").

Troubleshooting

Common Issues

  • File Access Errors: Ensure the server has read permissions for the specified projectPath.
  • Invalid Path Errors: Make sure projectPath is an absolute path and correctly points to a directory containing Memory Bank files.
  • Memory Bank Files Not Found: Check that your memory bank files are in the correct directory (default: memory-bank/).

Logging

If you encounter issues, you can debug by examining the server output for error messages.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

MIT

0.2.0

7 months ago

0.1.2

7 months ago

0.1.1

7 months ago

0.1.0

7 months ago