Skip to content

fix(mcp): use load_dotenv(override=True) to prioritize .env over shell vars#1206

Closed
dirkenglund wants to merge 1 commit intogetzep:mainfrom
dirkenglund:main
Closed

fix(mcp): use load_dotenv(override=True) to prioritize .env over shell vars#1206
dirkenglund wants to merge 1 commit intogetzep:mainfrom
dirkenglund:main

Conversation

@dirkenglund
Copy link
Copy Markdown

Summary

  • Fixed MCP server connecting to wrong Neo4j database when shell has conflicting NEO4J_URI

Problem

When the shell environment has NEO4J_URI set (e.g., from .zshrc), the default load_dotenv() behavior doesn't override it. This causes the MCP server to connect to the wrong database.

Solution

Added override=True to load_dotenv() calls, ensuring the .env file credentials take precedence over any pre-existing shell environment variables.

Test plan

  • Verified MCP server connects to correct database specified in .env
  • Tested with conflicting NEO4J_URI in shell environment

🤖 Generated with Claude Code

…l vars

When shell environment has NEO4J_URI set (e.g., from .zshrc), the default
load_dotenv() behavior doesn't override it, causing the MCP server to
connect to the wrong database.

This fix ensures the .env file credentials take precedence over any
pre-existing shell environment variables.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@danielchalef
Copy link
Copy Markdown
Member


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@dirkenglund dirkenglund closed this by deleting the head repository Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants