Skip to content

Commit 439d7b1

Browse files
committed
feat: Experimenting with oauth
1 parent 9522625 commit 439d7b1

File tree

5 files changed

+17
-1
lines changed

5 files changed

+17
-1
lines changed

.actor/input_schema.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@
5050
"prefill": {
5151
"query": "hello world"
5252
}
53+
},
54+
"authorizationServer": {
55+
"title": "Authorization server",
56+
"type": "string",
57+
"description": "Authorization server",
58+
"editor": "textfield"
5359
}
5460
}
5561
}

src/actor/const.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export enum Routes {
88
MCP = '/mcp',
99
SSE = '/sse',
1010
MESSAGE = '/message',
11+
WELL_KNOWN_OAUTH_AUTHORIZATION_SERVER = '/.well-known/oauth-authorization-server',
1112
}
1213

1314
export const getHelpMessage = (host: string) => `To interact with the server you can either:

src/actor/server.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { getActorRunData } from './utils.js';
1919
export function createExpressApp(
2020
host: string,
2121
mcpServer: ActorsMcpServer,
22+
authorizationServer: string,
2223
): express.Express {
2324
const app = express();
2425
let transportSSE: SSEServerTransport;
@@ -64,6 +65,13 @@ export function createExpressApp(
6465
res.status(200).end();
6566
});
6667

68+
app.head(Routes.WELL_KNOWN_OAUTH_AUTHORIZATION_SERVER, async (_req: Request, res: Response) => {
69+
// The endpoint is the same
70+
const response = await fetch(`${authorizationServer}${Routes.WELL_KNOWN_OAUTH_AUTHORIZATION_SERVER}`);
71+
const data = await response.json();
72+
res.status(200).json(data).end();
73+
});
74+
6775
app.get(Routes.SSE, async (req: Request, res: Response) => {
6876
try {
6977
log.info(`Received GET message at: ${Routes.SSE}`);

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ if (STANDBY_MODE) {
3535
enableDefaultActors: false,
3636
});
3737

38-
const app = createExpressApp(HOST, mcpServer);
38+
const app = createExpressApp(HOST, mcpServer, input.authorizationServer);
3939
log.info('Actor is running in the STANDBY mode.');
4040

4141
// Load only Actors specified in the input

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ export type Input = {
183183
maxActorMemoryBytes?: number;
184184
debugActor?: string;
185185
debugActorInput?: unknown;
186+
authorizationServer?: string;
186187
};
187188

188189
export interface ToolCacheEntry {

0 commit comments

Comments
 (0)