Code2Doce MCP VSCode Extension

VSCode extension for seamless integration of Code2Doce MCP server - SCL code documentation and analysis tools powered by Model Context Protocol (MCP).
✨ Features
🎯 Universal Configuration (New in v1.1.0)
- No workspace dependency - Works anywhere, not limited to Code2Doce project
- Three installation modes:
- 🔹 Extension Embedded - Bundled MCP server (default)
- 🌐 Global Installation - Use system-wide Code2Doce
- 🛠️ Custom Path - Specify your own location
- One-click setup - Automatic resource deployment
- Flexible configuration - Choose what fits your workflow
🖼️ Enhanced PDF Generation (New in v1.1.2)
- Complete image support - Includes all Mermaid diagrams in PDF
- Multi-path resolution - Handles nested directory structures
- Optimized resource paths - Correctly resolves
./Builder/img/ references
- Standalone output - Self-contained PDF documents
📦 Easy Dependency Management
- Install all MCP dependencies with a single command
- Automatic detection of missing packages
- Progress notifications during installation
- Playwright browser auto-installation for Mermaid rendering
⚙️ Seamless Integration
- Enable/disable MCP server from settings or command palette
- Visual status indicator in sidebar
- Auto-install option for dependencies
- Works with GitHub Copilot Chat
When enabled, you can use these tools through GitHub Copilot Chat with @code2doce:
- 📊 Render Mermaid Diagrams - Convert Mermaid syntax to images
- 📄 Generate PDF Documents - Create PDFs from Markdown
- 🔍 Analyze SCL Code - Parse and analyze Siemens SCL code
- 📁 List Library Files - Browse SCL library structure
- 📝 Create Documentation - Generate documentation templates
📥 Installation
From VS Code Marketplace (Recommended)
- Open VS Code Extensions view (
Ctrl+Shift+X)
- Search for "Code2Doce MCP"
- Click Install
- Follow the setup wizard for initial configuration
From Command Line
code --install-extension liangxuewen.code2doce-mcp
From VSIX File
- Download the
.vsix file from Releases
- Run:
code --install-extension code2doce-mcp-1.1.2.vsix
🚀 Quick Start
First-Time Setup
After installation, the extension will guide you through setup:
Choose Installation Mode:
- Extension Embedded (Recommended) - Everything bundled, no external dependencies
- Global Installation - Use existing Code2Doce installation
- Custom Path - Specify custom location
Install Dependencies (if needed)
- Command Palette →
Code2Doce: Install MCP Dependencies
- Installs Python packages and Playwright browsers
Start Using
- Open GitHub Copilot Chat (
Ctrl+Alt+I)
- Type
@code2doce to access tools
Usage
🎮 Commands
Code2Doce: Setup Server - Initial setup wizard for installation mode
Code2Doce: Configure Server Path - Change MCP server location
Code2Doce: Install MCP Dependencies - Install Python packages and browsers
Code2Doce: Enable MCP Server - Enable MCP server integration
Code2Doce: Disable MCP Server - Disable MCP server integration
Code2Doce: Check MCP Server Status - View current status and configuration
⚙️ Settings
Server Configuration:
code2doce.mcp.enabled - Enable/disable MCP server (default: true)
code2doce.mcp.serverPath - Custom MCP server path (optional)
code2doce.mcp.installLocation - Installation mode: extension, global, or custom
Python Environment:
code2doce.mcp.pythonPath - Custom Python path (default: auto-detect)
code2doce.mcp.autoInstall - Auto-prompt for dependency installation (default: true)
Image Path Configuration (Important for PDF Generation):
When generating PDFs, ensure your Markdown files reference images correctly:
<!-- Correct - relative path from markdown file -->

<!-- Also supported - various relative paths -->


The extension automatically configures Pandoc to search in multiple directories:
- Current directory (
.)
Builder/ subdirectory
Builder/img/ subdirectory
🛠️ Using with GitHub Copilot
Once enabled, use @code2doce in Copilot Chat to access these tools:
Render Mermaid Diagrams:
@code2doce 将这个 mermaid 图表渲染为图片
Generate PDF with Images:
@code2doce 生成 PDF 文档,包含所有图片
Analyze SCL Code:
@code2doce 分析 LAF_ClockGen.scl 文件
List Library Files:
@code2doce 列出 LBC 类别下的所有文件
Create Documentation:
@code2doce 为 LGF_FIFO.scl 创建文档模板
The extension adds a "Code2Doce" section to your activity bar showing:
- ✅/⚪ MCP Server status (click to toggle)
- ✅/⚠️ Dependencies status (click to install if missing)
- 🛠️ Available tools list
📋 Requirements
- VS Code: 1.95.0 or higher
- Python: 3.8+ (auto-detected or configurable)
- For Extension Embedded Mode: No additional requirements
- For Global/Custom Mode: Code2Doce installation with dependencies
Extension Settings
This extension contributes the following settings:
code2doce.mcp.enabled: Enable/disable Code2Doce MCP server
code2doce.mcp.serverPath: Custom MCP server path (for custom installation)
code2doce.mcp.installLocation: Installation mode (extension, global, custom)
code2doce.mcp.pythonPath: Custom Python executable path
code2doce.mcp.autoInstall: Automatically prompt to install missing dependencies
🐛 Troubleshooting
PDF Missing Images
If your generated PDF doesn't include images:
- Check image paths in Markdown are relative (e.g.,
./Builder/img/image.png)
- Ensure images exist in the referenced location
- Use the extension's embedded mode for automatic path resolution
MCP Server Not Found
If the server fails to start:
- Run
Code2Doce: Setup Server to reconfigure
- Check Python installation:
python --version
- Verify dependencies:
Code2Doce: Install MCP Dependencies
Copilot Not Detecting @code2doce
- Restart VS Code after enabling the extension
- Check MCP server status in sidebar
- Ensure
code2doce.mcp.enabled is true
📝 Release Notes
1.1.2 (Latest)
🖼️ Enhanced PDF Generation:
- ✅ Complete image support for Mermaid diagrams
- ✅ Multi-path resource resolution
- ✅ Fixed nested directory image references
- ✅ Optimized Pandoc configuration
1.1.1
🔧 Improvements:
- Enhanced PDF generation with better resource path handling
- Improved documentation
1.1.0
🎯 Major Update - Universal Configuration:
- ✅ No workspace dependency - works anywhere
- ✅ Three installation modes (embedded/global/custom)
- ✅ Embedded MCP server resources
- ✅ One-click setup wizard
- ✅ New commands for configuration
- ⚠️ Breaking: Requires reconfiguration for existing users
1.0.0
🎉 Initial Release:
- MCP server definition provider
- One-click dependency installation
- Configuration UI in settings and sidebar
- Auto-detection of Python environment
- Status monitoring
👨💻 For Developers
Building
cd vscode-extension
npm install
npm run compile
Testing
npm run test
Packaging
npm install -g @vscode/vsce
vsce package
This creates a .vsix file you can install with:
code --install-extension code2doce-mcp-1.1.2.vsix
Publishing
# Login to publisher account
vsce login liangxuewen
# Publish new version
vsce publish
📄 License
MIT License - see LICENSE file for details
🤝 Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
🔗 Links
📞 Support
如有问题或需求,请:
Made with ❤️ by liangxuewen