aethershell 11.0.0

The world's first multi-agent shell with typed functional pipelines and multi-modal AI
// AetherShell TUI MCP Server Demo
// Launch with: ae tui
//
// This demo showcases Model Context Protocol (MCP) server integration:
// - MCP server discovery
// - Tool listing
// - Remote tool execution
// - Server health monitoring
//
// Note on shape: `mcp_server_start` takes a config record and returns a
// description, not an object with methods on it. An earlier version of this
// file wrote `fs_server.read_file(...)`, treating the return value as a
// module; tools are invoked through `mcp_call` instead.

// What is already reachable? Both are safe to call with nothing running.
print("Known MCP servers: " + mcp_servers())
print("Auto-detected server: " + mcp_detect())

// Declare the servers this demo would use.
let fs_server = mcp_server_start({
  name: "filesystem",
  endpoint: "http://localhost:3001",
  capabilities: ["read_file", "write_file", "list_dir", "search"]
})
print("Filesystem server: " + fs_server)

let aws_server = mcp_server_start({
  name: "aws",
  endpoint: "http://localhost:3002",
  capabilities: ["s3_list", "s3_get", "s3_put"]
})
print("AWS server: " + aws_server)

// An agent that may use MCP tools. `agent_with_mcp` takes the goal and the
// tool list positionally — it is not a single config record.
if env("AETHER_AI") == null {
  print("Skipping the agent run: set AETHER_AI (openai, ollama, irongate or compat) plus the matching API key to execute it.")
}
if env("AETHER_AI") != null {
  print(agent_with_mcp("Analyze log files and upload a summary to S3", ["read_file", "s3_put"]))
}

// The TUI provides:
// - Server registry panel (all connected MCP servers)
// - Server health indicators (green/yellow/red)
// - Tool catalog browser (searchable)
// - Request/response inspector
// - Latency metrics per server
// - Connection status monitoring
//

print("TUI MCP Server Demo Ready! Launch with: ae tui")
print("Note: start the MCP servers before running this demo")
print("See MCP_SERVERS_GUIDE.md for server setup instructions")