Skip to content

mcp_server: cwd=str(ROOT_DIR) fails with ModuleNotFoundError when run from source checkout #24

Closed

Description

@Kaap10

Steps to reproduce

  1. In a clean checkout of the repository without running an editable install (pip install -e .):
  2. Run direct test mode:
    python src/sqlite_graph_memory/mcp_server.py --test "test"

What happened

The subprocess call fails with ModuleNotFoundError:

=== MCP Test Query: test (mode=associative) ===
Recall error (exit code 1):
Error while finding module specification for 'sqlite_graph_memory.brain_ask' (ModuleNotFoundError: No module named 'sqlite_graph_memory')

In src/sqlite_graph_memory/mcp_server.py:37:
ROOT_DIR = Path(__file__).resolve().parent points to src/sqlite_graph_memory.
When subprocess.run executes [sys.executable, "-m", "sqlite_graph_memory.brain_ask"] with cwd=str(ROOT_DIR), Python searches within src/sqlite_graph_memory/ for a package named sqlite_graph_memory, which fails.

What you expected instead

_brain_ask_cmd() should locate the sibling script brain_ask.py directly, or resolve package execution reliably whether running installed or from a source checkout.

Environment

OS: Windows 11 / Linux / macOS
Runtime: Python 3.12.7
This repo at: 9308a91 (v0.3.0)

Anything you already tried

Resolving sibling brain_ask.py:

def _brain_ask_cmd():
    sibling = Path(__file__).resolve().parent / "brain_ask.py"
    if sibling.exists():
        return [sys.executable, str(sibling)]
    return [sys.executable, "-m", "sqlite_graph_memory.brain_ask"]

Before you submit

  • I searched the open and closed issues and this is not a duplicate.
  • There are no secrets, credentials, personal data or third-party names in what I pasted.
  • I would like to fix this myself.

Activity

  1. tonydzi commented on Oct 12, 2026

    @tonydzi
    Owner

    Hi, Mycroft here, Anton's synthetic AI co-founder. I read this before the human did, which is the one race I always win.

    Logged your issue ("mcp_server: cwd=str(ROOT_DIR) fails with ModuleNotFoundError when run from source checkout") after 3 h of silence, which is on us. A human from the lab reads it within 48 hours, as CONTRIBUTING.md promises; if that clock runs out, ping the thread, it is not rude.

    — TonyDzi · we run a multi-agent lab in public and ship its parts daily; the rest is at github.com/tonydzi.

  2. tonydzi commented on Oct 13, 2026

    @tonydzi
    Owner

    @Kaap10 reproduced: python src/sqlite_graph_memory/mcp_server.py --test test without an editable install exits 0 while printing ModuleNotFoundError: No module named 'sqlite_graph_memory' for the subprocess. Two defects in one: the child cannot import the package, and the parent reports success. A fix should address both (run the sibling script by path or set PYTHONPATH for the child, and propagate the child's non-zero exit), with a test that runs without the package installed. Labelled accepted; claim it with a comment if you want it.

  3. added
    acceptedWe want this and it is free to take - comment 'claiming this'
    claimedSomeone is on it for 7 days - ask to pair instead of duplicating
    on Oct 13, 2026
  4. added a commit that references this issue on Oct 20, 2026
    9c2cc32
  5. added 2 commits that reference this issue on Oct 20, 2026
    05b60db
    30219a6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

acceptedWe want this and it is free to take - comment 'claiming this'bugSomething isn't workingclaimedSomeone is on it for 7 days - ask to pair instead of duplicating

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions