GameMaker Language documentation tools with MCP server and CLI - search, lookup, and convert GameMaker documentation
npm install @petah/gamemaker-mcpA comprehensive toolkit for GameMaker Language (GML) documentation management, featuring an MCP server, CLI tools, and HTML-to-Markdown conversion utilities.
> Includes GameMaker Documentation: This package comes with GameMaker Language documentation built-in. No additional setup or file downloads required!
- MCP Server: Model Context Protocol server for programmatic documentation access
- CLI Documentation Tool: Search, lookup, and browse GameMaker documentation from the command line
- HTML Converter: Convert GameMaker HTML documentation to clean Markdown format
- Modern Node.js: Built with ES modules, structured error handling, and performance monitoring
- Node.js: >= 22.0.0
- npm: Latest version recommended
No installation needed! Run directly with npx:
``bashRun MCP server
npx @petah/gamemaker-mcp
$3
`bash
Install globally
npm install -g @petah/gamemaker-mcpThen use directly
gamemaker-mcp
gm-cli --help
gm-docs lookup draw_sprite
`$3
`bash
Clone the repository
git clone
cd gm-mcpInstall dependencies
npm install
`Usage
$3
The CLI provides comprehensive GameMaker documentation lookup and search capabilities:
`bash
Using npx (recommended)
npx @petah/gamemaker-mcp gm-cli --help
npx @petah/gamemaker-mcp gm-docs lookup draw_spriteAlternative npx usage
npx @petah/gamemaker-mcp gm-cli lookup draw_sprite
npx @petah/gamemaker-mcp gm-docs search collisionGlobal installation
gm-cli --help
gm-docs lookup draw_spriteAll CLI commands work the same way:
Look up a specific function
gm-docs lookup draw_spriteSearch documentation
gm-docs search collisionList functions by pattern
gm-docs list drawShow available categories
gm-docs categoriesList functions in a category
gm-docs category DrawingGet specific file content
gm-docs file GameMaker_Language/GML_Reference/Drawing/Sprites_And_Tiles/draw_sprite.mdConvert HTML docs to Markdown
gm-docs convert
gm-docs convert ./html ./markdownLocal development
npm run cli -- --help
npm run cli lookup draw_sprite
`#### Development Mode
Use watch mode for development with automatic reloading:
`bash
Local development only
npm run cli:dev -- --help
`#### Custom Documentation Path (Optional)
The package includes GameMaker documentation by default. If you need to use custom docs:
`bash
Using npx
npx @petah/gamemaker-mcp gm-docs --path /path/to/docs lookup draw_spriteGlobal installation
gm-docs --path /path/to/docs lookup draw_spriteLocal development
npm run cli -- --path /path/to/docs lookup draw_sprite
`$3
Start the Model Context Protocol server for programmatic access:
`bash
Using npx (recommended) - includes built-in GameMaker docs
npx @petah/gamemaker-mcpOr with alternative command
npx @petah/gamemaker-mcp gamemaker-mcpGlobal installation
gamemaker-mcp
gamemaker-docs-serverLocal development
npm run mcp
node src/gamemaker-docs-server.jsCustom documentation path (optional)
npx @petah/gamemaker-mcp /path/to/custom/docs
`The MCP server provides 5 tools:
-
lookup_gamemaker_function - Look up specific GML functions
- search_gamemaker_docs - Search documentation content
- list_gamemaker_functions - List functions by pattern or category
- get_gamemaker_file - Retrieve specific documentation files
- init_gamemaker_agent - Initialize with comprehensive GML coding guide#### MCP Configuration
For Claude Desktop or other MCP clients, add this to your configuration:
Claude Desktop (claude_desktop_config.json):
`json
{
"mcpServers": {
"gamemaker-docs": {
"command": "npx",
"args": ["@petah/gamemaker-mcp"],
"env": {}
}
}
}
`VS Code (.vscode/settings.json):
`json
{
"mcp.servers": {
"gamemaker-docs": {
"command": "npx",
"args": ["@petah/gamemaker-mcp"],
"cwd": "${workspaceFolder}"
}
}
}
`With custom documentation path (optional):
`json
{
"mcpServers": {
"gamemaker-docs": {
"command": "npx",
"args": ["@petah/gamemaker-mcp", "/path/to/your/gamemaker/docs"],
"env": {}
}
}
}
`> Note: The package includes GameMaker documentation by default, so no path configuration is needed for standard usage.
$3
Convert GameMaker HTML documentation to clean Markdown:
`bash
Convert with default paths (docs -> md)
npm run convertConvert with custom paths
npm run cli convert /path/to/html /path/to/output
`Project Structure
`
src/
├── cli.js # Main CLI entry point
├── gamemaker-docs-server.js # MCP server implementation
├── commands/ # CLI command implementations
│ ├── base-command.js # Shared command functionality
│ ├── lookup.js # Function lookup command
│ ├── search.js # Documentation search command
│ ├── list.js # Function listing command
│ ├── categories.js # Category browsing command
│ ├── category.js # Category-specific listing
│ ├── file.js # File retrieval command
│ ├── convert.js # HTML conversion command
│ └── index.js # Command registry
├── lib/ # Shared libraries
│ ├── docs-indexer.js # Documentation indexing and search
│ ├── gamemaker-cli.js # GameMaker CLI functionality
│ ├── html-converter.js # HTML to Markdown converter
│ └── errors.js # Structured error handling
docs/ # Raw HTML documentation
md/ # Converted Markdown documentation
init.txt # GameMaker coding guide for LLM agents
.vscode/mcp.json # VS Code MCP configuration
`Key Features
$3
- ES Modules: Full ESM support with proper import/export syntax
- Node.js Built-ins: Uses
node: prefix for built-in modules
- Structured Error Handling: Rich error context and logging
- Performance Monitoring: Automatic timing and slow operation detection$3
- Smart Indexing: Efficient function and content indexing
- Fuzzy Search: Find functions even with partial or misspelled names
- Category Organization: Browse documentation by logical categories
- Link Conversion: Automatic conversion of HTML links to Markdown paths
$3
- Watch Mode: Hot reloading during development (
npm run cli:dev)
- Structured Logging: Rich error context and debugging information
- Performance Insights: Automatic timing measurements for operations
- Comprehensive Error Handling: Clear error messages with contextExamples
$3
`bash
$ npm run cli lookup draw_spritedraw_sprite(sprite, subimg, x, y)
Draws a sprite at the given position.
Parameters:
- sprite: The sprite to draw
- subimg: The sub-image of the sprite
- x: The x coordinate
- y: The y coordinate
Example:
`gml
draw_sprite(spr_player, 0, x, y);
`
`$3
`bash
$ npm run cli search "collision detection"Found 15 result(s) for "collision detection":
Result 1: GameMaker_Language/GML_Reference/Movement_And_Collisions/Collisions/collision_point.md
Category: Movement and Collisions
Relevance Score: 8.5Returns true if there is a collision at the specified point...
`$3
`bash
$ npm run cli convert ./docs ./outputStarting conversion from ./docs to ./output
Found 1247 HTML files to convert
...
Conversion complete! Converted 1247 files.
htmlConversion: 15.43s
`Development
$3
1. Modular Design: Each command is self-contained in its own file
2. Shared Utilities: Common functionality in the
lib/ directory
3. Error Handling: Structured error classes with rich context
4. Performance: Built-in timing and monitoring capabilities$3
1. Create a new command file in
src/commands/
2. Extend BaseCommand for shared functionality
3. Register the command in src/commands/index.js
4. Follow the existing pattern for error handling and performance monitoring$3
The project uses structured error handling with contextual information:
`javascript
import { ErrorHandler, ValidationError } from './lib/errors.js';// Wrap async operations
await ErrorHandler.wrapAsync(async () => {
// Your async code here
}, { operation: 'myOperation', context: 'additional info' });
// Handle specific errors
throw new ValidationError('Invalid input', 'fieldName', inputValue);
``MIT License - see LICENSE file for details.
1. Fork the repository
2. Create a feature branch
3. Make your changes following the existing code style
4. Submit a pull request