Skip to content

Add standalone MCP server descriptors to usage data - #241

Merged
rhennigan merged 1 commit into
mainfrom
feature/standalone-mcp-server-symbols
Sep 3, 2026
Merged

rhennigan merged 1 commit into
mainfrom
feature/standalone-mcp-server-symbols

Conversation

@rhennigan

Copy link
Copy Markdown
Member

Summary

  • Adds two exported symbols, $StandaloneMCPServer and $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.
  • Includes both values in the usage data payload of local server sessions, so sessions of the standalone product can be told apart from those of a regular installation.
  • Adds writeRawJSONString and gives it and writeRawJSONFile a shared jsonConvert "ConversionFunction": 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 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 a String.
  • Updates code comments, docs/usage-data.md (new fields, conversion rules, a "Standalone MCP Server" section), docs/tools.md, Specs/UsageData.md, and AGENTS.md.

Notes for reviewers

  • writeRawJSONFile now stringifies values JSON cannot represent instead of failing. The install/uninstall paths in InstallMCPServer.wl still read the written file back and assert equality, so a non-JSON value in a client configuration is still caught.
  • The standalone application must set the two symbols after loading the paclet (loading resets them to the defaults) and needs Unprotect or a Block around StartMCPServer, 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 defaults
  • Tests/Files.wlt (17 tests): new "JSON Files" section for writeRawJSONString, writeRawJSONFile, and jsonConvert
  • Tests/ToolOverrides.wlt (51) and Tests/InstallMCPServer.wlt (487): regression check for the writeRawJSONFile change
  • CodeInspector reports no issues on the changed source and test files

🤖 Generated with Claude Code

https://claude.ai/code/session_016kt1pnRU4SjAJZZscqYrGe

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
Copilot AI lite review requested due to automatic review settings September 2, 2026 14:25

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.

🟡 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 $StandaloneMCPServer and $StandaloneMCPServerInformation, and includes them in the local usage-data payload/session file.
  • Introduces writeRawJSONString plus a shared jsonConvert conversion function (dates → ISO 8601 UTC; other non-JSON values → InputForm strings) 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.

Comment thread Kernel/Server/UsageData.wl
@rhennigan
rhennigan merged commit a48b5a1 into main Sep 3, 2026
2 of 3 checks passed
@rhennigan
rhennigan deleted the feature/standalone-mcp-server-symbols branch September 3, 2026 11:15
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