Skip to content

npx -y @elastic/mcp-server-elasticsearch doesn't work on Linux #120

@pasky

Description

@pasky

On Linux, npx tries to run the main script as executable file, but it is missing #!/usr/bin/env node on the first line, so shell tries to implement the executable file as a shell script rather than running it in node.

Therefore, you get this output:

/root/.npm/_npx/dbf1ae1819fe4520/node_modules/.bin/mcp-server-elasticsearch: 1: /app: Permission denied
/root/.npm/_npx/dbf1ae1819fe4520/node_modules/.bin/mcp-server-elasticsearch: 2: README.md: not found
/root/.npm/_npx/dbf1ae1819fe4520/node_modules/.bin/mcp-server-elasticsearch: 3: README.md: not found
/root/.npm/_npx/dbf1ae1819fe4520/node_modules/.bin/mcp-server-elasticsearch: 4: incident_agent/: Permission denied
/root/.npm/_npx/dbf1ae1819fe4520/node_modules/.bin/mcp-server-elasticsearch: 5: import: not found
...

This makes it problematic not just on Linux workstations, but also when running the MCP server from MCP client in a docker container.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions