Skip to content

Conversation

@atline
Copy link
Contributor

@atline atline commented Jun 24, 2025

If there is no apikey specified, the mcp server will simply skip the username/password, which make MCP server can't connect to elasticsearch.

This is a regresstion by 35cc88e

In fact apiKey: process.env.ES_API_KEY ?? '' will become '', which make next code never send username, password to elasticsearch.

  if (apiKey != null) {
    clientOptions.auth = { apiKey }
  } else if (username != null && password != null) {
    clientOptions.auth = { username, password }
  }

With this patch, the undefined will match the else if, so bug fixed.

@cla-checker-service
Copy link

cla-checker-service bot commented Jun 24, 2025

💚 CLA has been signed

@atline atline force-pushed the fix_default_value branch 2 times, most recently from 9ebd014 to 80f36cc Compare June 24, 2025 08:20
If there is no apikey specified, the mcp server will simply
skip the username/password, which make MCP server can't connect
to elasticsearch.

This is a regresstion by elastic@35cc88e

Signed-off-by: Larry Shen <[email protected]>
@atline atline force-pushed the fix_default_value branch from 80f36cc to 2622ded Compare June 24, 2025 12:23
Copy link
Member

@JoshMock JoshMock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Thanks for the contribution!

@JoshMock
Copy link
Member

buildkite test this

@JoshMock JoshMock merged commit 07073d3 into elastic:main Jun 24, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants