Integrate Long-Term Memory with Qoder via MCP
Overview
AnalyticDB for PostgreSQLLong-Term Memory MCP Server is an MCP (Model Context Protocol)-based service that gives the Qoder AI coding assistant persistent memory across sessions. MCP is a standard protocol defined by Anthropic, and Qoder natively supports it. After you register the adbpgmem MCP Server, Qoder AI can proactively call memory tools during conversations to create, read, update, and delete knowledge.
How It Works
AnalyticDB for PostgreSQLLong-Term Memory MCP Server communicates with Qoder through stdio (standard input/output). The workflow is as follows:
-
Register: Configure the adbpgmem MCP Server on the Qoder MCP settings page or in the
settings.jsonfile. -
On-demand startup: Qoder starts the MCP Server subprocess on demand via
uvx(uvpackage manager) without pre-installation. -
Tool invocation: Qoder AI proactively calls MCP tools such as
add_memory,search_memoriesbased on the conversation context. -
API forwarding: MCP Server converts tool calls into REST API requests to perform actual memory operations.
All MCP tool calls are autonomously decided by Qoder AI. No manual triggering is required.
Six MCP Tools
|
Tool |
Function |
Description |
|
|
Save memory |
Supports |
|
|
Semantic memory search |
Matches by meaning rather than keywords to find relevant past experiences |
|
|
List all memories with pagination |
Browse all memories in the memory store with pagination |
|
|
Update specified memory |
Update a specified memory by |
|
|
Delete a single memory |
Remove expired or unused memories by |
|
|
Bulk delete all memories |
Requires |
Use Cases
-
Manual memory control: You want precise control over what knowledge is recorded, rather than fully automatic background saving.
-
On-demand history query: Qoder AI proactively searches the memory store for relevant knowledge when needed.
-
Memory CRUD operations: You need fine-grained management of memories such as updating and deleting.
-
Team-shared configuration: Share the same memory service configuration across team members through the project-level
.qoder/settings.jsonfile.
Install MCP Server
Prerequisites
-
Qoder IDE or Qoder CLI is installed and functional.
-
Python >= 3.10.
-
uvpackage manager is installed (for on-demand startup viauvx, recommended). -
Obtained the AnalyticDB for PostgreSQLContext service API URL and token.
-
Obtained the
adbpgmem_mcp_selfhostedproject source code adbpgmem-mcp-server-0.2.0.tar.gz.Extract the archive to a directory named
adbpgmem_mcp_selfhosted. All paths in the following steps refer to this extracted directory.
Installation
MCP Server does not require pre-installation. uvx creates a temporary virtual environment from the local project path on demand and starts the service. You only need to ensure that the source path is accessible.
# Verify the source path is accessible
ls /path/to/adbpgmem_mcp_selfhosted/pyproject.toml
# The file info should be displayed, confirming the path is correct
Configure MCP Server
Configure the connection parameters for the AnalyticDB for PostgreSQLLong-Term Memory service.
Parameters
|
Parameter |
Type |
Required |
Description |
|
|
string |
Yes |
AnalyticDB for PostgreSQLAPI URL of the long-term memory service |
|
|
string |
Yes |
Service authentication token (sensitive) |
|
|
string |
No |
User identifier. Defaults to the system username |
Configuration Source Priority
|
Priority |
Source |
Description |
|
1 |
Environment variable |
Injected through the |
|
2 |
|
Environment variable pointing to the configuration file directory |
|
3 |
|
Project-level configuration file |
|
4 |
|
Global-level configuration file |
Method 1: Inject via the env Field During MCP Registration (Recommended)
Inject environment variables directly in the settings.json env field when registering the MCP Server. No additional configuration files are needed. See Register MCP Server.
Method 2: Manually Create a Configuration File
Create a ~/.qoder/adbpgmem.conf (global) or .qoder/adbpgmem.conf (project-level) configuration file:
# Global configuration (applies to all projects)
mkdir -p ~/.qoder
cat > ~/.qoder/adbpgmem.conf << 'EOF'
ADBPGMEM_API_URL="https://api-longmemory-cn-chengdu.opentrust.net"
ADBPGMEM_API_TOKEN="sk-your-token-here"
ADBPGMEM_USER_ID="your.username"
EOF
# Project-level configuration (applies to the current project only)
mkdir -p .qoder
cat > .qoder/adbpgmem.conf << 'EOF'
ADBPGMEM_API_URL="https://api-longmemory-cn-chengdu.opentrust.net"
ADBPGMEM_API_TOKEN="sk-your-token-here"
ADBPGMEM_USER_ID="your.username"
EOF
adbpgmem.conf contains the API token. Do not commit it to Git. Add .qoder/adbpgmem.conf to your .gitignore file.
Configuration File Description
The configuration file uses the KEY="VALUE" format, one entry per line. If the configuration is missing, MCP Server logs a warning and continues to start, but API calls will fail.
Register MCP Server
Qoder uses the settings.json file to register the MCP Server. You can register it globally or at the project level.
Global Registration (Recommended)
Edit ~/.qoder/settings.json to apply the configuration to all projects:
{
"mcpServers": {
"adbpgmem": {
"command": "uvx",
"args": ["--from", "/path/to/adbpgmem_mcp_selfhosted", "adbpgmem-mcp-server"],
"env": {
"ADBPGMEM_API_URL": "https://api-longmemory-cn-chengdu.opentrust.net",
"ADBPGMEM_API_TOKEN": "sk-your-token-here",
"ADBPGMEM_USER_ID": "your.username"
}
}
}
}
Field Description
|
Field |
Description |
|
|
Startup command. Uses |
|
|
Command arguments. |
|
|
Environment variables injected through the |
Project-Level Registration
Create .qoder/settings.json in the project root directory. This configuration applies only to the current project and can be committed to version control for team sharing:
{
"mcpServers": {
"adbpgmem": {
"command": "uvx",
"args": ["--from", "/path/to/adbpgmem_mcp_selfhosted", "adbpgmem-mcp-server"],
"env": {
"ADBPGMEM_API_URL": "https://api-longmemory-cn-chengdu.opentrust.net",
"ADBPGMEM_API_TOKEN": "sk-your-token-here",
"ADBPGMEM_USER_ID": "your.username"
}
}
}
}
You can commit the project-level .qoder/settings.json to the Git repository so team members share the configuration after cloning. Do not include real API tokens.
Configure AGENTS.md Behavior Instructions (Optional)
Add the following content to AGENTS.md (Qoder's project-level AI behavior specification file, automatically loaded at each session start) in the project root directory. This guides Qoder AI to proactively use memory tools. Without this configuration, MCP tools still work, but Qoder AI will not proactively call them.
# MCP Servers
- **adbpgmem**: Persistent memory service. At the start of each session, use search_memories
to search for relevant context. Use add_memory to save architectural decisions,
debugging experience, and coding patterns. Use update_memory when memory content
changes. Better to save too much than to miss something.
How to Use MCP Tools
Verify Registration
On the Qoder IDE MCP settings page, verify that adbpgmem shows a Connected status.
Invocation
Qoder AI autonomously calls MCP tools based on conversation context. You trigger them through natural language:
|
What You Say |
Tool Called by Qoder AI |
|
Remember: the project uses PostgreSQL 15 |
|
|
Search for previous memories about database configuration |
|
|
List all memories |
|
|
Update the content of this memory |
|
|
Delete this memory |
|
Detailed Tool Usage
add_memory (Save Memory)
Save development knowledge to the AnalyticDB for PostgreSQLLong-Term Memory store for cross-session retrieval.
|
Parameter |
Type |
Default |
Description |
|
|
string |
- |
Memory content to save (required) |
|
|
string |
Config value |
User identifier. Defaults to the configured |
|
|
bool |
|
Whether to let the server extract atomic facts |
Usage Example
You: Remember: this project uses Go 1.22 + Gin framework, ORM uses GORM v2, database is PostgreSQL 15
Qoder AI calls add_memory → Server stores the memory
When infer=true is enabled, the server automatically extracts atomic facts from the content:
You: Remember these project decisions: we chose Kafka over RabbitMQ because we need
message replay capability; chose PostgreSQL for JSONB support; frontend uses React + TypeScript
Qoder AI calls add_memory(infer=true) → Server extracts 3 independent atomic facts and stores them separately
search_memories (Semantic Memory Search)
Search the memory store for relevant historical memories by meaning rather than keywords.
|
Parameter |
Type |
Default |
Description |
|
|
string |
- |
Search query text (required) |
|
|
string |
Config value |
User identifier |
|
|
int |
|
Number of results to return |
Usage Example
You: Search for previous memories about database selection
Qoder AI calls search_memories → Returns semantically matched historical memories
list_memories (List Memories)
List all memories in the memory store with pagination.
|
Parameter |
Type |
Default |
Description |
|
|
string |
Config value |
User identifier |
|
|
int |
|
Page number |
|
|
int |
|
Items per page |
update_memory (Update Memory)
Update the content of a specified memory by memory_id.
|
Parameter |
Type |
Description |
|
|
string |
UUID of the memory (required) |
|
|
string |
New memory content (required) |
delete_memory (Delete Single Memory)
Delete a specified memory by memory_id.
|
Parameter |
Type |
Description |
|
|
string |
UUID of the memory (required) |
delete_all_memories (Bulk Delete)
Delete all memories of the specified user. Memories are deleted one by one instead of clearing the entire collection.
|
Parameter |
Type |
Default |
Description |
|
|
string |
Config value |
User identifier |
|
|
bool |
|
Confirm deletion. Must be set to |
The confirm parameter must be explicitly set to true. Otherwise, the operation is rejected.
Typical Usage Scenarios
Scenario 1: Save Project Tech Stack Information
When you start a new project, you can record the tech stack information for use in subsequent sessions.
You: Remember: this project uses Python 3.11 + FastAPI, database is PostgreSQL 15,
cache uses Redis 7, message queue uses Kafka 3.5
Qoder AI calls add_memory → Saves tech stack info to the memory store
Qoder AI Behavior:
-
Recognizes the user's request to save knowledge.
-
Calls
add_memoryto save the tech stack information to the memory store. -
Outputs: Memory saved.
Scenario 2: Cross-Session Knowledge Reuse
In a previous session, API design conventions were established. The current session requires developing new API endpoints.
Session 1:
You: Remember: our APIs uniformly use RESTful style, pagination uses page/page_size,
sorting uses sort=field:asc|desc, error responses include type/title/status/detail fieldsSession 2 (days later, a new session):
You: Help me design a new user management API endpoint
Qoder AI: Based on the API design conventions saved earlier, I'll design the user management endpoint...
[Automatically outputs the design following team conventions without needing repeated instructions]
Qoder AI automatically retrieves the conventions established in the previous session from the memory store. New sessions can directly reuse team consensus without repeated communication.