Developer Memory MCP Server
A Go-based server that captures, persists, and serves project context (code, diffs, logs, etc.) for LLM-powered assistants. Think of it as a per-repo, structured memory vault that integrates cleanly with Git and VSCode.
Features
- 🕵️♂️ File Watching: Monitors file changes in real-time using fsnotify
- 💾 Context Storage: Persists context in BoltDB with versioning
- 🔄 Git Integration: Captures commit history and diffs
- 🌐 API Server: REST and WebSocket endpoints for context access
- 🤖 LLM Ready: Structured data format for LLM consumption
Architecture```
+--------------------+
| VSCode Plugin |
+---------+----------+
|
v
+---------------+---------------+
| Developer Memory MCP Server |
+---------------+---------------+
|
+-------------------+--------------------+
| | |
v v v
+---------------+ +----------------+ +----------------+
| File Watcher | | Git Context | | Build/Run Logs |
+---------------+ +----------------+ +----------------+
| | |
v v v
+-----------------------------+
| Context Store (BoltDB) |
+-----------------------------+
|
v
+----------------------+
| LLM Integration |
+----------------------+
## Getting Started
### Prerequisites
- Go 1.21 or later
- Git repository to monitor
### Installation
1. Clone the repository:```bash
git clone https://github.com/agaonker/mcp-memory-server.git
cd mcp-memory-server
```
2. Install dependencies:```bash
go mod download
```
3. Build the server:```bash
go build -o mcp-server cmd/server/main.go
```
### Usage
1. Start the server:```bash
./mcp-server -repo /path/to/your/repo -port 9000
```
2. The server will:
- Create a `.mcp` directory in your repository
- Start watching for file changes
- Begin capturing context
3. Access the API:
- REST endpoints:
- `GET /context` - Get all context
- `POST /context/add` - Add new context
- `POST /context/clear` - Clear all context
- `POST /context/search` - Search context
- WebSocket endpoint:
- `ws://localhost:9000/ws` - Real-time updates
## API Reference
### REST Endpoints
#### GET /context
Retrieves all context for the repository.
Response:```json
{
"files": {
"path/to/file": {
"type": "write",
"timestamp": "2024-03-21T10:00:00Z",
"size": 1024,
"mode": "-rw-r--r--"
}
},
"commits": {
"abc123": {
"message": "Initial commit",
"author": "John Doe",
"timestamp": "2024-03-21T09:00:00Z"
}
}
}
POST /context/add
Adds new context to the store.
Request:```json
{
"files": {
"path/to/file": {
"type": "write",
"timestamp": "2024-03-21T10:00:00Z"
}
}
}
#### POST /context/clear
Clears all context from the store.
#### POST /context/search
Searches for context matching the query.
Request:```json
{
"type": "write",
"timestamp": "2024-03-21T10:00:00Z"
}
WebSocket Events
The WebSocket connection receives real-time updates about file changes:```json
{
"type": "file_change",
"path": "path/to/file",
"event": "write",
"timestamp": "2024-03-21T10:00:00Z"
}
## Development
### Project Structure```
.
├── cmd/
│ └── server/
│ └── main.go
├── internal/
│ ├── server/
│ │ └── server.go
│ ├── store/
│ │ └── store.go
│ └── watcher/
│ └── watcher.go
├── go.mod
└── README.md
