Web App → MCP Surface Compiler
Static analysis of React apps to auto-generate Model Context Protocol (MCP) servers. Point it at your source code, get a runnable MCP server that exposes your app's UI capabilities as structured, agent-callable tools.
React App Source → AST Analysis → Intermediate Representation → MCP Server
ui-lift scans your React components and extracts:
| Source | Generated Tool |
|---|---|
useState hooks |
get_* (read) + set_* (write) tools |
useReducer hooks |
dispatch_* action tools |
onClick, onSubmit, etc. |
Action trigger tools |
fetch() / axios.*() calls |
API call tools with typed params |
npm install -g ui-lift
# or
npx ui-lift scan ./src
# Scan a React app and generate an MCP server
ui-lift scan ./src --output ./mcp-server --name my-app
# Run the generated server
cd mcp-server
npm install
node server.js
ui-lift scan <srcDir>
Options:
-f, --framework <framework> Framework (default: "react")
-o, --output <dir> Output directory (default: "./mcp-server")
-n, --name <name> App name
Given this React component:
function TodoApp() {
const [todos, setTodos] = useState([]);
const [input, setInput] = useState('');
const addTodo = () => { /* ... */ };
const saveTodos = async () => {
await fetch('/api/todos', { method: 'POST', body: JSON.stringify(todos) });
};
return (
<div>
<input value={input} onChange={(e) => setInput(e.target.value)} />
<button onClick={addTodo}>Add</button>
<button onClick={saveTodos}>Save</button>
</div>
);
}
ui-lift generates these MCP tools:
| Tool | Type | Description |
|---|---|---|
get_todo_app_todos |
state-read | Read the current todos array |
set_todo_app_todos |
state-write | Update the todos array |
get_todo_app_input |
state-read | Read the input value |
set_todo_app_input |
state-write | Update the input value |
action_todo_app_click |
action | Trigger click events |
api_todo_app_post_api_todos |
api-call | POST /api/todos |
import { scan, parseReactFile } from 'ui-lift';
// Full scan
const schema = await scan({
srcDir: './src',
framework: 'react',
outputDir: './mcp-server',
appName: 'my-app',
});
console.log(`Generated ${schema.tools.length} tools`);
// Parse a single file
const results = parseReactFile(sourceCode, 'App.tsx');
mcp-server/
├── server.js # Runnable MCP server
├── package.json # Dependencies (MCP SDK, zod)
└── ir-schema.json # Full intermediate representation
src/
├── parser/
│ └── react-parser.ts # Babel AST analysis
├── ir/
│ └── types.ts # Unified intermediate representation
├── generator/
│ └── mcp-generator.ts # MCP server code generation
├── index.ts # Library entry + scanner
└── cli.ts # CLI entry point
Three example apps are included in examples/:
Try them:
ui-lift scan examples/todo-app/src --name todo-app --output /tmp/todo-mcp
MIT