Skip to content

Commit 617f5a1

Browse files
Merge pull request #18 from chickymonkeys/env-support
API Key additional handling
2 parents 47b4fd6 + 77bdc9e commit 617f5a1

5 files changed

Lines changed: 198 additions & 463 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules/
22
build/
33
*.log
4-
.env*
4+
.env*
5+
.kiro

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,49 @@ Or use NPX to not have to install it locally (recommended for macos):
120120
}
121121
}
122122
```
123+
In case the MCP Client is not able to parse the Perplexity API Key from the
124+
environment using methods like `"${env:PERPLEXITY_API_KEY}"` common in modern
125+
AI Coding Agents (e.g. Kiro), there are two fallback solutions:
126+
127+
**Command-Line Argument**: Pass the API key directly as a command-line argument, and you can even try to see whether "${env:PERPLEXITY_API_KEY}" works in there.
128+
129+
```json
130+
{
131+
"mcpServers": {
132+
"perplexity": {
133+
"command": "node",
134+
"args": [
135+
"/path/to/perplexity-server/build/index.js",
136+
"--api-key",
137+
"your_api_key_here"
138+
],
139+
"disabled": false,
140+
"autoApprove": []
141+
}
142+
}
143+
}
144+
```
145+
146+
**Read an explicit `.env` File**: specify the location of the project `.env` file with the environment variables and API keys for your current project with the `--cwd` command-line argument, and the MCP Server will read the `.env` file from the directory finding the Perplexity API Key from there.
147+
148+
```json
149+
{
150+
"mcpServers": {
151+
"perplexity": {
152+
"command": "node",
153+
"args": [
154+
"/path/to/perplexity-server/build/index.js",
155+
"--cwd",
156+
"/path/to/your/project"
157+
],
158+
"disabled": false,
159+
"autoApprove": []
160+
}
161+
}
162+
}
163+
```
164+
**Priority Order**: Command-line argument > Environment variable > .env file with `--cwd` (path needed)
165+
123166
## Star History
124167

125168
[![Star History Chart](https://api.star-history.com/svg?repos=DaInfernalCoder/perplexity-mcp&type=Timeline)](https://www.star-history.com/#DaInfernalCoder/perplexity-mcp&Timeline)

0 commit comments

Comments
 (0)