Skip to content

Add EnableLLMKit option to InstallMCPServer#209

Merged
rhennigan merged 4 commits into
mainfrom
feature/enable-llmkit-option
Jul 3, 2026
Merged

Add EnableLLMKit option to InstallMCPServer#209
rhennigan merged 4 commits into
mainfrom
feature/enable-llmkit-option

Conversation

@rhennigan

Copy link
Copy Markdown
Member

Summary

Adds an "EnableLLMKit" option to InstallMCPServer, following the existing "EnableMCPApps" pattern: the option sets an LLMKIT_ENABLED environment variable in the MCP config, which is checked at runtime.

Value Behavior
Automatic (default) Equivalent to True — no env var injected; LLMKit works as before
True LLMKit features enabled
False Injects LLMKIT_ENABLED=false. The context tools (WolframContext, WolframAlphaContext, WolframLanguageContext) then behave as if the user has no LLMKit subscription — unfiltered documentation, no Wolfram|Alpha semantic results — but with no subscription warnings, and the install-time subscription check is skipped

Implementation

  • Runtime gate — new llmKitEnabledQ[] (Utilities.wl, declared in CommonSymbols.wl) reads LLMKIT_ENABLED, mirroring mcpAppsEnabledQ. The no-arg llmKitSubscribedQ[] now short-circuits to False when disabled, so it never even makes the cloud lookup and every context tool takes the unsubscribed path.
  • Warning suppressionrelatedWolframAlphaPrompt[…, False] returns "" when LLMKit is disabled (vs. the subscribe-here message when genuinely unsubscribed), so the combined tool just omits the Wolfram|Alpha section.
  • Install-time$enableLLMKit config var + Block bindings; addEnvironmentVariables injects the env var on False; a guard clause on checkLLMKitRequirements returns None when disabled. Injection is centralized, so all client formats (Codex, Goose, Continue, Augment, generic) get it.

Test plan

All tests pass (100%) across the affected suites (run via the TestReport MCP tool / wolframscript -f Scripts/TestPaclet.wls Tests/<file>.wlt). New tests cover:

  • llmKitEnabledQ — env-var truth table (unset → enabled; false/False/FALSE → disabled; other values → enabled).
  • llmKitSubscribedQ gating — returns False when disabled and short-circuits before getLLMKitInfo[] (no cloud lookup).
  • Install env injectionLLMKIT_ENABLED=false present for EnableLLMKit -> False; absent for default / True / Automatic.
  • Requirement-check guard — with EnableLLMKit -> False, checkLLMKitRequirements returns None without consulting llmKitSubscribedQ (a WolframAlpha-required tool installs without a subscription failure).
  • Context-tool behavior — disabled ⇒ docs returned, no subscription nag; regression guard: a genuinely unsubscribed user (LLMKit enabled) still gets the warning + buy-now URL.
  • environmentBlock test helper — self-test confirms it sets and restores the real process environment.

CodeInspector is clean on all modified source files.

Docs

Updated README.md, docs/mcp-clients.md (env-var table + option section), and the InstallMCPServer reference page.

Related issue

None.

🤖 Generated with Claude Code

rhennigan and others added 2 commits July 3, 2026 10:07
Temporarily sets (or, with value None, unsets) a process environment
variable for the duration of an evaluation, restoring the previous value
afterward via WithCleanup. Unlike Block[{Environment}, ...], it sets the
real variable so every Environment[...] read under the evaluation behaves
naturally.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The new "EnableLLMKit" option (default Automatic, equivalent to True)
controls whether the LLMKit-backed features of the context tools
(WolframContext, WolframAlphaContext, WolframLanguageContext) are enabled
for an installed server. Setting it to False injects LLMKIT_ENABLED=false
into the MCP config's env block, mirroring the EnableMCPApps /
MCP_APPS_ENABLED pattern.

At runtime, llmKitEnabledQ reads the variable and gates the no-argument
llmKitSubscribedQ, so the context tools behave as if the user has no LLMKit
subscription -- returning unfiltered documentation and omitting the
Wolfram|Alpha section -- while suppressing the subscription warnings and
short-circuiting before any cloud lookup. At install time the requirement
check is skipped so a server with an LLMKit-required tool installs without a
subscription failure.

Includes tests and documentation (README, docs/mcp-clients.md, and the
InstallMCPServer reference page).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 3, 2026 14:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces an "EnableLLMKit" option to InstallMCPServer to control whether LLMKit-backed context-tool behavior is enabled for an installed server by injecting LLMKIT_ENABLED=false into the server environment, mirroring the existing "EnableMCPApps" pattern.

Changes:

  • Added runtime gating via llmKitEnabledQ[] and updated llmKitSubscribedQ[] to short-circuit when LLMKit is disabled.
  • Updated context-tool behavior to suppress subscription warnings/WA section when disabled.
  • Added/updated tests and documentation for the new option and environment variable.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Tests/Utilities.wlt Adds tests for llmKitEnabledQ and llmKitSubscribedQ short-circuit behavior.
Tests/Tools.wlt Adds coverage for context-tool output when LLMKit is disabled vs genuinely unsubscribed.
Tests/InstallMCPServer.wlt Adds tests for "EnableLLMKit" env injection and requirement-check guarding (but currently contains widespread syntax corruption in TestID lines).
Tests/Common.wl Adds environmentBlock helper to set/unset real process environment variables during tests.
README.md Documents "EnableLLMKit" option in the InstallMCPServer options table.
Kernel/Utilities.wl Implements llmKitEnabledQ[] and gates llmKitSubscribedQ[] on enablement.
Kernel/Tools/Context.wl Suppresses Wolfram
Kernel/InstallMCPServer.wl Adds "EnableLLMKit" option, install-time guard, and env-var injection logic.
Kernel/CommonSymbols.wl Declares llmKitEnabledQ as a shared symbol.
Documentation/English/ReferencePages/Symbols/InstallMCPServer.nb Updates reference-page options table to include EnableLLMKit.
docs/mcp-clients.md Documents LLMKIT_ENABLED env var and "EnableLLMKit" option behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Tests/InstallMCPServer.wlt
Comment thread Tests/InstallMCPServer.wlt
Comment thread Tests/InstallMCPServer.wlt
Comment thread Kernel/Utilities.wl Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 12 changed files in this pull request and generated no new comments.

Replace the manual StringQ/StringMatchQ check with
Interpreter["Boolean"][Environment["LLMKIT_ENABLED"]] =!= False, per PR
review. Preserves all existing behavior (unset -> enabled, "false"
case-insensitive -> disabled, "true"/"1" -> enabled) and additionally
treats other falsy values ("no", "0", ...) as disabling. Update docs and
add tests for the broadened semantics.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rhennigan rhennigan merged commit b68f410 into main Jul 3, 2026
1 check failed
@rhennigan rhennigan deleted the feature/enable-llmkit-option branch July 3, 2026 15:10
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