You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11-3Lines changed: 11 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@
9
9
**A .NET framework for building composable command surfaces.**
10
10
11
11
- Define your commands once — run them as a CLI, explore them in an interactive REPL,
12
-
- host them in session-based terminals, expose them as MCP servers for AI agents,
12
+
- host them in session-based terminals, expose them as MCP servers and MCP Apps for AI agents,
13
13
- or drive them from automation scripts.
14
14
15
15
> **New here?** The [DeepWiki](https://deepwiki.com/yllibed/repl) has full architecture docs, diagrams, and an AI assistant you can ask questions about the toolkit.
@@ -83,6 +83,14 @@ app.UseMcpServer(); // add one line
83
83
{ "command": "myapp", "args": ["mcp", "serve"] }
84
84
```
85
85
86
+
**MCP Apps** (same server, host-rendered UI for capable clients):
| MCP server — expose commands as AI agent tools|[](https://www.nuget.org/packages/Repl.Mcp)| <ul><li>[MCP server](docs/mcp-server.md)</li><li>[MCP advanced](docs/mcp-advanced.md)</li></ul> |
104
+
| MCP server + MCP Apps — expose commands as agent tools, resources, prompts, and UI |[](https://www.nuget.org/packages/Repl.Mcp)| <ul><li>[MCP server](docs/mcp-server.md)</li><li>[MCP advanced](docs/mcp-advanced.md)</li><li>[MCP sample](samples/08-mcp-server/)</li></ul> |
Copy file name to clipboardExpand all lines: docs/architecture.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@
20
20
-`Repl.Spectre`
21
21
- Spectre.Console integration: `SpectreInteractionHandler` for rich prompts, `IAnsiConsole` DI injection, `"spectre"` output transformer for auto-rendered tables, `SpectreConsoleOptions` for capability configuration.
This lets capable hosts render the UI while keeping raw HTML out of the model-facing transcript. The handler is still a normal Repl mapping, so it can use DI, cancellation tokens, and the usual command pipeline.
241
+
232
242
Declare answer slots for interactive prompts so agents and `--answer:` flags can provide values:
Copy file name to clipboardExpand all lines: docs/glossary.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -66,6 +66,10 @@ Static text in a route template matched exactly.
66
66
67
67
Model Context Protocol. Allows AI agents to discover and invoke commands.
68
68
69
+
### MCP App
70
+
71
+
MCP UI extension that lets a command open a `ui://` HTML resource. Repl maps this with `.AsMcpAppResource()` on the HTML-producing command and returns launcher text for normal tool calls.
72
+
69
73
### Middleware
70
74
71
75
Pipeline function registered via `app.Use()` that wraps handler execution.
| Client has both issues | Use soft roots and, if needed, the dynamic tool shim |
250
252
253
+
## MCP Apps advanced patterns
254
+
255
+
For the basic MCP Apps setup, start with [mcp-server.md](mcp-server.md#mcp-apps). This section covers the patterns that matter once the UI is more than a trivial inline HTML card.
256
+
257
+
MCP Apps support is experimental in this version. Resource handlers should return generated HTML as `string`, `Task<string>`, or `ValueTask<string>`; the API is expected to become more flexible as host support and Repl's asset story evolve.
258
+
259
+
### One mapping, two MCP surfaces
260
+
261
+
`AsMcpAppResource()` keeps the Repl authoring model simple: one mapping produces both the launcher tool metadata and the UI resource.
The handler return value is used for `resources/read` and is returned as `text/html;profile=mcp-app`. When a client calls the MCP tool, Repl returns launcher text instead of raw HTML, using `WithMcpAppLauncherText(...)`, `WithDescription(...)`, or a generated fallback.
270
+
271
+
Use `WithMcpAppLauncherText(...)` when the description is not the text you want in the chat transcript:
.WithMcpAppLauncherText("Opening the contacts dashboard.");
278
+
```
279
+
280
+
`WithMcpApp("ui://...")` remains available for advanced cases where a normal tool should point at a separately registered UI resource, but it is not the default pattern.
This produces a resource template like `ui://contact/{id}/panel`.
298
+
299
+
The generated URI uses the full route path, including contexts:
300
+
301
+
```csharp
302
+
app.Context("viewer", viewer=>
303
+
{
304
+
viewer.Context("session {id:int}", session=>
305
+
{
306
+
session.Map("attach", (intid) =>BuildHtml(id))
307
+
.AsMcpAppResource();
308
+
});
309
+
});
310
+
```
311
+
312
+
This produces `ui://viewer/session/{id}/attach`. MCP URI templates keep the variable name but not the Repl route constraint, so `{id:int}` becomes `{id}` in the URI and is validated when Repl dispatches the resource read through the normal command pipeline.
313
+
314
+
Pass an explicit URI only when you need a stable public URI that is decoupled from the route path:
As of April 2026, VS Code renders MCP Apps inline only. Microsoft 365 Copilot declarative agents support fullscreen display requests for widgets. Other hosts vary; check [mcp-server.md](mcp-server.md#mcp-apps-host-compatibility) for the current compatibility notes.
332
+
333
+
If the HTML uses the MCP Apps JavaScript bridge, it should still ask the host what is available before requesting a different display mode:
Keep the shell and asset server host-aware: clients may preload or cache UI resources, and not every host supports every display mode or browser capability.
374
+
251
375
## Troubleshooting patterns
252
376
377
+
### My MCP App shows HTML text in the chat
378
+
379
+
Use `.AsMcpAppResource()` on the HTML-producing command instead of linking a normal tool to raw HTMLmanually. Repl will return launcher text for tool calls and reserve the HTMLfor`resources/read`.
380
+
381
+
Also restart or reload the MCP server in the client. Some hosts cache tool lists and will not pick up MCP Apps metadata changes until the server is refreshed.
382
+
383
+
### My MCP App does not open fullscreen
384
+
385
+
Check whether the host supports fullscreen. VS Code currently renders MCP Apps inline only, even when Repl sets `preferredDisplayMode: McpAppDisplayModes.Fullscreen`.
386
+
387
+
For hosts that support display mode changes, request fullscreen from inside the HTML app after checking host capabilities.
388
+
253
389
### The agent doesn't see tools that should appear later
0 commit comments