Repository navigation
Add standalone MCP server descriptors to usage data - #241
Merged
Merged
Conversation
The standalone MCP server product is a Wolfram kernel that only runs the MCP server, without a full Mathematica installation and under its own licensing. Two new exported symbols describe it: $StandaloneMCPServer (True only under that product) and $StandaloneMCPServerInformation (the information the product publishes about itself). The paclet never sets them; the standalone application does after loading the paclet, and both are Protected like the other exported symbols. Usage data payloads now carry both values so that sessions of the standalone product can be told apart from those of a regular installation. The payload's JSON is produced by the new writeRawJSONString (shared with writeRawJSONFile), which passes a jsonConvert conversion function to WriteRawJSONString: dates become ISO 8601 strings in UTC and anything else JSON cannot represent becomes its InputForm string. This replaces the level-1 Replace/RuleCondition in $productIdentityInfo, so the session file now holds the kernel's values as they are (None, Infinity) while the JSON the endpoint receives is unchanged. The JSON is submitted as UTF-8 bytes rather than a String body. Tests cover the new symbols (export, protection, defaults, blockability), their storage in the session file and JSON conversion, isolation of invalid values, the JSON writers, and the payload of a real server. The docs, the spec, and AGENTS.md describe the new fields and the conversion. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016kt1pnRU4SjAJZZscqYrGe
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The payload validation for $StandaloneMCPServerInformation should enforce the documented “string keys” contract to avoid ambiguous/implicitly stringified JSON keys.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR extends local MCP server usage-data collection to differentiate sessions running under an upcoming standalone MCP server product, and hardens JSON serialization by introducing shared conversion logic for non-JSON Wolfram expressions (including dates).
Changes:
- Adds exported, Protected descriptors
$StandaloneMCPServerand$StandaloneMCPServerInformation, and includes them in the local usage-data payload/session file. - Introduces
writeRawJSONStringplus a sharedjsonConvertconversion function (dates → ISO 8601 UTC; other non-JSON values →InputFormstrings) used by both JSON writers. - Updates tests and documentation/specs to reflect the new payload fields and JSON conversion behavior (including UTF-8 JSON body submission).
File summaries
| File | Description |
|---|---|
| Tests/UsageData.wlt | Expands usage-data tests for standalone descriptors, payload shape, and UTF-8 JSON byte encoding. |
| Tests/Files.wlt | Adds coverage for writeRawJSONString/writeRawJSONFile and jsonConvert behavior (dates + non-JSON values). |
| Specs/UsageData.md | Updates usage-data spec with standalone fields and revised JSON conversion rules/body encoding. |
| PacletInfo.wl | Exports the new standalone descriptor symbols from the paclet. |
| Kernel/Server/UsageData.wl | Adds standalone fields to usageDataPayload and switches usageDataJSON to UTF-8 ByteArray. |
| Kernel/Server/Server.wl | Defines default values for $StandaloneMCPServer / $StandaloneMCPServerInformation with product-level documentation. |
| Kernel/Main.wl | Declares the new exported symbols and adds them to the protected-name list. |
| Kernel/Files.wl | Implements writeRawJSONString and jsonConvert, and applies jsonConvert as the default JSON conversion function. |
| Kernel/CommonSymbols.wl | Declares writeRawJSONString in the Common symbols list. |
| docs/usage-data.md | Documents standalone fields, JSON conversion behavior, and UTF-8 JSON submission details. |
| docs/tools.md | Notes the standalone descriptors as product-level exported symbols (links to usage-data docs). |
| AGENTS.md | Updates repository architecture notes to mention the new JSON writer and standalone descriptors. |
Review details
- Files reviewed: 12/12 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
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
$StandaloneMCPServerand$StandaloneMCPServerInformation, describing the soon-to-be-released standalone MCP server product: a Wolfram kernel that only runs the MCP server, without a full Mathematica installation and under its own licensing. The paclet never sets them (False/<| |>); the standalone application sets both after loading the paclet. They are Protected like the other exported symbols.writeRawJSONStringand gives it andwriteRawJSONFilea sharedjsonConvert"ConversionFunction": dates become ISO 8601 strings in UTC and anything else JSON cannot represent becomes itsInputFormstring. This replaces the level-1Replace/RuleConditionin$productIdentityInfo, so the session file now stores the kernel's values as they are (None,Infinity) while the JSON sent to the endpoint is unchanged. The JSON body is submitted as UTF-8 bytes rather than aString.docs/usage-data.md(new fields, conversion rules, a "Standalone MCP Server" section),docs/tools.md,Specs/UsageData.md, andAGENTS.md.Notes for reviewers
writeRawJSONFilenow stringifies values JSON cannot represent instead of failing. The install/uninstall paths inInstallMCPServer.wlstill read the written file back and assert equality, so a non-JSON value in a client configuration is still caught.Unprotector aBlockaroundStartMCPServer, since they are Protected.Test plan
Tests/UsageData.wlt(71 tests): new "Standalone MCP Server" section (export, protection, defaults,Block, session-file storage, JSON conversion of nested dates and non-JSON values, invalid values isolated like other tracking failures); updated product identity and JSON payload tests; integration payload of a real server carries the defaultsTests/Files.wlt(17 tests): new "JSON Files" section forwriteRawJSONString,writeRawJSONFile, andjsonConvertTests/ToolOverrides.wlt(51) andTests/InstallMCPServer.wlt(487): regression check for thewriteRawJSONFilechange🤖 Generated with Claude Code
https://claude.ai/code/session_016kt1pnRU4SjAJZZscqYrGe