Skip to content

Commit d34d28e

Browse files
committed
simplify env file creation
1 parent 7e165aa commit d34d28e

File tree

2 files changed

+23
-31
lines changed

2 files changed

+23
-31
lines changed

auth4genai/snippets/mcp/get-started/create-mcp-api.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ auth0 api post resource-servers --data '{
1818

1919
Note that `rfc9068_profile_authz` is used as the [token dialect](https://auth0.com/docs/get-started/apis/enable-role-based-access-control-for-apis#token-dialect-options) to include the `permissions` claim in the access token, which can be useful for the API to check user permissions without making additional calls.
2020

21-
For more details on protecting APIs with Auth0, check our [quickstarts](https://auth0.com/docs/quickstarts#backend%2Fapi).
21+
For more details on protecting APIs with Auth0, check our [quickstarts](https://auth0.com/docs/quickstarts#backend%2Fapi).

auth4genai/snippets/mcp/get-started/server-authorization.mdx

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -58,23 +58,19 @@ By the end of this quickstart, you will have an MCP server that:
5858

5959
## Create your environment file
6060

61-
In the `fastmcp-mcp-js` directory, create a new `.env` file and add the following content:
62-
63-
```shell
64-
AUTH0_DOMAIN=YOUR_AUTH0_DOMAIN
65-
AUTH0_AUDIENCE=http://localhost:3001
66-
PORT=3001
67-
MCP_SERVER_URL=http://localhost:3001
61+
In the `fastmcp-mcp-js` directory, run the following command to create a new `.env` file populated with all the required environment variables:
62+
63+
```shell wrap lines
64+
DOMAIN=$(auth0 tenants list --json | jq -r '.[] | select(.active == true) | .name') \
65+
&& touch .env \
66+
&& echo "AUTH0_DOMAIN=${DOMAIN}" > .env \
67+
&& echo "AUTH0_AUDIENCE=http://localhost:3001/" >> .env \
68+
&& echo "PORT=3001" >> .env \
69+
&& echo "MCP_SERVER_URL=http://localhost:3001/" >> .env \
70+
&& echo ".env file created with your Auth0 details:" \
71+
&& cat .env
6872
```
6973

70-
To get your Auth0 application’s `AUTH0_DOMAIN`, run the following command:
71-
72-
```shell
73-
auth0 tenants list
74-
```
75-
76-
Copy the domain under `TENANT` from the output and update the corresponding variable in the `.env` file.
77-
7874
## Run your MCP server
7975

8076
Run this command to start your server:
@@ -117,23 +113,19 @@ By the end of this quickstart, you will have an MCP server that:
117113

118114
## Create your environment file
119115

120-
In the `fastmcp-mcp-python` directory, create a new `.env` file and add the following content:
121-
122-
```shell
123-
AUTH0_DOMAIN=YOUR_AUTH0_DOMAIN
124-
AUTH0_AUDIENCE=http://localhost:3001
125-
PORT=3001
126-
MCP_SERVER_URL=http://localhost:3001
116+
In the `fastmcp-mcp-python` directory, run the following command to create a new `.env` file populated with all the required environment variables:
117+
118+
```shell wrap lines
119+
DOMAIN=$(auth0 tenants list --json | jq -r '.[] | select(.active == true) | .name') \
120+
&& touch .env \
121+
&& echo "AUTH0_DOMAIN=${DOMAIN}" > .env \
122+
&& echo "AUTH0_AUDIENCE=http://localhost:3001/" >> .env \
123+
&& echo "PORT=3001" >> .env \
124+
&& echo "MCP_SERVER_URL=http://localhost:3001/" >> .env \
125+
&& echo ".env file created with your Auth0 details:" \
126+
&& cat .env
127127
```
128128

129-
To get your Auth0 application’s `AUTH0_DOMAIN`, run the following command:
130-
131-
```shell
132-
auth0 tenants list
133-
```
134-
135-
Copy the domain under `TENANT` from the output and update the corresponding variable in the `.env` file.
136-
137129
## Run your MCP server
138130

139131
Run this command to start your server:

0 commit comments

Comments
 (0)