FVWM3 Window Manager

FVWM3 Window Manager

Enables interaction with the FVWM3 window manager for configuration generation, window management, and debugging. Provides access to config files, runtime state, and control tools for managing desktops, monitors, and tiling operations.

Category
访问服务器

README

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 FvwmCommand
  • fvwm_get_window_info: Get window details (geometry, class, desktop)
  • fvwm_get_monitor_layout: Query current monitor configuration
  • fvwm_test_function: Check if FVWM function exists
  • fvwm_restart: Restart FVWM3 to apply changes
  • fvwm_validate_config: Basic configuration syntax validation
  • fvwm_get_keybindings: List all keyboard bindings
  • smart_tile_debug: View smart tiling debug logs
  • smart_tile_state: View or clear window tiling states
  • fvwm_get_desktop_info: Get current desktop and page info

Prompts

Templates for generating FVWM3 configurations:

  • create-window-function: Generate new window manipulation functions
  • add-keybinding: Create keybindings with conflict checking
  • create-tiling-script: Generate bash scripts for tiling operations
  • debug-fvwm-issue: Systematic debugging guide
  • create-menu: Generate FVWM menu configurations

Installation

Prerequisites

  • Node.js 18 or higher
  • FVWM3 window manager (version 1.1.5+)
  • xrandr for monitor detection
  • FvwmCommand for 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 files
  • fvwm://docs/* - Documentation files
  • fvwm://scripts/* - Bash scripts
  • fvwm://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
  • Prompts: LLM-oriented templates

    • Context-aware code generation
    • Best practices included
    • Current setup details embedded

Adding New Resources

  1. Add resource definition to getResources() in src/resources.ts
  2. Implement handler in readResource() switch statement
  3. Use appropriate MIME type (text/plain, application/json, etc.)

Adding New Tools

  1. Add tool definition to getTools() in src/tools.ts
  2. Define input schema with JSON Schema
  3. Implement handler in executeTool() switch statement
  4. Return { content: [{ type: "text", text: "..." }] }

Adding New Prompts

  1. Add prompt definition to getPrompts() in src/prompts.ts
  2. Define arguments with descriptions
  3. Implement template in getPrompt() switch statement
  4. Include relevant context from FVWM3 setup

Known Limitations

  1. FVWM3 Required: Server assumes FVWM3 is installed and running
  2. File Paths: Hardcoded to ~/.fvwm/ and ~/repo/utils/desktop-settings/
  3. Monitor Setup: Hardcoded monitor names (DP-4, HDMI-0, DP-2)
  4. No Config Validation: Basic syntax checking only, not full validation
  5. 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.ts match 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:

  1. Fork the repository
  2. Update file paths in resources.ts and tools.ts
  3. Modify monitor names in tool implementations
  4. Adjust prompts to match your setup
  5. Update documentation

License

MIT License - See LICENSE file for details

Related Projects

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

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选