Skip to content

Commit 2d142e4

Browse files
authored
fix: whoami sample code (#38)
1 parent 073aaea commit 2d142e4

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

packages/sample-servers/src/whoami/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ if (!MCP_AUTH_ISSUER) {
3535
throw new Error('MCP_AUTH_ISSUER environment variable is required');
3636
}
3737

38+
const authServerConfig = await fetchServerConfig(MCP_AUTH_ISSUER, { type: 'oidc' });
39+
3840
const mcpAuth = new MCPAuth({
39-
server: await fetchServerConfig(MCP_AUTH_ISSUER, { type: 'oidc' }),
41+
server: authServerConfig,
4042
});
4143

4244
/**
@@ -47,7 +49,7 @@ const mcpAuth = new MCPAuth({
4749
* @type {(token: string) => Promise<AuthInfo>}
4850
*/
4951
const verifyToken = async (token) => {
50-
const { issuer, userinfoEndpoint } = mcpAuth.config.server.metadata;
52+
const { issuer, userinfoEndpoint } = authServerConfig.metadata;
5153

5254
if (!userinfoEndpoint) {
5355
throw new Error('Userinfo endpoint is not configured in the server metadata');

packages/sample-servers/tsup.todo-manager.dev.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { config as baseConfig } from './tsup.config.js';
44

55
export default defineConfig({
66
...baseConfig,
7-
watch: ['src/**/*.ts', '.env', '../../.env', '*.config.ts'],
7+
entry: { 'todo-manager/index': 'src/todo-manager/index.ts' },
8+
watch: ['src/todo-manager/**/*.ts', '.env'],
89
onSuccess: 'node ./dist/todo-manager/index.js',
910
});

packages/sample-servers/tsup.whoami.dev.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { config as baseConfig } from './tsup.config.js';
44

55
export default defineConfig({
66
...baseConfig,
7-
entry: { 'todo-manager/index': 'src/todo-manager/todo-service/index.ts' },
8-
watch: ['src/todo-manager/**/*.ts', '.env', '../../.env'],
9-
onSuccess: 'node ./dist/todo-manager/index.js',
7+
entry: { 'whoami/index': 'src/whoami/index.ts' },
8+
watch: ['src/whoami/**/*.ts', '.env'],
9+
onSuccess: 'node ./dist/whoami/index.js',
1010
});

0 commit comments

Comments
 (0)