Open-source SDK for building applications with the Model Context Protocol (MCP) that is compatible with OpenAI Apps SDK.
This SDK is useful for two types of developers:
- Agent developers who want to integrate MCP-based App UI into their own agents
- MCP App developers who are developing MCP-based Apps that can be integrated with ChatGPT and other agents
Exploring.the.MCP.Apps.SDK.and.Its.Integration.with.AI.Applications.mp4
Get started quickly with a single command:
npm install @xalia/mcp-apps-sdkThis installs everything you need to build MCP-powered applications! ✨
- MCP Client - Connect to and communicate with MCP servers
- Adapters - Integrate with popular AI frameworks (OpenAI, Vercel AI SDK)
- Widget Components - React components for rendering MCP app interfaces
For advanced users who want smaller bundle sizes, install only what you need:
# For agent developers - render MCP app widgets only
npm install @xalia/mcp-apps-widget
# For MCP app developers - client and adapters only
npm install @xalia/mcp-client @xalia/mcp-apps-adaptersThis monorepo contains four packages:
Complete SDK - Unified package with everything you need. Install this for the simplest setup.
React components and utilities for rendering MCP app widgets in secure iframes with PostMessage communication.
TypeScript client for connecting to and interacting with MCP servers, including tool discovery and execution.
Adapters for integrating MCP tools with popular AI frameworks like Vercel AI SDK and OpenAI.
- Node.js 18+
- pnpm 10+
- An MCP server running (default:
http://localhost:8002/mcp)
# Clone the repository with submodules
git clone --recurse-submodules https://github.com/general-intelligence-labs/mcp-apps-sdk.git
cd mcp-apps-sdk
# Or if you already cloned without submodules
git submodule update --init --recursive
# Install dependencies
pnpm install
# Build all packages
pnpm buildThe chatbot example requires an MCP server and a static file server for widgets. See examples/chatbot/README.md for detailed setup instructions.
Quick start:
# Terminal 1: Start static file server
cd examples/openai-apps-sdk-examples
pnpm install && pnpm build
pnpm run serve # Serves on port 4444
# Terminal 2: Start MCP server
cd examples/openai-apps-sdk-examples/solar-system_server_python
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
uvicorn main:app --port 8002
# Terminal 3: Start the chatbot
cd examples/chatbot
pnpm devOpen http://localhost:3000 to see the chatbot with MCP tool integration.
mcp-apps-sdk/
├── packages/
│ ├── mcp-apps-sdk/ # ⭐ Complete SDK (umbrella package)
│ ├── mcp-apps-widget/ # Widget rendering components
│ ├── mcp-client/ # MCP protocol client
│ └── mcp-apps-adapters/ # AI framework adapters
├── examples/
│ ├── chatbot/ # Example Next.js chatbot app
│ └── openai-apps-sdk-examples/ # OpenAI SDK examples (git submodule)
└── package.json # Root package.json
# Build all packages
pnpm build
# Run all packages in development mode
pnpm dev
# Run tests
pnpm test
# Lint code
pnpm lint
# Clean all build artifacts
pnpm cleanInstall the complete SDK and import everything from one place:
npm install @xalia/mcp-apps-sdkimport {
createMCPClient,
connectMCPClient,
createVercelAITools,
AssistantAppEmbed
} from '@xalia/mcp-apps-sdk';
// Connect to MCP server
const client = await createMCPClient({ name: 'my-app', version: '1.0.0' });
await connectMCPClient(client, transport);
// Convert MCP tools for use with AI SDKs
const tools = await createVercelAITools(client);Use specific entry points when you need fine-grained control:
// Client only
import { createMCPClient } from '@xalia/mcp-apps-sdk/client';
// Adapters
import { createOpenAIFunctions } from '@xalia/mcp-apps-sdk/adapters/openai';
import { createVercelAITools } from '@xalia/mcp-apps-sdk/adapters/vercel';
// Widget components
import { AssistantAppEmbed } from '@xalia/mcp-apps-sdk/widget';If you only need to render MCP app widgets:
npm install @xalia/mcp-apps-widgetimport { AssistantAppEmbed } from '@xalia/mcp-apps-widget';
function MyApp() {
return (
<AssistantAppEmbed
widgetHtml={widgetHtml}
toolOutput={result}
metadata={metadata}
/>
);
}Join our Discord community for discussions, support, and updates:
We welcome contributions! Please see our Contributing Guide for details.
MIT License - see LICENSE for details.