Skip to content

marko/mcp

Model Context Protocol (MCP) server that exposes Marko codebase introspection to AI coding agents (Claude Code, Cursor, Codex, and any MCP client). It speaks JSON-RPC over stdio (marko mcp:serve) and answers structured questions about the project — modules, routes, observers, plugins, config, templates — so an agent can reason about a Marko app without grepping.

Like marko/lsp, it builds on marko/codeindexer: tools read the cached symbol index rather than re-parsing. (Installing marko/mcp pulls codeindexer in automatically.)

Terminal window
composer require marko/mcp
Terminal window
marko mcp:serve

Register it with your agent, e.g. for Claude Code:

Terminal window
claude mcp add marko-mcp -- marko mcp:serve

Always available (13 total):

Index-backed tools (10):

ToolPurpose
list_modules, list_commands, list_routesEnumerate the module graph
find_event_observersObservers listening to an event
find_plugins_targetingPlugins intercepting a class
resolve_preferenceResolve an interface/class to its bound implementation or #[Preference]
resolve_templateResolve a module::template to an absolute path
get_config_schema, check_config_keyInspect config keys
validate_moduleValidate a module’s structure

Runtime tools (3):

ToolNotes
app_infoApplication name and installed package versions
read_log_entriesReads recent log entries; filter by level (use level: error, limit: 1 for the most recent error)
run_console_commandRuns a marko CLI command and captures output

Conditional tools (registered only when their dependency is present):

ToolRequiresNotes
query_databasea marko/database driverRead-only by default; rejects stacked statements (e.g. SELECT 1; DELETE ...); registered only when a DB connection is available
search_docsa docs driver (marko/docs-fts)Registered only when a DocsSearchInterface is bound

There is intentionally no last_error tool and no global error-capture plugin. “Most recent error” is read_log_entries(level: 'error', limit: 1) — one tool, no production-time side effects.