You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`--transport <stdio|http>` – Transport to use (`stdio` by default). Note that HTTP transport automatically provides both HTTP and SSE endpoints.
1138
1139
-`--port <number>` – Port to listen on when using `http` transport (default `3000`).
1139
-
-`--api-key <key>` – API key for authentication. You can get your API key by creating an account at [context7.com/dashboard](https://context7.com/dashboard).
1140
+
-`--api-key <key>` – API key for authentication (or set `CONTEXT7_API_KEY` env var). You can get your API key by creating an account at [context7.com/dashboard](https://context7.com/dashboard).
1140
1141
1141
1142
Example with HTTP transport and port 8080:
1142
1143
@@ -1150,6 +1151,39 @@ Another example with stdio transport:
1150
1151
bun run dist/index.js --transport stdio --api-key YOUR_API_KEY
1151
1152
```
1152
1153
1154
+
### Environment Variables
1155
+
1156
+
You can use the `CONTEXT7_API_KEY` environment variable instead of passing the `--api-key` flag. This is useful for:
1157
+
1158
+
- Storing API keys securely in `.env` files
1159
+
- Integration with MCP server setups that use dotenv
1160
+
- Tools that prefer environment variable configuration
1161
+
1162
+
**Note:** The `--api-key` CLI flag takes precedence over the environment variable when both are provided.
1163
+
1164
+
**Example with .env file:**
1165
+
1166
+
```bash
1167
+
# .env
1168
+
CONTEXT7_API_KEY=your_api_key_here
1169
+
```
1170
+
1171
+
**Example MCP configuration using environment variable:**
0 commit comments