The PlayCanvas Editor is a visual development platform for interactive web content. Built on the PlayCanvas Engine, it provides a comprehensive suite of tools for creating 3D applications directly in your browser.
MCP (Model Context Protocol) is a standardized protocol for AI models to interact with external tools and services. In this project, we use MCP to:
Retrieves up-to-date documentation and code examples for PlayCanvas and other libraries. Used for intelligent code completion and documentation.
Enables automated testing and debugging of the PlayCanvas editor UI through browser automation.
Assists in complex problem-solving for 3D mathematics and rendering algorithms.
// Using MCP context7 to fetch PlayCanvas docs
const fetchPlayCanvasDocs = async (topic: string) => {
const response = await mcp.context7.getLibraryDocs({
context7CompatibleLibraryID: '/playcanvas/engine',
topic: topic,
tokens: 10000
});
return response;
};
// Example: Get documentation for pc.Application
const appDocs = await fetchPlayCanvasDocs('Application');git clone https://github.com/playcanvas/editor.git cd editornpm install # or pnpm install// mcp.config.js
export default {
servers: {
context7: {
command: 'npx',
args: ['@context7/mcp-server'],
env: {}
},
playwright: {
command: 'npx',
args: ['@playwright/mcp-server'],
env: {}
}
}
};npm run dev # Editor will be available at http://localhost:3000const canvas = document.getElementById('application');
const app = new pc.Application(canvas, {
mouse: new pc.Mouse(canvas),
touch: new pc.TouchDevice(canvas)
});
app.start();const entity = new pc.Entity('cube');
entity.addComponent('render', {
type: 'box'
});
app.root.addChild(entity);const light = new pc.Entity('light');
light.addComponent('light', {
type: 'directional',
color: new pc.Color(1, 1, 1),
intensity: 1
});
light.setEulerAngles(45, 0, 0);
app.root.addChild(light);This is an embedded PlayCanvas Editor instance. You can interact with it directly.