Skip to content

Commit 1e5a79c

Browse files
committed
fix: agent api not working
1 parent 5016875 commit 1e5a79c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/agent-api/src/functions/chats-post.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const titleSystemPrompt = `Create a title for this chat session, based on the us
4242

4343
export async function postChats(request: HttpRequest, context: InvocationContext): Promise<HttpResponseInit> {
4444
const azureOpenAiEndpoint = process.env.AZURE_OPENAI_API_ENDPOINT;
45-
const burgerMcpEndpoint = process.env.BURGER_MCP_ENDPOINT;
45+
const burgerMcpUrl = process.env.BURGER_MCP_URL ?? 'http://localhost:3000/mcp';
4646

4747
try {
4848
const requestBody = (await request.json()) as AIChatCompletionRequest;
@@ -63,8 +63,8 @@ export async function postChats(request: HttpRequest, context: InvocationContext
6363
const sessionId = ((chatContext as any)?.sessionId as string) || uuidv4();
6464
context.log(`userId: ${userId}, sessionId: ${sessionId}`);
6565

66-
if (!azureOpenAiEndpoint || !burgerMcpEndpoint) {
67-
const errorMessage = 'Missing required environment variables: AZURE_OPENAI_API_ENDPOINT or BURGER_MCP_ENDPOINT';
66+
if (!azureOpenAiEndpoint || !burgerMcpUrl) {
67+
const errorMessage = 'Missing required environment variables: AZURE_OPENAI_API_ENDPOINT or BURGER_MCP_URL';
6868
context.error(errorMessage);
6969
return {
7070
status: 500,
@@ -96,7 +96,7 @@ export async function postChats(request: HttpRequest, context: InvocationContext
9696
name: 'burger-mcp-client',
9797
version: '1.0.0',
9898
});
99-
const transport = new StreamableHTTPClientTransport(new URL(burgerMcpEndpoint));
99+
const transport = new StreamableHTTPClientTransport(new URL(burgerMcpUrl));
100100
await client.connect(transport);
101101
context.log('Connected to Burger MCP server using Streamable HTTP transport');
102102

0 commit comments

Comments
 (0)