π Automate spreadsheet tasks with AI powered by Univer and Model Context Protocol (MCP)
This starter kit provides a seamless integration between Univer - a powerful open-source office suite engine - and Model Context Protocol (MCP), enabling AI applications to interact with spreadsheets, documents, and presentations through a standardized interface.
- π MCP Integration: Built-in Model Context Protocol support for AI applications
- π Full Spreadsheet Support: Complete Univer Sheets functionality with formulas, data validation, and more
- π€ AI-Ready: Developer tools and UI components designed for AI interaction
- π¨ Customizable: Extensible plugin architecture with theme support
- π Cross-Platform: Works in browsers with server-side capabilities
- π Real-time: Live collaboration and real-time updates (advanced features)
This kit integrates several key Univer components:
- @univerjs-pro/mcp: Core MCP protocol implementation
- @univerjs-pro/mcp-ui: User interface for MCP interactions
- @univerjs-pro/sheets-mcp: Spreadsheet-specific MCP features
- @univerjs/presets: Pre-configured Univer components
Univer MCP enables AI applications to interact with spreadsheets through the Model Context Protocol. The architecture includes MCP hosts (like Cursor, Claude), Univer MCP Server, mcp-bridge plugin, and the Univer instance.
π For complete architecture details and implementation guide, visit the Univer MCP Repository.
Note: Univer MCP is currently in early development. Chart generation and advanced visualizations will be supported in future releases. We welcome your feedback and feature requests!
This starter kit provides the following MCP tools for AI applications:
π Data Operations:
set_range_data
- Set values in cell rangesget_range_data
- Read cell values and datasearch_cells
- Search for specific content in cellsauto_fill
- Auto-fill data patternsformat_brush
- Copy and apply cell formatting
π Sheet Management:
create_sheet
- Create new worksheetsdelete_sheet
- Remove worksheetsrename_sheet
- Rename existing sheetsactivate_sheet
- Switch active worksheetmove_sheet
- Reorder sheet positionsset_sheet_display_status
- Show/hide sheetsget_sheets
- List all sheetsget_active_unit_id
- Get current workbook ID
ποΈ Structure Operations:
insert_rows
/insert_columns
- Add rows and columnsdelete_rows
/delete_columns
- Remove rows and columnsset_cell_dimensions
- Adjust row heights and column widthsset_merge
- Merge cell ranges
π¨ Formatting & Styling:
set_range_style
- Apply cell stylingadd_conditional_formatting_rule
- Add conditional formattingset_conditional_formatting_rule
- Update conditional formattingdelete_conditional_formatting_rule
- Remove conditional formattingget_conditional_formatting_rules
- List formatting rules
β Data Validation:
add_data_validation_rule
- Add validation rulesset_data_validation_rule
- Update validation rulesdelete_data_validation_rule
- Remove validation rulesget_data_validation_rules
- List validation rules
π Utility Functions:
get_activity_status
- Get workbook status and infoscroll_and_screenshot
- Navigate and capture screenshots
π Upcoming Features
- Chart creation and manipulation tools
- Advanced data visualization options
- Tell us what you'd like to see next!
- Node.js: Version 18.0 or higher
- Package Manager: pnpm (recommended) or npm
- Univer License: Optional 30-day trial license for advanced features (Get License)
git clone https://github.com/YOUR_USERNAME/univer-mcp-start-kit.git
cd univer-mcp-start-kit
Using pnpm (recommended):
# Install pnpm if you haven't already
npm install -g pnpm
# Install project dependencies
pnpm install
Using npm:
npm install
Create a .env
file in the root directory for advanced features:
# Optional: Add your Univer license for advanced features
UNIVER_CLIENT_LICENSE=your_license_key_here
# Using pnpm
pnpm dev
# Using npm
npm run dev
The application will start at http://localhost:5173
by default.
If you want to add MCP functionality to an existing Univer project, follow these steps:
# Core MCP packages
pnpm add @univerjs-pro/mcp @univerjs-pro/mcp-ui @univerjs-pro/sheets-mcp
# Or using npm
npm install @univerjs-pro/mcp @univerjs-pro/mcp-ui @univerjs-pro/sheets-mcp
Add the following to your main setup file:
import { UniverMCPPlugin } from '@univerjs-pro/mcp'
import { UniverMCPUIPlugin } from '@univerjs-pro/mcp-ui'
// language files
import univerMCPUIEnUS from '@univerjs-pro/mcp-ui/locale/en-US'
import { UniverSheetMCPPlugin } from '@univerjs-pro/sheets-mcp'
// Import CSS
import '@univerjs-pro/mcp-ui/lib/index.css'
// Register plugins with your Univer instance
univer.registerPlugin(UniverMCPPlugin)
univer.registerPlugin(UniverMCPUIPlugin, {
showDeveloperTools: true, // Enable developer tools
})
univer.registerPlugin(UniverSheetMCPPlugin)
Make sure to expose the Univer API for MCP to access:
// Make univerAPI available globally for MCP
window.univerAPI = univerAPI
Add the Univer plugin to your vite.config.ts
:
import { univerPlugin } from '@univerjs/vite-plugin'
export default defineConfig({
plugins: [
univerPlugin(),
// your other plugins
],
define: {
'process.env.UNIVER_CLIENT_LICENSE': `"${env.UNIVER_CLIENT_LICENSE}"`,
},
})
Here's a complete example of integrating MCP into a basic Univer setup:
import { UniverMCPPlugin } from '@univerjs-pro/mcp'
import { UniverMCPUIPlugin } from '@univerjs-pro/mcp-ui'
// omit more imports for brevity
import univerMCPUIEnUS from '@univerjs-pro/mcp-ui/locale/en-US'
import { UniverSheetMCPPlugin } from '@univerjs-pro/sheets-mcp'
import { createUniver, LocaleType, LogLevel } from '@univerjs/presets'
import { UniverSheetsCorePreset } from '@univerjs/presets/preset-sheets-core'
import sheetsCoreEnUs from '@univerjs/presets/preset-sheets-core/locales/en-US'
import '@univerjs-pro/mcp-ui/lib/index.css'
const { univerAPI, univer } = createUniver({
locale: LocaleType.EN_US,
logLevel: LogLevel.VERBOSE,
locales: {
[LocaleType.EN_US]: merge(
{},
sheetsCoreEnUs,
univerMCPUIEnUS,
),
},
presets: [
UniverSheetsCorePreset({
container: 'univer-container',
}),
],
plugins: [
UniverMCPPlugin,
[UniverMCPUIPlugin, { showDeveloperTools: true }],
UniverSheetMCPPlugin,
],
})
// Expose API for MCP
window.univerAPI = univerAPI
// Create initial workbook
univer.createUnit(UniverInstanceType.UNIVER_SHEET, {})
A: No, this kit works with the open-source version of Univer. However, an optional license unlocks advanced features and removes limitations. You can get a 30-day trial license for free.
A: Visit https://univer.ai/license to get a free 30-day trial license for advanced features.
A: Ensure that:
- All MCP plugins are properly registered
window.univerAPI
is correctly exposed- The MCP UI plugin has
showDeveloperTools: true
(for debugging) - Check browser console for any error messages
A: Yes! This kit implements the Model Context Protocol (MCP) standard, making it compatible with any MCP-compatible AI application or framework.
We welcome contributions! Here's how you can help:
- Report Issues: Open an issue on GitHub for bugs or feature requests
- Submit PRs: Fork the repository, make changes, and submit a pull request
- Improve Documentation: Help us improve this README and add examples
- Share Use Cases: Tell us how you're using this kit
This project is licensed under the Apache 2.0 License.
- Univer Official Website
- Univer MCP Repository
- Univer GitHub Repository
- Univer Documentation
- Univer Examples
- Get Univer License
- Model Context Protocol
- π¬ GitHub Discussions
- π Report Issues
- π§ Discord Community
Made with β€οΈ by the Univer Community