backstage / backstage/community-plugins

๐Ÿ› mcp-chat: Azure OpenAI Models Not Working

Open
#8,387 8 comments 0 reactions 1 assignee Assigned to @Lucifergene View on GitHub
bug stale workspace/mcp-chat
Dominant language
TypeScript
Stars
422
Forks
697
Avg merge
2d 6h
Merged PRs (30d)
286

Description

### Workspace

mcp-chat

### ๐Ÿ“œ Description

However, when making requests against an Azure OpenAI deployment, the plugin fails with:
```
mcp-chat error [openai] Request failed (404) after 180ms responseData="{\"error\":{\"code\":\"404\",\"message\": \"Resource not found\"}}"
```

**Root cause:**

My Azure OpenAI `/chat/completions` endpoint requires a [mandatory `api-version` query parameter](https://learn.microsoft.com/en-us/azure/foundry/openai/reference#chat-completions). Currently, the plugin always calls:

- [`/chat/completions`](https://github.com/backstage/community-plugins/blob/main/workspaces/mcp-chat/plugins/mcp-chat-backend/src/providers/openai-provider.ts#L30)

without any way to include `api-version`, which causes the 404 error.

**Proposed solution:**

Allow specifying query parameters when calling the `/chat/completions` endpoint. For example:

```yaml
mcpChat:
providers:
- id: openai
baseUrl: 'https://xxx.openai.azure.com/openai/deployments/yyy/'
chatCompletionsQueryParameter: 'api-version=2024-10-21'
token: 'zzz'
model: gpt-4o-mini
```

Alternatively, if we only want to pass api-version:
```yaml
mcpChat:
providers:
- id: openai
baseUrl: 'https://xxx.openai.azure.com/openai/deployments/yyy/'
apiVersion: '2024-10-21'
token: 'zzz'
model: gpt-4o-mini
```

This would make the plugin compatible with older Azure OpenAI deployments.

### ๐Ÿ‘ Expected behavior

I would expect Azure OpenAI to work when using the plugin

### ๐Ÿ‘Ž Actual Behavior with Screenshots

```
mcp-chat error [openai] Request failed (404) after 180ms responseData="{\"error\":{\"code\":\"404\",\"message\": \"Resource not found\"}}"
```

### ๐Ÿ‘Ÿ Reproduction steps

1. Configure the plugin with:
```yaml
mcpChat:
providers:
- id: openai
baseUrl: 'https://xxx.openai.azure.com/openai/deployments/yyy/'
token: 'zzz'
model: gpt-4o-mini
```
2. Send a message in the chat

### ๐Ÿ“ƒ Provide the context for the Bug.

_No response_

### ๐Ÿ‘€ Have you spent some time to check if this bug has been raised before?

- [x] I checked and didn't find similar issue

### ๐Ÿข Have you read the Code of Conduct?

- [x] I have read the [Code of Conduct](https://github.com/backstage/community-plugins/blob/main/CODE_OF_CONDUCT.md)

### Are you willing to submit PR?

Yes I am willing to submit a PR!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.