Bug Description
When using a global API token with GLEAN_ACT_AS, the MCP server sends the header X-Glean-Act-As (with hyphens between each word), but Glean's API expects X-Glean-ActAs (camelCase "ActAs").
This causes a 400 error:
Required header missing: X-Glean-ActAs
Not allowed
Steps to Reproduce
- Set up the MCP server with a global Glean API token:
export GLEAN_INSTANCE=mycompany
export GLEAN_API_TOKEN=<global-token>
export GLEAN_ACT_AS=user@company.com
- Make any tool call (e.g.,
glean-chat or glean-company_search)
- The request fails with "Required header missing: X-Glean-ActAs"
Root Cause
In build/common/client.js, line 74:
opts.httpClient = buildHttpClientWithGlobalHeaders({
'X-Glean-Act-As': actAs, // ← wrong header name
});
The header should be X-Glean-ActAs (no hyphen between "Act" and "As"), matching what the Glean API expects.
Verification
Tested directly against the Glean API:
X-Glean-Act-As: user@company.com → 400 "Required header missing: X-Glean-ActAs"
X-Glean-ActAs: user@company.com → 200 (works correctly)
Fix
Change line 74 in src/common/client.ts:
- 'X-Glean-Act-As': actAs,
+ 'X-Glean-ActAs': actAs,
Environment
@gleanwork/mcp-server version: 0.7.1 (latest)
- Node.js: v22
- OS: Linux (GKE pod) / macOS
Bug Description
When using a global API token with
GLEAN_ACT_AS, the MCP server sends the headerX-Glean-Act-As(with hyphens between each word), but Glean's API expectsX-Glean-ActAs(camelCase "ActAs").This causes a 400 error:
Steps to Reproduce
glean-chatorglean-company_search)Root Cause
In
build/common/client.js, line 74:The header should be
X-Glean-ActAs(no hyphen between "Act" and "As"), matching what the Glean API expects.Verification
Tested directly against the Glean API:
X-Glean-Act-As: user@company.com→ 400 "Required header missing: X-Glean-ActAs"X-Glean-ActAs: user@company.com→ 200 (works correctly)Fix
Change line 74 in
src/common/client.ts:Environment
@gleanwork/mcp-serverversion: 0.7.1 (latest)