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.)
Installation
Section titled “Installation”composer require marko/mcpmarko mcp:serveRegister it with your agent, e.g. for Claude Code:
claude mcp add marko-mcp -- marko mcp:serveAlways available (13 total):
Index-backed tools (10):
| Tool | Purpose |
|---|---|
list_modules, list_commands, list_routes | Enumerate the module graph |
find_event_observers | Observers listening to an event |
find_plugins_targeting | Plugins intercepting a class |
resolve_preference | Resolve an interface/class to its bound implementation or #[Preference] |
resolve_template | Resolve a module::template to an absolute path |
get_config_schema, check_config_key | Inspect config keys |
validate_module | Validate a module’s structure |
Runtime tools (3):
| Tool | Notes |
|---|---|
app_info | Application name and installed package versions |
read_log_entries | Reads recent log entries; filter by level (use level: error, limit: 1 for the most recent error) |
run_console_command | Runs a marko CLI command and captures output |
Conditional tools (registered only when their dependency is present):
| Tool | Requires | Notes |
|---|---|---|
query_database | a marko/database driver | Read-only by default; rejects stacked statements (e.g. SELECT 1; DELETE ...); registered only when a DB connection is available |
search_docs | a docs driver (marko/docs-fts) | Registered only when a DocsSearchInterface is bound |
There is intentionally no
last_errortool and no global error-capture plugin. “Most recent error” isread_log_entries(level: 'error', limit: 1)— one tool, no production-time side effects.
Related Packages
Section titled “Related Packages”marko/codeindexer— the cached index the tools readmarko/lsp— the editor-facing peer that reads the same indexmarko/docs-fts— enablessearch_docs