npm package: @rockship/code-memory-mcp
Description: A powerful Model Context Protocol (MCP) server implementation for seamless code memory integration, enabling AI assistants to interact with code memory data
Latest version: 1.2.51

# Code Memory MCP

## Project Overview

`@rockship/code-memory-mcp` is a **Model Context Protocol (MCP) server** that provides a powerful code‑memory integration layer for AI assistants. It enables AI agents to store, retrieve, and reason over project‑specific code artifacts, facilitating context‑aware interactions such as code search, documentation lookup, and automated refactoring.

The server is built with **TypeScript** and runs on **Node.js**. It leverages the `@modelcontextprotocol/sdk` to expose a set of handlers for:
- Resource management (files, memories, configurations)
- Prompt handling (custom system prompts for AI)
- Tool integration (search, edit, version control)
- Real‑time streaming of logs and notifications via SSE or standard I/O.

## Key Features

- **MCP‑compliant** server exposing a standard API for AI assistants.
- Modular architecture with separate handlers for resources, prompts, tools, and completions.
- Supports multiple transport modes: `stdio`, `sse`, and HTTP.
- Automatic subscription handling for real‑time updates.
- Configurable via a simple `code-memory.json` project file.

## Installation

```bash
# Install dependencies
pnpm install

# Build the project
pnpm run build
```

## Usage

The entry point is the `code-memory-mcp` CLI. Choose a script to run:

```bash
# Run the default stdio server (recommended for local development)
pnpm start

# Run the Server‑Sent Events server
pnpm run start:sse

# Run the streamable HTTP server
pnpm run start:streamableHttp
```

You can also invoke a specific script directly:

```bash
node dist/index.js stdio   # or sse, streamableHttp, init
```

## Project Structure

```
src/
├─ adapters/            # Adapter layer for external clients
├─ interfaces/          # TypeScript interfaces for client & query contracts
├─ network/             # HTTP client implementation
├─ prompts/             # System prompts and instructions used by the AI
├─ server/              # Core server logic and handler registrations
│   ├─ handlers.ts      # Main request handlers
│   ├─ resources.ts     # Resource (file/memory) management
│   ├─ tools.ts         # Tool registration for AI actions
│   └─ …
├─ utils/               # Helper utilities and constants
├─ cli.ts               # CLI entry point for init script
├─ code-memory.ts       # Server factory and configuration
├─ index.ts             # Dynamic script loader
└─ sse.ts / stdio.ts   # Transport implementations
```

## Configuration

The server reads its configuration from `code-memory.json` (generated on first run). Example:

```json
{
  "project_id": "73d22542-6ef2-47c7-9a1e-89f6b5ed55e7",
  "project_name": "Code Memory MCP",
  "repo_url": "git@github.com:Rockship-Team/code-memory-mcp.git",
  "created_at": "2025-10-28T10:25:09.735230Z"
}
```

## Development

- **Watch mode**: `pnpm run watch` recompiles on file changes.
- **Testing**: Add tests under a `tests/` directory and run with your preferred test runner.
- **Release**: Use `pnpm run release` (changesets) to publish a new version.

## License

MIT © Rockship