loading…
Search for a command to run...
loading…
An MCP server and VS Code extension that enables users to fetch and browse 4D command documentation with integrated caching. It allows AI assistants to retrieve
An MCP server and VS Code extension that enables users to fetch and browse 4D command documentation with integrated caching. It allows AI assistants to retrieve detailed technical content and open documentation links directly for 4D development support.
A VS Code extension and MCP (Model Context Protocol) server for browsing 4D command documentation.
This project provides two ways to access 4D command documentation:
Both modes share the same caching system for improved performance.
:C123 format) when getting command namenpm install
npm run build
F5 to run the extension in a new VS Code window (for development)npm run package
code --install-extension mcp-4d-docs-0.1.0.vsix
# Clone or navigate to the project
cd mcp-4d-docs
# Install dependencies
npm install
# Build the TypeScript code
npm run build
Cmd+Shift+P):4D: Open Command Documentation in Browser4D: Open Command Documentation in EditorIf no command is detected, you'll be prompted to enter one manually.
Add to your MCP client configuration (e.g., Claude Desktop):
{
"mcpServers": {
"4d-docs": {
"command": "node",
"args": ["/absolute/path/to/mcp-4d-docs/build/index.js"]
}
}
}
For VS Code, add to .vscode/mcp.json:
{
"mcpServers": {
"4d-docs": {
"command": "node",
"args": ["/absolute/path/to/mcp-4d-docs/build/index.js"]
}
}
}
Fetches documentation for a 4D command.
Parameters:
command_name (string): The name of the 4D command (e.g., "ACTIVITY SNAPSHOT", "ARRAY TO LIST")Returns:
<article> tag within the <main> sectionExample:
// Fetches from https://developer.4d.com/docs/commands/activity-snapshot
get_4d_command_docs("ACTIVITY SNAPSHOT")
Clears all cached documentation files.
Returns:
Opens a 4D command documentation page in the default web browser.
Parameters:
command_name (string): The name of the 4D command (e.g., "ACTIVITY SNAPSHOT", "ARRAY TO LIST")Returns:
Example:
// Opens https://developer.4d.com/docs/commands/activity-snapshot in your browser
open_4d_command_in_browser("ACTIVITY SNAPSHOT")
Command Detection (VS Code Extension):
URL Encoding: Command names are converted to lowercase and spaces are replaced with hyphens
Documentation Fetching: The server requests documentation from:
https://developer.4d.com/docs/commands/<encoded-command-name>HTML Extraction: The server parses the HTML and extracts the <article> node from within the <main> tag
Link Rewriting: Relative /docs/ links are converted to absolute URLs
Caching: Results are cached in the OS system cache directory:
~/Library/Caches/mcp-4d-docs/%LOCALAPPDATA%\mcp-4d-docs\~/.cache/mcp-4d-docs/Cache Key: Each command is cached using an MD5 hash of its name as the filename
Display (VS Code Extension):
mcp-4d-docs/
├── src/
│ ├── index.ts # MCP server implementation
│ ├── extension.ts # VS Code extension entry point
│ ├── docService.ts # Shared documentation service
│ ├── commandDetector.ts # Command name detection logic
│ └── webviewProvider.ts # Webview panel management
├── build/ # Compiled JavaScript output
├── logo.png # Extension icon
├── package.json # Project metadata & VS Code extension config
├── tsconfig.json # TypeScript configuration
├── .vscodeignore # Files excluded from extension package
└── README.md
# Install dependencies
npm install
# Build TypeScript
npm run build
# Watch mode for development
npm run watch
# Package extension
npm run package
Press F5 in VS Code to launch the Extension Development Host with the extension loaded.
# Use MCP Inspector
npx @modelcontextprotocol/inspector node build/index.js
@modelcontextprotocol/sdk - Model Context Protocol SDKcheerio - HTML parsing@types/vscode - VS Code API types@vscode/vsce - VS Code extension packagingThe extension works out of the box with no configuration needed. It will:
onLanguage:4d)You can add custom keyboard shortcuts in VS Code:
{
"key": "cmd+k cmd+d",
"command": "4d-docs.openInWebview",
"when": "editorTextFocus"
},
{
"key": "cmd+k cmd+b",
"command": "4d-docs.openInBrowser",
"when": "editorTextFocus"
}
The extension is ready to use locally. After building and packaging:
npm run package
code --install-extension mcp-4d-docs-0.1.0.vsix
Before publishing to the VS Code Marketplace:
Update publisher name in package.json:
"publisher": "your-actual-publisher-id"
Add repository URL in package.json:
"repository": {
"type": "git",
"url": "https://github.com/yourusername/mcp-4d-docs.git"
}
Add a LICENSE file (e.g., LICENSE.txt with MIT license text)
Publish to marketplace:
vsce publish
Or create a VSIX for sharing:
npm run package
# Share the .vsix file
MIT
Contributions are welcome! Please feel free to submit issues or pull requests.
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"4d-documentation-viewer": {
"command": "npx",
"args": []
}
}
}PRs, issues, code search, CI status
Database, auth and storage
Reference / test server with prompts, resources, and tools.
Secure file operations with configurable access controls.