Skip to content

Feature Request: Support Remote MCP Client for thread_persist #7

@ferstar

Description

@ferstar

Summary

The thread_persist tool currently assumes the MCP client runs on the same machine as the Nowledge Mem server, making it impossible for remote MCP clients to save conversation threads.

Current Behavior

The thread_persist tool requires a project_path parameter pointing to the local directory where session files are stored:

thread_persist(
    client="claude-code",
    project_path="/home/user/projects/myapp",  # Local filesystem path
    persist_mode="current"
)

Problem: When the MCP server runs on a remote machine (e.g., accessed over network via Tailscale/VPN), the server cannot access the client's local filesystem paths, making thread persistence impossible.

Use Case

Scenario:

  • Nowledge Mem MCP server runs on Machine A (home server, always-on)
  • User works from Machine B (laptop) via VPN/Tailscale
  • User wants to persist conversation threads from Claude Code/Codex running on Machine B

Current limitation: The server on Machine A cannot read session files from Machine B's filesystem at paths like /home/user/.claude/sessions/.

Proposed Solutions

Option 1: Accept Session Content Directly (Recommended)

Add a new parameter to accept session file content instead of requiring a file path:

thread_persist(
    client="claude-code",
    session_content="<actual session JSON/data>",  # New parameter
    summary="Discussion about implementing auth",
    # No project_path needed
)

Benefits:

  • Works seamlessly for both local and remote clients
  • Client can read session files locally and pass content to server
  • Backward compatible (keep existing project_path parameter)

Option 2: File Upload Endpoint

Provide a separate endpoint for clients to upload session files:

# Step 1: Upload session file
upload_session(
    client="claude-code",
    session_file_content="...",
    filename="session-2025-11-09.json"
)

# Step 2: Persist uploaded session
thread_persist(
    client="claude-code",
    session_id="uploaded-session-id",
    summary="..."
)

Option 3: Client-Side Helper Tool

Provide a client-side MCP tool that:

  1. Reads local session files
  2. Calls the server's thread_persist with content payload
  3. Acts as a bridge between local filesystem and remote server

Implementation Considerations

Backward Compatibility

  • Keep existing project_path parameter for local deployments
  • Auto-detect: if session_content is provided, use it; otherwise fall back to project_path

Security

  • Validate and sanitize session content
  • Set reasonable size limits (e.g., 10MB per session)
  • Optional: compress large session data

API Design

{
  "method": "thread_persist",
  "params": {
    "client": "claude-code",
    
    // Option A: Local filesystem (current)
    "project_path": "/home/user/projects/myapp",
    "session_id": "optional-session-id",
    
    // Option B: Direct content (new)
    "session_content": {
      "messages": [...],
      "metadata": {...}
    },
    
    // Common parameters
    "summary": "Brief summary",
    "persist_mode": "current",
    "truncate_large_content": false
  }
}

Workarounds (Current)

The only current workaround is to:

  1. Run Nowledge Mem locally on each client machine, OR
  2. Manually copy session files to the server machine before calling thread_persist

Both workarounds defeat the purpose of centralized knowledge management.

Related Issues

Priority

P1 (High): This feature is essential for remote/multi-device workflows, which are core use cases for a centralized knowledge management system.

Willingness to Contribute

I'd be happy to help test this feature or provide sample session file formats for different clients.


Environment:

  • Nowledge Mem Version: 0.4.9
  • MCP Clients: Claude Code 2.0.36, Codex CLI
  • Network Setup: Remote server on Tailscale (100.64.0.184)
  • Current Limitation: Cannot persist threads from remote clients

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions