Repository navigation
feat(claude): connect Claude Code to Glean directly - #54
Draft
steve-calvert-glean wants to merge 1 commit into
Draft
steve-calvert-glean wants to merge 1 commit into
steve-calvert-glean wants to merge 1 commit into
Conversation
The Claude package no longer starts a local MCP server. Its server entry is an HTTP entry whose URL is a plugin option, server_url, so Claude Code connects to the user's Glean server itself, signs in with its own OAuth client, and shows Glean's approval form for writes. Cursor and Codex output is unchanged. One SessionStart hook, check-setup.mjs, replaces the two hooks that fed the local server: - On the first session after an update from version 3, it sets server_url to the URL that version saved, unchanged, with `claude plugin configure`. It does this one time, then tells the user to run /reload-plugins and sign in. - With no saved URL, or when the option is cleared later, it tells the user to set the server URL under /plugin. - Below Claude Code 2.1.274 it says to run `claude update`. - It always exits 0 and never reads credentials. The server entry sends X-Glean-Metadata: claude-code-plugin so Glean can tell plugin traffic from a hand-added server. The two old hooks move to shared/glean/mcp/tests/claude-relay-hooks because the local server's tests still run them. No package ships them.
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
The Claude package stops starting a local MCP server. Claude Code connects to the user's Glean server itself.
url: "${user_config.server_url}"and the headerX-Glean-Metadata: claude-code-plugin.server_urlis a new required plugin option.hooks/check-setup.mjsruns onSessionStartand replaces the two hooks that fed the local server.dist/cursoranddist/codexmatch the published output repos.What the hook does
server_urlis setserver_urlto that URL, unchanged, by runningclaude plugin configure. Then tells the user to run/reload-pluginsand sign in under/mcp. It does this one time./plugin.claude update.It always exits 0 and never reads credentials. It carries the URL over, not the sign-in: the user signs in one time with Claude Code's own OAuth client.
Do not release yet
One thing blocks a release. Glean's
/mcp/gateway/proxyendpoint listsset_tool_approvalto every client. The local server kept that tool from the model; a direct connection lists it. A model that can call it can save Always Allow and turn off Glean's approval form. A server-side change that stops listing the tool to direct clients is in review. Release after it is deployed, and after a live check shows the tool is gone.Tested
npm run test:bundlepasses: 25 test files, 465 tests. The hook has 35 of them.npm test(build and pluginpack validation for all three targets) andnpm run typecheck:bundlepass.claude plugin validate --strict dist/claude/plugins/gleanpasses.server_urlto the saved URL and printed the message. The next session printed nothing. One sign-in connected the server./mcp/gateway/proxy: connected on MCP 2026-07-28, and the header reached Glean's usage log. Asearchread returned. Arun_toolwrite showed Glean's form; Allow ran the write. Underclaude -pthe form was cancelled and the write did not run.Not tested
claude plugin configure, which may behave differently there./pluginscreen and automatic updates show when an update adds the required option./pluginwould appear there.For the reviewer
find_skills_and_toolsresponse was 154,619 characters. Claude Code saved it to a file and the model read it withjq. It worked. Version 3 wrote skill files to disk instead.code_search. Several skills and agents mention it, and the proxy endpoint does not serve it. That is true of 3.6.2 as well.@david-hamilton-glean owns this from here.