MCP server for transferring conversation context between AI chats
npm install remix-mcpA Model Context Protocol (MCP) server for transferring conversation context between AI chat sessions. This server maintains a tree structure of conversations with their message history, allowing you to branch conversations and search through them.
- Conversation Branching: Create new conversations that branch from existing ones, forming a tree structure
- Message Storage: Save chat messages with proper ordering (using a linked list with prev/next message IDs)
- Tree Navigation: View the entire conversation tree or subtrees
- Full-Text Search: Search messages across parent or child conversations using PostgreSQL's powerful text search
- Persistent Storage: Uses PostgreSQL for reliable, scalable storage
``bash`
npm install
npm run build
The server connects to PostgreSQL using connection parameters that can be specified in three ways (in order of precedence):
1. Command-line arguments
2. Environment variables
3. Default values
| Parameter | CLI Argument | CLI Short | Environment Variable | Default |
|-----------|--------------|-----------|---------------------|---------|
| Host | --host | - | PGHOST | localhost |--port
| Port | | -p | PGPORT | 5432 |--user
| User | | -U | PGUSER | postgres |--password
| Password | | -W | PGPASSWORD | (empty) |--database
| Database | | -d | PGDATABASE | remix_mcp |--connection-string
| Connection String | | - | - | - |
Note: If --connection-string is provided, it takes precedence over individual parameters.
Security Warning: Passing passwords via command-line arguments (--password) or connection strings can expose them in process listings, shell history, and configuration files. For production deployments:PGPASSWORD
- Use environment variables () instead.pgpass
- Use PostgreSQL's file for secure credential management
- Ensure configuration files with passwords have restricted permissions (chmod 600)
`json`
"servers": {
"remix": {
"command": "npx",
"args": [
"remix-mcp",
"--host", "localhost",
"--port", "5432",
"--user", "myuser",
"--password", "mypassword",
"--database", "remix_mcp"
]
}
}
Or using a connection string:
`json`
"servers": {
"remix": {
"command": "npx",
"args": [
"remix-mcp",
"--connection-string", "postgresql://myuser:mypassword@localhost:5432/remix_mcp"
]
}
}
`json`
{
"mcpServers": {
"remix": {
"command": "npx",
"args": [
"remix-mcp",
"--host", "localhost",
"--port", "5432",
"--user", "myuser",
"--password", "mypassword",
"--database", "remix_mcp"
]
}
}
}
Or using a connection string:
`json`
{
"mcpServers": {
"remix": {
"command": "npx",
"args": [
"remix-mcp",
"--connection-string", "postgresql://myuser:mypassword@localhost:5432/remix_mcp"
]
}
}
}
You can also set environment variables:
`bash`
export PGHOST=localhost
export PGPORT=5432
export PGUSER=myuser
export PGPASSWORD=mypassword
export PGDATABASE=remix_mcp
npx remix-mcp
Save chat messages to create a new conversation or branch from an existing one.
Parameters:
- new_conversation_id (required): Unique ID for the new conversationtitle
- (required): Title for the conversationtask_description
- (required): Description of the task or contextmessages
- (required): Array of message objects with:author
- : Either "User" or "Copilot"payload
- : The message contentold_conversation_id
- (optional): Parent conversation ID to branch from
Example:
`json`
{
"new_conversation_id": "conv-123",
"title": "Implementing User Authentication",
"task_description": "Discussing best practices for OAuth2 implementation",
"messages": [
{
"author": "User",
"payload": "How do I implement OAuth2 in Node.js?"
},
{
"author": "Copilot",
"payload": "Here are the steps for implementing OAuth2..."
}
],
"old_conversation_id": "conv-100"
}
Quick prompt (usage guide):
- Remix this conversation: “remix this conversation, Save all the messages in this chat that you remember. New id: , task_description: , title: ”
Retrieve all messages from a conversation to continue it in a new AI chat session.
Parameters:
- conversation_id (required): ID of the conversation to retrieve
Returns: Array of messages with IDs, author, payload, and timestamps.
Quick prompt:
- “continue conversation ”
View the conversation tree structure as JSON.
Parameters:
- root_conversation (optional): Start from a specific conversation. If omitted, shows all root conversations.
Returns: Nested JSON tree with conversation IDs, titles, task descriptions, and children.
Quick prompt:
- “show conversation tree starting at ” (or omit for all)
Search messages from a child conversation up through all parent conversations.
Parameters:
- keywords (required): Array of search keywordschild_conversation_id
- (required): Starting conversation ID
Returns: Matching messages with full metadata.
Quick prompt:
- “search parents of for keywords: ”
Search messages from a parent conversation down through all child conversations recursively.
Parameters:
- keywords (required): Array of search keywordsparent_conversation_id
- (required): Starting conversation ID
Returns: Matching messages with full metadata.
Quick prompt:
- “search children of for keywords: ”
`mermaid`
flowchart TD
A["Client (Claude / VS Code MCP)"] -->|Call tool| B[remix_conversation]
A -->|Call tool| C[continue_conversation]
A -->|Call tool| D[read_conversation_tree]
A -->|Call tool| E[search_parents]
A -->|Call tool| F[search_children]
B -->|writes| G[(PostgreSQL DB)]
C -->|reads| G
D -->|reads| G
E -->|reads FTS + tree| G
F -->|reads FTS + tree| G
: Primary key
- parent_id: Reference to parent conversation (for tree structure)
- title: Conversation title
- task_description: Task context
- created_at: Timestamp$3
- id: Primary key
- conversation_id: Reference to conversation
- prev_message_id: Previous message in the linked list
- next_message_id: Next message in the linked list
- author: "User" or "Copilot"
- payload: Message content
- created_at: TimestampFull-Text Search: PostgreSQL's native full-text search with GIN indexes is used for efficient message searching.
Development
$3
`bash
npm run build
`$3
`bash
npm run watch
`Changelog
- 0.3.0 (Current)
- BREAKING: Migrated from SQLite to PostgreSQL
- Added support for connection parameters via command-line arguments:
--host, --port, --user, --password, --database
- Support for PostgreSQL connection strings via --connection-string
- Replaced SQLite FTS5 with PostgreSQL full-text search
- All database operations are now async
- Environment variable support: PGHOST, PGPORT, PGUSER, PGPASSWORD, PGDATABASE
- Added graceful shutdown handling for database connections- 0.2.0
- BREAKING: Replaced
--db-path parameter with --connection-string` parameter- 0.1.1
- Added quick usage prompt for remixing a conversation
- Added installation guides for VS Code MCP extension and Claude Desktop
- Added Mermaid diagram showing tool flows
- Updated publish workflow trigger and version bump
MIT