TVclRestAgent - Demo
====================

What this is
------------

A perfectly ordinary Windows application - a stock manager with
articles, movements, settings and a log - and a browser page that shows
that same application FROM THE INSIDE: its component tree, a live
picture of the window, and every property of whatever is selected.

The application knows nothing about being inspected. It has one
component on its form, and one line of code for it. Everything else is
ordinary Delphi/VCL code. That is the point of showing it.


Running it
----------

    VclRestAgentDemo.exe

The application comes up, your browser opens, and it is already
connected. Nothing to install, nothing to configure.

Keep all four files together in one folder - the application serves the
three web files itself.

Start it with  /nobrowser  if you would rather open
http://127.0.0.1:8081/ yourself.


What to try
-----------

1. Click something in the picture in the middle. The element underneath
   is selected - the smallest one containing that point, the way a
   browser's own developer tools do it.

2. Pick "pnlHeader" in the tree on the left and flip "Visible".
   The header disappears from the running application, and the picture
   shows it in the same instant. Nothing was rebuilt or restarted.

3. Click a colour swatch in the properties. Pick a colour. Watch the
   application change.

4. "Actions" on the right, then "About ...". That opens a MODAL dialog -
   and everything keeps answering. The tree shows the new window, the
   picture follows it, and "Click" on btnClose closes it again, without
   a hand on the mouse.

5. Switch "Live" on, top right. Everything refreshes every two seconds;
   the progress bar and the clock keep moving. You can keep editing
   while it runs - the field you are typing in is left alone.

6. "Input" on the right has a pointer pad. It shows the window itself,
   faded, with a crosshair, and it names the control you are pointing
   at. Clicking there sends a REAL mouse click, so the application is
   brought to the front first - otherwise the click would land in the
   browser. "Click" at the top does it the other way, through the name
   of the control, and works even while the window is covered.

7. "Requests" on the right shows every call that the page made, with its
   status code and how long it took. Click a line and it opens: what
   went out, and what came back. That is the whole interface, live -
   nothing here is hidden from you.


Two local ports
---------------

    127.0.0.1:8080    the application itself: REST, and MCP at /mcp
    127.0.0.1:8081    the page you are looking at

Both listen on the loopback address only - nothing of this is reachable
from another machine.


Demo 2: ask your own AI
-----------------------

The same application is an MCP server as well - no second program, no
other setting. An AI client needs exactly two things: the address and
the token. The tools it finds by itself.

    address   http://127.0.0.1:8080/mcp
    header    Authorization: Bearer demo

In Claude Code, while the application runs:

    claude mcp add --transport http stockdemo http://127.0.0.1:8080/mcp --header "Authorization: Bearer demo"

Then ask it things nobody could tell from a screenshot:

    - Which articles are below their minimum stock?
    - Which record is the article grid on, and which dataset is behind it?
    - What does the header of the main window look like?
    - Open "About ..." and close it again.
    - Which actions are there, and which are disabled right now?
    - May you read files here?

Every answer comes from the running application - its datasets, its
properties, its windows - not from a picture of it. Open the Log page
of the application beside it: every call the AI makes shows up there.

How it is protected: the application listens on 127.0.0.1 only, every
call needs the token, a web page from anywhere else is refused (403)
before the token is even looked at, and files and restarting are closed
in this demo - the AI is told so when it connects, and those tools are
not offered at all.


Where this comes from
---------------------

TVclRestAgent is a Delphi/VCL component that makes a running application
answer questions over HTTP and take commands the same way. Everything
the page does here, it does through that interface - and so can a test
script, or an AI agent.

    https://vclrestagent.orugu.de/

The application and this page were written entirely with Kai in RAD
Studio and Claude.
