Mcp app 2#17
Open
MatthewKhouzam wants to merge 7 commits into
Open
Conversation
3 tasks
The Logger class and tsp submodule wrote to sys.stdout, corrupting the JSON-RPC transport when running as an MCP server over stdio. - Logger: write to sys.stderr instead of sys.stdout - tsp submodule: error prints go to sys.stderr This patch was made with claude opus 4.6 Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Remove verbose debug logging (_log, _safe_tool decorator) and simplify run_cli error handling. Add _StderrWithBuffer class that redirects sys.stdout text writes to stderr while preserving .buffer for MCP's binary stdio transport. this code was made with the assistance of claude opus 4.6 Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Rewrite the plot tool to produce JSON series data for MCP Apps iframe rendering, with as_image=True (default) returning a PNG via matplotlib. When as_image=False, returns self-contained HTML with Plotly bundled inline for sandboxed iframe rendering. - Add as_image parameter (default True) for PNG output - Return inline HTML with bundled Plotly when as_image=False - Add MCP Apps ui:// resource for interactive iframe chart - Improve docstring to reduce LLM hallucination on parameter usage - CLI: default resample-freq/min-size to None so module defaults apply - ML modules: simplify _process to inline preprocessing, pass min_size as explicit kwarg This code was written with the assistance of claude opus 4.6 Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Add ToolAnnotations(readOnlyHint=True, destructiveHint=False) to all query tools so MCP clients can auto-approve them without user confirmation. Improve list_experiments docstring to guide LLMs toward resolving experiment names to UUIDs. This code was generated with the assistance of claude opus 4.6 Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Add experiment:// resource template and dynamic list_resources override that enumerates all open experiments from the trace server, allowing MCP clients to browse experiments without calling tools. This code was was generated with claude sonnet 4.6 Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
…er reference Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Needs mcp inspector. Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Contributor
kavehshahedi
left a comment
There was a problem hiding this comment.
LGTM!
Just a point of discussion; As the MCP is now evolving, I feel that it might be decoupled from the tmll repository itself, and be moved to an independent repo (e.g., eclipse-tmll/tmll-mcp). As currently the MCP is evolving rapidly, and also, introducing new codes/features/etc., developing it in its own environment might be cleaner.
What do you think, Matthew?
Comment on lines
+355
to
+357
| def get_experiment_resource(experiment_id: str) -> str: | ||
| """Return details for a specific experiment.""" | ||
| return run_cli("list") |
Contributor
There was a problem hiding this comment.
Why the experiment_id was not used here? I mean, does the run_cli("list") return the info for the currently loaded experiment?
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 it does
Overhauls the MCP server to be production-ready for MCP stdio transport and adds several new capabilities:
How to test
Start the trace server: python tmll/mcp/server.py tmll/mcp/cli.py
Use the MCP inspector to verify tools work without stdout corruption:
npx @modelcontextprotocol/inspector python3 tmll/mcp/server.py tmll/mcp/cli.py
Verify read-only tools show readOnlyHint: true in tool annotations.
Test plot_xy_with_anomalies:
- With as_image=True (default): should return a PNG image.
- With as_image=False: should return JSON with { "type": "html", "html": "..." }.
Verify list_resources returns open experiments as experiment:// resources.
Run the CLI directly to confirm detect-anomalies works without explicit --resample-freq:
python tmll/mcp/cli.py detect-anomalies -k "cpu usage"
Follow-ups
Review checklist