devframe
raw JSON → 0.1.21 verified Sat May 09 auth: no javascript
A framework-neutral foundation for building generic DevTools, part of the Vite DevTools monorepo (MIT). Current stable version is 0.1.21, with weekly releases featuring breaking changes and new capabilities. Provides an RPC layer based on birpc + valibot + WebSocket presets, plus six built-in hosts: RPC, docks, views, terminals, logs, commands, and an agent interface for MCP integration. Includes adapters for CLI, build, SPA, Vite, Kit, embedded, and MCP. Key differentiators: designed specifically for developer tooling, first-class MCP support for AI agents, and a modular architecture that decouples UI from logic since v0.1.21. Ships TypeScript types. Requires @modelcontextprotocol/sdk as a peer dependency for MCP features.
Common errors
error ERR_REQUIRE_ESM: require() of ES Module /path/to/node_modules/devframe/index.mjs from /path/to/your-file.js not supported. ↓
cause devframe is ESM-only; CommonJS require() is not allowed.
fix
Use import syntax if your project is ESM, or use dynamic import: const { defineDevtool } = await import('devframe').
error Cannot find module 'devframe/adapters/mcp' or its corresponding type declarations. ↓
cause Importing MCP adapter from wrong path or missing @modelcontextprotocol/sdk peer dependency.
fix
Ensure you have installed @modelcontextprotocol/sdk and import from 'devframe/adapters/mcp' (not 'devframe').
error TypeError: devtool.agent.registerResource is not a function ↓
cause Agent API is only available when using the experimental agent feature; ctx.agent may not be populated in non-agent setups.
fix
Check that you have configured the devtool with agent-native support enabled. Ensure you are using a version >=0.1.16.
error Logs property 'ctx.logs' is undefined in v0.1.17+ ↓
cause ctx.logs was renamed to ctx.messages in v0.1.17.
fix
Replace ctx.logs with ctx.messages in your code.
error Mount path /__/devtools/ returned 404 ↓
cause Mount path convention changed from '/.' to '/__' in v0.1.21.
fix
Update your URL to use '/__' prefix, e.g., http://localhost:3000/__/devtools/.
Warnings
breaking DevTools mount-path convention changed from '/.' to '/__' in v0.1.21. ↓
fix Update any hardcoded mount paths in your integrations from '/.' to '/__'.
breaking Decoupling of docks/terminals/messages/commands from devframe core in v0.1.21 - these hosts are now separate packages. ↓
fix Import host modules from dedicated packages (e.g., @devframe/docks) instead of relying on devframe exports.
breaking Respect vite https config only for embedded client in v0.1.12. ↓
fix If you use devframe with a custom HTTPS setup, ensure your config is correctly applied to the embedded client.
deprecated ctx.logs renamed to ctx.messages in v0.1.17. The old ctx.logs is removed. ↓
fix Replace all references to ctx.logs with ctx.messages.
gotcha Agent-native API (agent field, DevToolsAgentHost, MCP adapter) is experimental and may change without a major version bump. ↓
fix Pin your devframe version and avoid relying on undocumented agent features in production.
gotcha ESM-only package: CommonJS require() will fail. ↓
fix Use import syntax or dynamic import with await when consuming in CommonJS environments.
Install
npm install devframe yarn add devframe pnpm add devframe Imports
- defineDevtool wrong
const { defineDevtool } = require('devframe')correctimport { defineDevtool } from 'devframe' - defineRpcFunction wrong
import { defineRpcFunction } from 'devframe/rpc'correctimport { defineRpcFunction } from 'devframe' - createMcpServer wrong
import { createMcpServer } from 'devframe'correctimport { createMcpServer } from 'devframe/adapters/mcp' - defineDevtool (type) wrong
import { DevtoolDef } from 'devframe'correctimport type { DevtoolDef } from 'devframe' - createMcpServer (CJS workaround) wrong
const { createMcpServer } = require('devframe/adapters/mcp')correctconst { createMcpServer } = await import('devframe/adapters/mcp')
Quickstart
import { defineDevtool, defineRpcFunction } from 'devframe';
import { createServer } from 'node:http';
const getSummary = defineRpcFunction({
name: 'my-plugin:get-summary',
type: 'query',
agent: {
description: 'Return a short summary of the current build state.',
},
setup: () => ({
handler: async () => ({ status: 'ok', timestamp: Date.now() }),
}),
});
const devtool = defineDevtool({
id: 'my-plugin',
setup(ctx) {
ctx.rpc.register(getSummary);
ctx.agent.registerResource({
id: 'latest-build',
name: 'Latest build',
read: () => ({ text: 'Build successful' }),
});
},
});
const httpServer = createServer();
httpServer.listen(3000, () => {
console.log('DevFrame server listening on port 3000');
});