Repository navigation
Add time-limited license handling for the standalone MCP server - #260
Merged
Merged
Conversation
The standalone MCP server describes its license with keys of
$StandaloneMCPServerInformation ("ExpirationDate", "Expired",
"InstructionsURL", "ProductName", "WarningDays"). License handling is on
only when "Expired" or "ExpirationDate" is present, and the license is
read again on every request. With a license, the server:
- appends the license status to the initialize instructions
- adds a WolframLicenseStatus tool unless the server already lists one
- fails every prompt and every other tool call once the license has
expired (a missing or invalid expiration date counts as expired)
- appends a reminder to tool results during the warning period
The standalone application detects support with
KeyExistsQ[$DefaultMCPTools, "WolframLicenseStatus"].
See Specs/StandaloneLicense.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KfEJrsbZDPEGGJ7quYKQBe
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.
Summary
Implements Specs/StandaloneLicense.md: license handling for the standalone MCP server's time-limited license.
The standalone application describes the license with keys of
$StandaloneMCPServerInformation("ExpirationDate","Expired","InstructionsURL","ProductName","WarningDays"). License handling is on only when"Expired"or"ExpirationDate"is present, so nothing changes outside the standalone product. With a license, the server:initializeinstructionsWolframLicenseStatustool, unless the server already lists oneisErrorresult (the tool is not run) and everyprompts/getwith a JSON-RPC error (-32603), both carrying the expiration message"WarningDays", default 14), appends a reminder to every other tool resultThe license is read again on every request, so a long-running server expires on time. A missing or invalid expiration date counts as expired (fail closed). Days and dates use the time zone of the expiration date. The app detects support with
KeyExistsQ[$DefaultMCPTools, "WolframLicenseStatus"].Blocking prompts after expiration is an addition to the original spec, and the spec has been updated to say so.
Where the code is
Kernel/Tools/LicenseStatus.wl(new): the tool, the license logic (licenseStatus,licenseInstructions), and the message templatesKernel/Server/Shared.wl: the hooks (withLicenseToolininitializeServerState,withLicenseInstructionsininitResponse, the expiration and warning checks inevaluateTool, andhandlePromptGet)README.md,docs/tools.md,docs/usage-data.md,AGENTS.mdTests/LicenseStatus.wltis new; the Tools.wlt and UsageData.wlt diffs are mostly the pre-commit hook re-annotating TestID positions.Notes / possible follow-ups (not handled here)
FromUnixTime[t], which uses the UTC offset at startup. Near local midnight across a DST change, the reported day can be off by one. The fix would be in the app (pass a named time zone).WolframLicenseStatustwice, nothing special happens.Tests/LicenseStatus.wltis large (~900 lines, 70 tests) and can be trimmed if that helps review.Test plan
LicenseStatus.wl,Shared.wl, andTests/LicenseStatus.wltScripts/BuildAgentSkills.wls --check: agent skills up to dateStartMCPServer[],Wolframserver) with$StandaloneMCPServerInformationshaped like the app'slicense[], expiring 75 s after load:initializeinstructions report the licensetools/listincludesWolframLicenseStatusWolframLanguageEvaluatorresults end with the reminderprompts/getworksWolframLicenseStatusreports "has expired"WolframLanguageEvaluatorand unknown tools returnisErrorwith the message, without runningprompts/getreturns a-32603errorinitializegives the expired instructions🤖 Generated with Claude Code
https://claude.ai/code/session_01KfEJrsbZDPEGGJ7quYKQBe