Skip to content

Embeddings provider API Key Not Read from Dashboard Settings #642

@josepcrespo

Description

@josepcrespo

Bug Description / 问题描述
vectorSearchService.ts reads the embedding provider API key exclusively from the .env file (environment variable). It does not read the API key configured through the Dashboard UI. As a result, users who configure the embedding provider via the Dashboard — including the API key — will find that embeddings fail to be generated because the service never picks up the key they entered.

Steps to Reproduce / 复现步骤

  1. Set any invalid embedding provider API key variable in .env.
  2. Open the MCPHub Dashboard and configure an embedding provider (e.g., OpenAI), entering a valid API key in the Provider API Key field.
  3. Save the configuration.
  4. Install an MCP server and wait for tool embeddings to be generated.
  5. Observe in the logs that the API call fails with an authentication error, despite the API key having been entered in the Dashboard.

Expected Behavior / 预期行为
vectorSearchService.ts should read the API key from the Dashboard settings (i.e., from the persisted system configuration) and use it when making embedding API calls. The Dashboard-configured value should take precedence over any environment variable, or at minimum be used as a fallback when the environment variable is not set.

Environment / 运行环境

  • Running on / 运行方式: All (docker / npx / local)
  • Version / 版本: Current

Screenshots / 截图
N/A

Additional Info / 补充信息
This bug effectively breaks the embedding configuration flow for users who rely entirely on the Dashboard to manage settings (the intended experience). The workaround is to set the API key via .env, but this is not documented prominently and defeats the purpose of the Dashboard UI. The fix should ensure that any configuration value editable in the Dashboard is also honoured at runtime by the services that consume it.

The #600 issue is somehow related to this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions