@nakamurau1/memory-bank-mcp-server v0.2.0
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 /projectsUsing npm
npm install @nakamurau1/memory-bank-mcp-serverUsing npx (No Installation Required)
You can run the server directly without installation using npx:
npx @nakamurau1/memory-bank-mcp-serverA shorter alias is also available:
npx --package=@nakamurau1/memory-bank-mcp-server mbmcpFeatures
loadMemoryBanktool: 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-serverThe 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
/projectsby default. You can mount multiple directories by adding more--mountarguments. Using theroflag 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
- Clone the repository
- Install dependencies:
npm install - Build the project:
npm run build
Testing
Run the tests:
npm testThis 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
projectPathis 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.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
MIT