Skip to content

Commit 10b39e6

Browse files
authored
Merge pull request #39 from toyamarinyon/stdio-updates
Add support for SUPABASE_ACCESS_TOKEN environment variable
2 parents d5507a8 + 04e8cb0 commit 10b39e6

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ Next, configure your MCP client (such as Cursor) to use this server. Most MCP cl
4444
}
4545
```
4646

47-
Replace `<personal-access-token>` with the token you created in step 1. If you are on Windows, you will need to [prefix this command](#windows).
47+
Replace `<personal-access-token>` with the token you created in step 1. Alternatively you can omit `--access-token` and instead set the `SUPABASE_ACCESS_TOKEN` environment variable to your personal access token (you will need to restart your MCP client after setting this). This allows you to keep your token out of version control if you plan on committing this configuration to a repository.
4848

49-
If your MCP client doesn't accept JSON, the direct CLI command is:
49+
If you are on Windows, you will need to [prefix the command](#windows). If your MCP client doesn't accept JSON, the direct CLI command is:
5050

5151
```shell
5252
npx -y @supabase/mcp-server-supabase@latest --access-token=<personal-access-token>

packages/mcp-server-supabase/src/stdio.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { createSupabaseMcpServer } from './server.js';
88
async function main() {
99
const {
1010
values: {
11-
['access-token']: accessToken,
11+
['access-token']: cliAccessToken,
1212
['api-url']: apiUrl,
1313
['version']: showVersion,
1414
},
@@ -31,9 +31,12 @@ async function main() {
3131
process.exit(0);
3232
}
3333

34+
// Use access token from CLI argument or environment variable
35+
const accessToken = cliAccessToken ?? process.env.SUPABASE_ACCESS_TOKEN;
36+
3437
if (!accessToken) {
3538
console.error(
36-
'Please provide a personal access token (PAT) with the --access-token flag'
39+
'Please provide a personal access token (PAT) with the --access-token flag or set the SUPABASE_ACCESS_TOKEN environment variable'
3740
);
3841
process.exit(1);
3942
}

0 commit comments

Comments
 (0)