Skybridge Documentation
repository·main·Indexed 23 days ago
https://github.com/alpic-ai/skybridgeA full-stack React framework for building Model Context Protocol (MCP) Apps and Servers. Skybridge bridges low-level MCP SDKs with type-safe, interactive user interfaces for LLM clients such as Claude and ChatGPT. It includes tooling for widget creation, OAuth authentication integration via Auth0 and Authplane, and a Hooks Conformance suite for verifying host support of web hooks.
What's inside Skybridge
- Manifest UI is an agentic component library designed for building rich, interactive, and beautifully designed views for AI-powered experiences. It provides ready-to-use components that allow agents to present information in structured, engaging ways rather than just plain text.
What is Skybridge?
mainSkybridge is a full-stack React framework designed for building Model Context Protocol (MCP) Apps and MCP Servers. It enables developers to create type-safe, interactive UI views that can be rendered within MCP-compatible clients like Claude, ChatGPT, and VSCode.
Key features include:
- Type-safe end-to-end: tRPC-style inference from MCP server tool definitions to React views.
- Write once, run everywhere: Abstracts implementation differences between various MCP clients.
- Delightful dev environment: Includes a dev server with a local emulator, HMR, and a permanent tunnel for connecting local apps to Claude and ChatGPT.
- React-first: Provides React Query-style hooks and advanced state management.
Understand Skybridge Hooks Conformance
mainSkybridge Hooks Conformance is a self-testing MCP app designed to verify how different hosts (such as ChatGPT, Claude, or the DevTools emulator) support various Skybridge web hooks.
It runs a sequence of tests via a stepper. Some tests are 'silent' (automatic), while others with user-visible side effects (like opening a link or a modal) require user interaction or automated confirmation.
Each test results in one of four verdicts:
supported: The hook functions correctly on the host.partial: Only part of the hook works (details are provided in a results table).unsupported: The host lacks the capability, but handles it gracefully (e.g., a documented no-op or a throw). This is still considered conformant.error: An unexpected failure occurred.
Understand the Skybridge documentation structure and user paths
mainSkybridge documentation is organized into specific sections designed to support different stages of the developer journey. Understanding these sections helps you find the right information based on your current goal:
1. Get Started (High Priority)
Focuses on initial discovery and getting a working app running in under 5 minutes.
- Introduction: Purpose and scope of Skybridge.
- Fundamentals: Explains MCP Apps, ChatGPT Apps, and how Skybridge maps to OpenAI Apps SDK and MCP runtimes.
- Quickstart: Using the
createcommand or the Skybridge Skill to scaffold an app. - Migrate: Using the Skybridge Skill to move existing apps.
- Test your app: Local testing with DevTools or in clients like ChatGPT, Claude, or Cursor.
- Build for production: Building MCP server and UI code.
- Deploy: Publishing to MCP client stores.
2. Core Concepts
Provides the mental models required to understand Skybridge internals:
- Write Once, Run Everywhere: Abstracting client differences (ChatGPT vs. Claude/Cursor).
- Data Flow: Movement of data between host, app, and LLM.
- LLM Context Sync: How app state stays in sync with the model's context.
- Fast Iteration: Local development workflow and hot reloading.
- Type Safety: Preserving types from app to client (tools, parameters, views).
3. Guides
Step-by-step implementation patterns for specific tasks:
- Fetching data: Using tools vs. resources and async patterns.
- Managing state: App-level state, persistence, and sharing state.
- Communicating with the model: Tool invocation, resource visibility, and prompt/context boundaries.
- Host environment context: Accessing user, session, and locale data.
4. Developer Tools
Focuses on the build and debug experience:
- Skills: Scaffolding and maintaining apps via IDE/chat.
- Local DevTools: Debugging tools and views locally.
5. Resources
- FAQ: Troubleshooting and common questions.
- Telemetry: Data collection and opt-out procedures.
6. API Reference
Technical specifications for precision implementation:
- CLI: Commands like
create,build, anddev. - Server:
McpServerclass,registerTool, and type exports. - Hooks: React hooks for UI (e.g.,
useCallTool,useUser,useViewState). - Utilities: Helpers like
createStore,generateHelpers, anddata-llmattribute. - Types: Server-to-client type inference.
- Advanced: Low-level context hooks (
useAppsSdkContext,useMcpAppContext).
7. Showcase
Example applications categorized by type (Basic, Auth, Third-party integrations).
Project structure of the Investigation Game example
mainThe example follows this directory structure:
server.ts: The main server entry point.src/data/: Contains game data like suspects, puzzles, and images.src/views/: Contains the UI layer.murder-in-the-valley.tsx: The main widget entry point.screens/: Individual screen components (e.g., Start, Intro, Main, Victory).components/: Shared UI components (e.g.,SuspectCard,DialogueBox).hooks/: Custom React hooks (e.g.,useTypewriter).
src/index.css: Global styles.vite.config.ts: Vite configuration.alpic.json: Deployment configuration.
Understand the Skybridge project structure
mainThe starter template follows this directory structure:
src/server.ts: The main server entry point where tools are registered.src/views/: Contains React components. Each file represents a single view.src/components/: Shared UI components used across different views.src/helpers.ts: Shared utility functions.src/index.css: Global CSS styles.vite.config.ts: Vite configuration.alpic.json: Deployment configuration for Alpic.package.json: Project dependencies and scripts.
What is a deployed MCP App?
mainA deployed MCP App is a server hosted on a public URL. It must satisfy two requirements:
- Hosts connect to the
/mcpendpoint to interact with the Model Context Protocol server. - The built views are served alongside the MCP server.
Deployment can be performed on any Node.js-compatible platform.
- Hosts connect to the
Run Skybridge with Path Prefixes
mainSkybridge supports running under a path prefix (e.g.,https://your-domain.com/v1/mcp). It determines the prefix by reading thex-forwarded-prefixheader, allowing it to serve assets correctly under that path. This is useful for hosting multiple versions of an app on a single domain.Key Skybridge hooks used in the Ecommerce Example
mainThe Ecommerce Carousel example demonstrates several core Skybridge hooks for building interactive widgets:
useCallTool(): Used within a widget to invoke MCP server tools (e.g., callingcreate-checkoutorcheck-checkout-status).useLayout(): Used to adapt the UI to light/dark modes.useUser(): Used for localization, providing access to the user's locale (supports English, French, Spanish, and German).useWidgetState(): Used to maintain persistent state (like a shopping cart) across re-renders.
Implement Stytch OAuth authentication in Skybridge
mainYou can implement full OAuth authentication using the
stytchProvider. This provider automates several steps:- Transport-Level Auth: Enforces authentication at the
/mcptransport level. Unauthenticated requests receive an HTTP 401 before reaching any tool handlers. - Metadata Discovery: Automatically discovers the Connected App's OAuth metadata.
- JWT Verification: Verifies JWTs against the project's JWKS without requiring a network round-trip per request.
- Branded Provider: By passing
oauth: await stytchProvider(...), the server auto-mounts well-known metadata endpoints and handles Bearer verification.
To use this, you must serve static HTML files (e.g.,
authorize.html,login.html,authenticate.html) from your MCP server to handle the Stytch IDP flows via@stytch/vanilla-js.- Transport-Level Auth: Enforces authentication at the
Use Skybridge hooks for widget functionality
mainThe Productivity Example demonstrates several core Skybridge hooks used to build interactive widgets:
useToolInfo(): Accesses tool input, output, and metadata.useCallTool(): Provides a type-safe way to call backend tools directly from the widget.useWidgetState(): Maintains persistent state (like selected items or chart data) across re-renders.useUser(): Handles localization; automatically provides translations based on user locale (e.g., English, French, Spanish, Chinese).useLayout(): Used to adapt the UI to light or dark themes.useDisplayMode(): Allows switching between inline and fullscreen views.useSendFollowUpMessage(): Enables the widget to send follow-up messages back to the AI.useOpenExternal(): Used to open external URLs.
Key technologies used in the ChatGPT Files Example
mainThe ChatGPT Files example utilizes the following stack:
- File Handling: Uses
useFiles()(upload,selectFiles,getDownloadUrl) from the ChatGPT Apps SDK. - Tool Invocation: Widgets call tools directly via
useCallTool()with_meta["openai/widgetAccessible"]set to enable widget access. - Compression: Uses
fflate(zipSync) for server-side ZIP creation (Node'szlibis insufficient for the ZIP container). - Storage: Uses Cloudflare R2 for archive storage, with
aws4fetchfor signing presigned download URLs. - External Links: Uses
useOpenExternal()to open the generated download URLs.
- File Handling: Uses