Skip to content

Commit 73e724e

Browse files
committed
Implement MCP service as a standalone Next.js app
- Introduced a new `@stackframe/mcp` application to handle the Stack Auth Model Context Protocol (MCP) server. - Updated package.json and pnpm-lock.yaml to include necessary dependencies and configurations for the MCP service. - Added environment variables for MCP configuration in `.env` and `.env.development`. - Created routes for handling MCP requests, including health checks and internal API endpoints. - Implemented setup page with installation instructions for various IDEs and tools. - Updated GitHub workflows to start the MCP service in the background during tests. - Removed the MCP-related code from the backend and adjusted references accordingly. This change enhances the modularity of the Stack Auth system by separating the MCP functionality into its own service, improving maintainability and scalability.
1 parent 9ec32ce commit 73e724e

34 files changed

Lines changed: 1425 additions & 353 deletions

File tree

.github/workflows/db-migration-backwards-compatibility.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,16 @@ jobs:
169169
wait-for: 30s
170170
log-output-if: true
171171

172+
- name: Start stack-mcp in background
173+
uses: JarvusInnovations/background-action@v1.0.7
174+
with:
175+
run: pnpm run start:mcp --log-order=stream &
176+
wait-on: |
177+
http://localhost:8142/health
178+
tail: true
179+
wait-for: 30s
180+
log-output-if: true
181+
172182
- name: Start stack-dashboard in background
173183
uses: JarvusInnovations/background-action@v1.0.7
174184
with:
@@ -366,6 +376,16 @@ jobs:
366376
wait-for: 30s
367377
log-output-if: true
368378

379+
- name: Start stack-mcp in background
380+
uses: JarvusInnovations/background-action@v1.0.7
381+
with:
382+
run: pnpm run start:mcp --log-order=stream &
383+
wait-on: |
384+
http://localhost:8142/health
385+
tail: true
386+
wait-for: 30s
387+
log-output-if: true
388+
369389
- name: Start stack-dashboard in background
370390
uses: JarvusInnovations/background-action@v1.0.7
371391
with:

.github/workflows/e2e-api-tests-local-emulator.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,15 @@ jobs:
119119
tail: true
120120
wait-for: 30s
121121
log-output-if: true
122+
- name: Start stack-mcp in background
123+
uses: JarvusInnovations/background-action@v1.0.7
124+
with:
125+
run: pnpm run start:mcp --log-order=stream &
126+
wait-on: |
127+
http://localhost:8142/health
128+
tail: true
129+
wait-for: 30s
130+
log-output-if: true
122131

123132
- name: Start stack-dashboard in background
124133
uses: JarvusInnovations/background-action@v1.0.7

.github/workflows/e2e-api-tests.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,15 @@ jobs:
125125
tail: true
126126
wait-for: 30s
127127
log-output-if: true
128+
- name: Start stack-mcp in background
129+
uses: JarvusInnovations/background-action@v1.0.7
130+
with:
131+
run: pnpm run start:mcp --log-order=stream &
132+
wait-on: |
133+
http://localhost:8142/health
134+
tail: true
135+
wait-for: 30s
136+
log-output-if: true
128137
- name: Start stack-dashboard in background
129138
uses: JarvusInnovations/background-action@v1.0.7
130139
with:

.github/workflows/e2e-custom-base-port-api-tests.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,15 @@ jobs:
118118
tail: true
119119
wait-for: 30s
120120
log-output-if: true
121+
- name: Start stack-mcp in background
122+
uses: JarvusInnovations/background-action@v1.0.7
123+
with:
124+
run: pnpm run start:mcp --log-order=stream &
125+
wait-on: |
126+
http://localhost:6742/health
127+
tail: true
128+
wait-for: 30s
129+
log-output-if: true
121130
- name: Start stack-dashboard in background
122131
uses: JarvusInnovations/background-action@v1.0.7
123132
with:

apps/backend/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@
8787
"@stackframe/stack-shared": "workspace:*",
8888
"@upstash/qstash": "^2.8.2",
8989
"@vercel/functions": "^2.0.0",
90-
"@vercel/mcp-adapter": "^1.0.0",
9190
"@vercel/otel": "^1.10.4",
9291
"@vercel/sandbox": "^1.2.0",
9392
"ai": "^6.0.0",

apps/backend/src/app/api/internal/[transport]/route.ts

Lines changed: 0 additions & 105 deletions
This file was deleted.

apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/(overview)/setup-page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const buildInstallPrompt = (command: string) => deindent`
3737
3838
${command}
3939
40-
After it finishes, verify that the Stack Auth MCP server is registered in your AI client config — name: \`stack-auth\`, transport: \`http\`, URL: \`https://mcp.stack-auth.com/\`. The command above should handle this automatically; if for any reason it didn't, please add the MCP server manually so you have live access to Stack Auth docs and APIs.
40+
After it finishes, verify that the Stack Auth MCP server is registered in your AI client config — name: \`stack-auth\`, transport: \`http\`, URL: \`https://mcp.stack-auth.com/mcp\`. The command above should handle this automatically; if for any reason it didn't, please add the MCP server manually so you have live access to Stack Auth docs and APIs.
4141
`;
4242

4343
export default function SetupPage(props: { toMetrics: () => void }) {

apps/dev-launchpad/public/index.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,15 @@ <h2 style="margin-top: 64px;">Background services</h2>
164164
img: "https://www.svgrepo.com/show/340122/datastore.svg",
165165
importance: 2,
166166
},
167+
{
168+
name: "MCP",
169+
portSuffix: "42",
170+
description: [
171+
"Src: ./apps/mcp",
172+
"Prod: https://mcp.stack-auth.com/mcp",
173+
],
174+
importance: 2,
175+
},
167176
{
168177
name: "Demo app",
169178
portSuffix: "03",

apps/e2e/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
STACK_DASHBOARD_BASE_URL=
22
STACK_BACKEND_BASE_URL=
3+
STACK_MCP_BASE_URL=
34
STACK_INTERNAL_PROJECT_ID=
45
STACK_INTERNAL_PROJECT_CLIENT_KEY=
56
STACK_INTERNAL_PROJECT_SERVER_KEY=

apps/e2e/.env.development

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
STACK_DASHBOARD_BASE_URL=http://localhost:${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}01
22
STACK_BACKEND_BASE_URL=http://localhost:${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}02
3+
STACK_MCP_BASE_URL=http://localhost:${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}42
34
STACK_INTERNAL_PROJECT_ID=internal
45
STACK_INTERNAL_PROJECT_CLIENT_KEY=this-publishable-client-key-is-for-local-development-only
56
STACK_INTERNAL_PROJECT_SERVER_KEY=this-secret-server-key-is-for-local-development-only

0 commit comments

Comments
 (0)