Skip to content

A plugin marketplace for GitHub Copilot and other AI agents that provides Power Platform development plugins, including reusable skills, agents, and commands for building and deploying solutions.

2.3 KB
Raw Blame
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <!-- MCP_APPS_SELF_CONTAINED_RUNTIME -->
  <style>
    *, *::before, *::after { box-sizing: border-box; }
    body {
      margin: 0;
      padding: 24px;
      font-family: var(--fontFamilyBase, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
      color: var(--colorNeutralForeground1, #242424);
      background: var(--colorNeutralBackground1, #fff);
    }
    .spinner {
      width: 20px;
      height: 20px;
      border: 2px solid var(--colorNeutralStroke2, #e0e0e0);
      border-top-color: var(--colorBrandBackground, #0f6cbd);
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
    }
    @media (prefers-reduced-motion: no-preference) {
      @keyframes spin { to { transform: rotate(360deg); } }
    }
  </style>
</head>
<body>
  <div id="widget-root"><div class="spinner" role="status" aria-label="Loading"></div></div>
  <script type="module">
    const { App, webDarkTheme, webLightTheme } = globalThis.McpAppsRuntime;
    const root = document.getElementById('widget-root');

    function applyTheme(theme) {
      const tokens = theme === 'dark' ? webDarkTheme : webLightTheme;
      for (const [token, value] of Object.entries(tokens)) {
        document.documentElement.style.setProperty('--' + token, value);
      }
    }

    function escapeHtml(text) {
      const div = document.createElement('div');
      div.textContent = String(text ?? '');
      return div.innerHTML;
    }

    function renderError(message) {
      root.innerHTML = '<p role="alert">' + escapeHtml(message) + '</p>';
    }

    const app = new App({ name: 'self-contained-sample', version: '1.0.0' });
    app.ontoolresult = (result) => {
      const toolResult = {
        content: result.content ?? [],
        structuredContent: result.structuredContent ?? {},
        _meta: result._meta ?? {},
      };
      root.innerHTML = '<pre>' + escapeHtml(JSON.stringify(toolResult.structuredContent, null, 2)) + '</pre>';
    };
    app.onhostcontextchanged = (ctx) => { if (ctx.theme) applyTheme(ctx.theme); };
    app.onteardown = () => ({});
    await app.connect();
    const hostContext = app.getHostContext();
    if (hostContext?.theme) applyTheme(hostContext.theme);
  </script>
</body>
</html>