elsanchez/mcp-server-fvwm3
If you are the rightful owner of mcp-server-fvwm3 and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
MCP Server for FVWM3 provides access to FVWM3 window manager configuration, state, and control capabilities, enabling LLMs to interact with FVWM3 for various tasks.
MCP Server for FVWM3
Model Context Protocol (MCP) server providing access to FVWM3 window manager configuration, state, and control capabilities. This server enables LLMs to interact with FVWM3 for configuration generation, debugging, window management, and development assistance.
Features
Resources
Access to FVWM3 configuration files, documentation, scripts, and runtime state:
- Configuration files: Live and repository versions of FVWM config
- Documentation: Architecture docs, shortcuts reference, smart tiling technical docs
- Scripts: Smart tiling, monitor setup, keyboard layout toggle
- Runtime state: Current monitors, windows, desktops, tile states
- Debug logs: Smart tiling debug information
Tools
Executable tools for FVWM3 control and queries:
fvwm_execute: Execute any FVWM command via FvwmCommandfvwm_get_window_info: Get window details (geometry, class, desktop)fvwm_get_monitor_layout: Query current monitor configurationfvwm_test_function: Check if FVWM function existsfvwm_restart: Restart FVWM3 to apply changesfvwm_validate_config: Basic configuration syntax validationfvwm_get_keybindings: List all keyboard bindingssmart_tile_debug: View smart tiling debug logssmart_tile_state: View or clear window tiling statesfvwm_get_desktop_info: Get current desktop and page info
Prompts
Templates for generating FVWM3 configurations:
create-window-function: Generate new window manipulation functionsadd-keybinding: Create keybindings with conflict checkingcreate-tiling-script: Generate bash scripts for tiling operationsdebug-fvwm-issue: Systematic debugging guidecreate-menu: Generate FVWM menu configurations
Installation
Prerequisites
- Node.js 18 or higher
- FVWM3 window manager (version 1.1.5+)
xrandrfor monitor detectionFvwmCommandfor FVWM control
Build from Source
# Clone the repository
git clone https://github.com/elsanchez/mcp-server-fvwm3.git
cd mcp-server-fvwm3
# Install dependencies
npm install
# Build
npm run build
# The server binary will be at build/index.js
Development Mode
# Watch mode (rebuild on changes)
npm run watch
# Run in development mode with source maps
npm run dev
Configuration
Claude Desktop
Add to your Claude Desktop configuration file:
macOS/Linux: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"fvwm3": {
"command": "node",
"args": ["/absolute/path/to/mcp-server-fvwm3/build/index.js"]
}
}
}
Other MCP Clients
The server uses stdio transport and follows the MCP specification. Configure according to your client's documentation.
Usage Examples
Accessing Resources
// Read main FVWM configuration
const config = await readResource("fvwm://config/main");
// Get smart tiling documentation
const docs = await readResource("fvwm://docs/smart-tiling");
// Check current monitor layout
const monitors = await readResource("fvwm://state/monitors");
// View tile states for all windows
const states = await readResource("fvwm://state/tile-states");
Using Tools
// Execute FVWM command
await executeTool("fvwm_execute", {
command: "Restart"
});
// Get info about specific window
await executeTool("fvwm_get_window_info", {
window_id: "0x9200005"
});
// View last 100 lines of debug log
await executeTool("smart_tile_debug", {
lines: 100
});
// Clear all tile states
await executeTool("smart_tile_state", {
action: "clear"
});
Using Prompts
// Generate a new window function
await getPrompt("create-window-function", {
function_name: "MoveToCenterAndResize",
description: "move the window to the center of the current monitor and resize to 80% width and height"
});
// Add a keybinding with conflict checking
await getPrompt("add-keybinding", {
key_combo: "Super_L+m",
action: "maximize the current window on its current monitor",
context: "W"
});
// Debug an issue
await getPrompt("debug-fvwm-issue", {
issue_description: "windows are not tiling correctly on the second monitor"
});
Architecture
Directory Structure
mcp-server-fvwm3/
├── src/
│ ├── index.ts # Main server entry point
│ ├── resources.ts # Resource handlers
│ ├── tools.ts # Tool implementations
│ └── prompts.ts # Prompt templates
├── build/ # Compiled JavaScript (generated)
├── package.json # npm configuration
├── tsconfig.json # TypeScript configuration
└── README.md # This file
Resource URIs
All resources use the fvwm:// URI scheme:
fvwm://config/*- Configuration filesfvwm://docs/*- Documentation filesfvwm://scripts/*- Bash scriptsfvwm://state/*- Runtime state (dynamic)fvwm://logs/*- Debug and error logs
FVWM3 Context
This server is designed for a specific FVWM3 setup:
- Monitors: 3 displays (DP-4, HDMI-0, DP-2) in horizontal arrangement
- Desktops: 4 virtual desktops with 2x2 pages each
- Smart Tiling: Windows 11-style snap with monitor cycling
- Keybinding Scheme: QWAS for desktop navigation
- Theme: Dracula/Nord inspired dark theme
See fvwm://docs/claude for complete architecture documentation.
Development
Project Structure
-
Resources: Read-only access to files and runtime state
- File-based: Direct file system reads
- Runtime: Execute commands and parse output
-
Tools: Execute operations with side effects
- FVWM commands via
FvwmCommand - System queries via shell commands
- State management
- FVWM commands via
-
Prompts: LLM-oriented templates
- Context-aware code generation
- Best practices included
- Current setup details embedded
Adding New Resources
- Add resource definition to
getResources()insrc/resources.ts - Implement handler in
readResource()switch statement - Use appropriate MIME type (text/plain, application/json, etc.)
Adding New Tools
- Add tool definition to
getTools()insrc/tools.ts - Define input schema with JSON Schema
- Implement handler in
executeTool()switch statement - Return
{ content: [{ type: "text", text: "..." }] }
Adding New Prompts
- Add prompt definition to
getPrompts()insrc/prompts.ts - Define arguments with descriptions
- Implement template in
getPrompt()switch statement - Include relevant context from FVWM3 setup
Known Limitations
- FVWM3 Required: Server assumes FVWM3 is installed and running
- File Paths: Hardcoded to
~/.fvwm/and~/repo/utils/desktop-settings/ - Monitor Setup: Hardcoded monitor names (DP-4, HDMI-0, DP-2)
- No Config Validation: Basic syntax checking only, not full validation
- Security: Executes shell commands - use in trusted environments only
Security Considerations
This server executes shell commands and FVWM commands with user privileges:
- Only use in trusted environments
- Review generated commands before execution
- Avoid exposing to untrusted networks
- File system access is limited to user's home directory
Troubleshooting
Server Won't Start
# Check Node.js version
node --version # Should be 18+
# Check build output
npm run build
# Run in dev mode to see errors
npm run dev
FvwmCommand Not Found
# Check FVWM3 installation
which FvwmCommand
fvwm3 --version
# Ensure FVWM3 is running
ps aux | grep fvwm3
Resource Not Found
- Verify file paths in
src/resources.tsmatch your setup - Check that FVWM3 config exists at
~/.fvwm/config - Ensure desktop-settings repo is at
~/repo/utils/desktop-settings/
Tool Execution Fails
- Check that FvwmCommand is accessible
- Verify FVWM3 is running and responsive
- Check debug logs:
tail -f ~/.fvwm/smart-tile-debug.log
Contributing
This is a personal project tailored to a specific FVWM3 setup. If you want to adapt it:
- Fork the repository
- Update file paths in
resources.tsandtools.ts - Modify monitor names in tool implementations
- Adjust prompts to match your setup
- Update documentation
License
MIT License - See LICENSE file for details
Related Projects
- FVWM3 - F? Virtual Window Manager
- Model Context Protocol - Protocol specification
- MCP SDK - TypeScript SDK
References
Author
elsanchez
Version History
- 1.0.0 (2025-12-05)
- Initial release
- Resources: Configuration, documentation, scripts, state
- Tools: 10 FVWM control and query tools
- Prompts: 5 configuration generation templates
- Smart tiling system integration