Skip to content
lyrasoftPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

lyrasoft/agents

A Windwalker Package for LYRASOFT agents. It provides a stdio MCP server for AI coding agents and a command to install shared agent docs/skills into a project.

Table of Contents

Installation

Add the package to the host application and install its resources:

composer require lyrasoft/agents
php windwalker pkg:install lyrasoft/agents --all

This publishes etc/agents.config.php as the agents config module. The commands are only registered in the console client.

Getting Started

Register the MCP server in your agent's config, then restart the agent:

php windwalker agents:mcp:install

Commands

agents:mcp

Run the MCP server over stdio. Normally launched by the agent client, not manually.

Option Description Default
--name MCP server name windwalker-mcp
--search-endpoint, -S Docs search API URL https://docs-search.windwalker.io/search
--chat-endpoint, -C Docs chat completions (OpenAI format) https://docs-search.windwalker.io/chat/completions

agents:mcp:install

Write the MCP server entry into an agent config file.

Option Description
--print, -p Only print the config, do not write any file
--file, -f Config file relative to the project root (asked interactively if omitted)
--target, -t copilot/1 = .github/mcp.json, claude/2 = .mcp.local.json, relative/3 = .mcp.json (relative path)
--key, -k Servers key in the config file (defaults to the target's key)
--id Entry id under the servers key (default windwalker-mcp)
--force Overwrite the entry if it already exists
--php PHP binary to run (default php)
--name Forwarded to agents:mcp --name
--search-endpoint, -S Forwarded to agents:mcp --search-endpoint
--chat-endpoint, -C Forwarded to agents:mcp --chat-endpoint

agents:mcp:restart

Send a restart signal to all running MCP servers, so they reload code changes without restarting the agent.

php windwalker agents:mcp:restart

agents:install

Download agent docs from GitHub repositories (Git Trees API, up to 6 parallel downloads) into the project, and add an @../.agents/main.instructions.md reference to .github/copilot-instructions.md.

php windwalker agents:install lyrasoft/agents-docs --path=docs
php windwalker agents:install lyrasoft/agents-docs --skills -f
Input / Option Description Default
repo (array) One or more GitHub repositories (owner/name)
--path, -p Sub path(s) under files/{lang}/ to install (repeatable) all
--skills, -s Only install the skills directory false
--lang, -l Language folder, files are read from files/{lang}/ zh-TW
--ref Git ref to download from staging
--target, -t Install directory .agents
--token GitHub token for private repositories
--no-link Do not create/update .github/copilot-instructions.md false
--force, -f Overwrite existing files (skipped by default) false

MCP Tools

Tool Description
doc_search Search the official Windwalker documentation
chat Ask a question and get an AI answer based on the official docs
application_info Environment, paths, versions, packages and console commands
database_connections List available database connections
database_query Run a SQL query (non-read-only statements need user confirmation)
database_schema Show table schemas (columns and indexes)
last_error Most recent error log entries with stack trace
read_logs Query the application log files (Monolog, rotating by day)
debugger_history Local web profiler request history (filter by method/url/status)
debugger_data One profiler record: db/routing/http/profiler/events/system, with keyword, minTime, connection, includeBacktrace, limit filters and sort=time (slowest first)

The debugger tools always read local profiler data: dev mode is forced inside the MCP server, no APP_ENV=dev needed. The web debugger must still be enabled and have recorded requests.

Tool Parameters

Time values accept any strtotime() string, e.g. -10 minutes, -1 hour or 2026-11-27 10:00.

doc_search

Param Type Default Notes
query string required Search text
format string md md (Markdown pages) or html

chat

Param Type Default Notes
question string required Question text

application_info

Param Type Default Notes
includeCommands bool true Set false to skip the (long) command list

database_connections: no parameters.

database_query

Param Type Default Notes
sql string required One statement only. Use #__ as table prefix placeholder. Read-only (SELECT/SHOW/DESCRIBE/EXPLAIN/WITH) runs directly, others need user confirmation
connection string/null null Default connection when omitted
limit int 50 Hard max 200

database_schema

Param Type Default Notes
connection string/null null Default connection when omitted
tables string[] [] Empty lists table/view names only; views accepted

last_error

Param Type Default Notes
count int 1 Number of latest errors (level ERROR or above)
channel string/null null e.g. system/error; all channels when omitted
since string/null null e.g. -1 hour
maxLength int 6000 Per-message truncation, 0 = no truncation

read_logs

Param Type Default Notes
listChannels bool false Only list channels with their date ranges
channel string/null null e.g. system/console; end with * or / for prefix match
from / to string/null null Time range
levels string[] [] Exact levels, e.g. ["ERROR","CRITICAL"]
minLevel string/null null e.g. warning includes warning and above
keyword string/null null Case-insensitive, matches message and context
regex string/null null No delimiters, case-insensitive
limit int 50 Max 200
oldestFirst bool false Newest first by default
withContext bool true Include context / extra data
maxLength int 1500 Per-message truncation, 0 = no truncation

debugger_history

Param Type Default Notes
limit int 20 1-100
method string/null null e.g. POST
url string/null null URL contains this text
status int/null null e.g. 500
ajax bool/null null true ajax only, false non-ajax only
since string/null null e.g. -10 minutes

debugger_data

Param Type Default Notes
id string/null null Record ID from debugger_history; latest record when omitted
section string basic basic, db, routing, http, profiler, events, system (system is large, prefer path)
path string/null null Dot path inside the section, e.g. response.status (http)
keyword string/null null db: SQL contains text. profiler: label contains text
minTime float/null null Milliseconds. db: slower than; profiler: duration >=
connection string/null null db only: filter by connection name
includeBacktrace bool false db only: very large output, use with a small limit
limit int 50 db queries / profiler items, 0 = unlimited
sort string/null null time = slowest first, applied before limit
maxLength int 20000 Output truncation, 0 = no truncation

Recommended First-Call Parameters

Start narrow to avoid flooding the context, then widen only when needed.

Tool Suggested arguments
application_info includeCommands: false
database_schema no tables first (names only), then pass 1-3 tables
database_query limit: 20, add LIMIT in SQL; prefix with EXPLAIN to inspect
last_error defaults (count: 1)
read_logs listChannels: true first, then channel, minLevel: warning, since: -1 hour, limit: 20, withContext: false
debugger_history limit: 10, plus url / status filters
debugger_data section: basic first; for queries use section: db, sort: time, limit: 5; never combine includeBacktrace: true with a large limit; avoid section: system without path

Extending the MCP Server

Listen to Lyrasoft\Agents\Event\BuildMcpServerEvent to register extra tools before the server is built:

use Lyrasoft\Agents\Event\BuildMcpServerEvent;

#[ListenTo(BuildMcpServerEvent::class)]
public function buildMcp(BuildMcpServerEvent $event): void
{
    $event->builder->addTool($handler, name: 'my_tool', description: 'My tool.');
}

Development

composer test
composer cs-check
composer cs-fix
composer prepare-hooks   # enable the pre-commit hook

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages