Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

where to put the .env file? #6

Closed
pr0j3c7t0dd opened this issue Dec 4, 2024 · 6 comments
Closed

where to put the .env file? #6

pr0j3c7t0dd opened this issue Dec 4, 2024 · 6 comments

Comments

@pr0j3c7t0dd
Copy link

Hello,

I can run the debugging application fine and connect to data, but where do I put the .env obsidian rest api key in the published version of the Claude mcp config? Should the api key be added to the JSON added to the claude_desktop_config.json?

Thanks.

@pr0j3c7t0dd
Copy link
Author

pr0j3c7t0dd commented Dec 4, 2024

FYI... I also tried something like the following standard from other servers, but it didn't work...

"mcp-obsidian": {
      "command": "uvx",
      "args": [
        "mcp-obsidian"
      ],
      "env": {
        "OBSIDIAN_API_KEY": "[OBSIDIAN REST API KEY HERE]"
      }
    }

@pr0j3c7t0dd
Copy link
Author

pr0j3c7t0dd commented Dec 4, 2024

I also tried the local config, but still getting claude error:

"mcp-obsidian": {
      "command": "uv",
      "args": [
        "--directory",
        "[MY PATH]/mcp-obsidian",
        "run",
        "mcp-obsidian"
      ]
    }

@rahimnathwani
Copy link

On MacOS, you can put the .env file in your home directory (e.g. /Users/rahim). The load_dotenv() will look for the .env file in the current directory and, if it doesn't find it, will traverse parent directories until it finds one.

@MarkusPfundstein
Copy link
Owner

MarkusPfundstein commented Dec 5, 2024

Good point. I asked here: modelcontextprotocol/docs#74

This works for me:

    "mcp-obsidian": {
      "command": "uvx",
      "args": [
        "mcp-obsidian"
      ],
      "env": {
        "OBSIDIAN_API_KEY" : "<YOUR_OBSIDIAN_KEY>"
      }
    }

In future debugging, I added the following: When the server can't find the .env, it will print the working directory in the RuntimeError. This should help you to figure out where to put it. Make sure to fetch v0.2.1

@pr0j3c7t0dd
Copy link
Author

Thanks, sorry, I think this was a good fix, but I'm having another issue. Please close this and I'll raise another one... Thanks again for your time!

@pr0j3c7t0dd
Copy link
Author

I've verified that passing the API key via the following works well!
"env": {
"OBSIDIAN_API_KEY" : "<YOUR_OBSIDIAN_KEY>"
}

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

No branches or pull requests

3 participants