-
Notifications
You must be signed in to change notification settings - Fork 0
Tooling MCP
MCP Server
适用版本:4.0.0。
Applies to 4.0.0.
AuroraScript.Mcp 是面向支持 Model Context Protocol 的 AI 客户端的 stdio 服务器。它提供语言资料、schema、示例、脚本检查、运行和诊断解释;通信通道为 stdin/stdout JSON-RPC,不能向 stdout 写入额外日志。
AuroraScript.Mcpis a stdio server for AI clients that support Model Context Protocol. It provides language material, schemas, examples, script checking, execution, and diagnostic explanation; it uses stdin/stdout JSON-RPC, so no extra logs may be written to stdout.
安装全局 .NET 工具:
Install the global .NET tool:
dotnet tool install --global AuroraScript.Mcp --version 4.0.0在 Codex 中添加 MCP 服务:
Add the MCP server in Codex:
codex mcp add aurora-script -- aurora-mcp也可以在 Codex 配置中写入以下内容。Windows 配置通常位于 %USERPROFILE%\.codex\config.toml;macOS/Linux 通常位于 ~/.codex/config.toml。
You can also write the following in Codex configuration. The usual Windows path is
%USERPROFILE%\.codex\config.toml; the usual macOS/Linux path is~/.codex/config.toml.
[mcp_servers.aurora-script]
type = "stdio"
command = "aurora-mcp"
startup_timeout_sec = 10
tool_timeout_sec = 60
enabled = true本地发布的可执行文件应使用绝对路径,并为其设置明确的 cwd。
A locally published executable should use an absolute path and an explicit
cwd.
[mcp_servers.aurora-script]
type = "stdio"
command = "D:\\mcp\\AuroraScript.Mcp.exe"
cwd = "D:\\mcp"
enabled = true- 先读取
aurora://docs/script-best-practices和aurora://schema/runtime-api。 - 使用
aurora_search_runtime_api或aurora_get_runtime_api,不要猜测 API 名称。 - 生成后使用
aurora_check_script或aurora_check_file检查。 - 需要结果、stdout 或 stderr 时再使用运行工具。
- 用
aurora_validate_best_practices查找 AI 生成脚本的常见坏模式。
- Read
aurora://docs/script-best-practicesandaurora://schema/runtime-apifirst.- Use
aurora_search_runtime_apioraurora_get_runtime_apiinstead of guessing API names.- Check generated code with
aurora_check_scriptoraurora_check_file.- Use a run tool only when a result, stdout, or stderr is needed.
- Use
aurora_validate_best_practicesto find common poor patterns in AI-authored scripts.
服务内置以下稳定 URI:
The server embeds the following stable URIs:
aurora://docs/aiaurora://docs/script-best-practicesaurora://docs/languageaurora://docs/performanceaurora://docs/host-integrationaurora://schema/ebnfaurora://schema/featuresaurora://schema/runtime-apiaurora://schema/host-apiaurora://examples/manifest
资源列表可通过 MCP 的 resources/list 发现,内容可通过 resources/read 读取。
Discover resources through MCP
resources/listand read their contents throughresources/read.
每个工具的参数名保持英文;参数说明先给出中文,再以下方引用给出英文。
Parameter names remain in English. Parameter descriptions appear in Chinese followed by quoted English.
按 id 或资源相对路径读取语言资料。
Reads language material by id or resource-relative path.
Parameters:
-
id
必填。文档 id 或资源相对路径;可先用aurora_list_documents发现。Required. A document id or resource-relative path; discover it with
aurora_list_documentsfirst.
Returns
文档文本和 MIME 类型。
Document text and MIME type.
{ "name": "aurora_get_document", "arguments": { "id": "script-best-practices" } }列出内嵌文档、schema 和示例。
Lists embedded documents, schemas, and examples.
Parameters:
-
prefix
可选。按相对路径前缀过滤,例如docs/、schema/或examples/。Optional. Filters by a relative-path prefix such as
docs/,schema/, orexamples/.
Returns
包含 id、URI、路径、名称、描述和 MIME 类型的列表。
A list containing id, URI, path, name, description, and MIME type.
{ "name": "aurora_list_documents", "arguments": { "prefix": "schema/" } }返回结构化语言特性元数据。
Returns structured language-feature metadata.
Parameters:
- 无。
None.
Returns
features schema 的 JSON 文本。
JSON text for the
featuresschema.
{ "name": "aurora_list_features", "arguments": {} }将内存源码作为完整模块或 CompileBlock 函数体编译检查,不执行。
Compile-checks in-memory source as a full module or a
CompileBlockbody without executing it.
Parameters:
-
source
必填。待检查的 AuroraScript 源码。Required. AuroraScript source to check.
-
mode
可选。module或block;缺省按模块处理。Optional.
moduleorblock; module mode is the default. -
sourceName
可选。诊断中显示的虚拟文件名。Optional. Virtual filename shown in diagnostics.
-
parameters
可选。block模式的位置参数名。Optional. Positional parameter names for
blockmode. -
sources
可选。按路径键控的内存依赖源码,用于import/include。Optional. In-memory dependency sources keyed by path for
import/include.
Returns
编译是否成功和诊断集合。
Compilation success and a diagnostic collection.
{
"name": "aurora_check_script",
"arguments": {
"source": "@module(TEST); export func run() { return 42; }",
"sourceName": "main.as"
}
}编译并运行内存源码,适合验证单个模块、模块依赖或 CompileBlock。
Compiles and runs in-memory source, suitable for a single module, module dependencies, or a
CompileBlock.
Parameters:
-
source
必填。待编译源码。Required. Source to compile.
-
mode
可选。module或block。Optional.
moduleorblock. -
sourceName
可选。虚拟文件名。Optional. Virtual filename.
-
moduleName
模块模式可选。要执行的模块名,默认TEST。Optional in module mode. Module name to execute; defaults to
TEST. -
methodName
模块模式可选。要调用的导出函数名,默认run。Optional in module mode. Exported function to invoke; defaults to
run. -
parameters
块模式可选。CompileBlock参数名。Optional in block mode.
CompileBlockparameter names. -
arguments
可选。转换为 AuroraScript 实参的 JSON 值数组。Optional. Array of JSON values converted to AuroraScript arguments.
-
sources
可选。按路径键控的内存依赖源码。Optional. In-memory dependency sources keyed by path.
Returns
结果、stdout、stderr、诊断和运行时错误。
Result, stdout, stderr, diagnostics, and runtime errors.
{
"name": "aurora_run_script",
"arguments": {
"mode": "block",
"source": "return left + right;",
"parameters": ["left", "right"],
"arguments": [20, 22]
}
}检查文件系统入口脚本及其依赖图,不执行。
Checks a file-system entry script and its dependency graph without executing it.
Parameters:
-
rootDirectory
必填。文件系统 Resolver 根目录。Required. File-system Resolver root.
-
entryPath
必填。相对rootDirectory的入口.as路径,或位于根目录下的绝对路径。Required. Entry
.aspath relative torootDirectory, or an absolute path under the root. -
extName
可选。脚本扩展名,默认.as。Optional. Script extension; defaults to
.as. -
sources
可选。以根目录相对路径为键的内存覆盖源;使用/,且仅在解析目标位于根下时覆盖磁盘。Optional. In-memory overlays keyed by root-relative path; use
/, and overlays win only when the resolved target lies under the root.
Returns
编译结果和诊断集合。
Compilation result and diagnostics.
{ "name": "aurora_check_file", "arguments": { "rootDirectory": "scripts", "entryPath": "main.as" } }编译并运行文件系统入口脚本及其依赖图。
Compiles and runs a file-system entry script and its dependency graph.
Parameters:
-
rootDirectory
必填。文件系统 Resolver 根目录。Required. File-system Resolver root.
-
entryPath
必填。入口脚本路径。Required. Entry script path.
-
moduleName
必填。要执行的导出模块名。Required. Exported module name to execute.
-
methodName
可选。导出函数名,默认run。Optional. Exported function name; defaults to
run. -
arguments
可选。JSON 实参数组。Optional. JSON argument array.
-
extName
可选。脚本扩展名,默认.as。Optional. Script extension; defaults to
.as. -
sources
可选。内存覆盖源。Optional. In-memory overlay sources.
Returns
结果、输出、诊断和运行时错误。
Result, output, diagnostics, and runtime errors.
{
"name": "aurora_run_file",
"arguments": { "rootDirectory": "examples/tests", "entryPath": "main.as", "moduleName": "MAIN", "methodName": "run" }
}编译文件系统根目录下 Resolver 可见的全部脚本。
Compiles every Resolver-visible script below a file-system root.
Parameters:
-
rootDirectory
必填。文件系统 Resolver 根目录。Required. File-system Resolver root.
-
extName
可选。脚本扩展名,默认.as。Optional. Script extension; defaults to
.as. -
sources
可选。内存覆盖源。Optional. In-memory overlay sources.
Returns
工作区编译结果和诊断。
Workspace compilation result and diagnostics.
{ "name": "aurora_build_workspace", "arguments": { "rootDirectory": "scripts" } }搜索结构化脚本运行时 API 索引。
Searches the structured script runtime API index.
Parameters:
-
query
必填。名称或文本,例如String.trim、HashMap或appendLine。Required. Name or text such as
String.trim,HashMap, orappendLine. -
limit
可选。最大结果数,默认20。Optional. Maximum result count; defaults to
20.
Returns
匹配的运行时 API 条目。
Matching runtime API entries.
{ "name": "aurora_search_runtime_api", "arguments": { "query": "StringBuffer", "limit": 10 } }按 API 路径读取一个结构化运行时条目。
Reads one structured runtime entry by API path.
Parameters:
-
path
必填。运行时 API 路径,例如Math、Array.push、String.trim或HashMap.get。Required. Runtime API path such as
Math,Array.push,String.trim, orHashMap.get.
Returns
API 条目及其签名、参数与说明。
The API entry with its signatures, parameters, and documentation.
{ "name": "aurora_get_runtime_api", "arguments": { "path": "Array.push" } }列出语言包 manifest 中的有效、无效或全部示例。
Lists valid, invalid, or all examples from the language-pack manifest.
Parameters:
-
kind
可选。valid、invalid或all。Optional.
valid,invalid, orall.
Returns
示例清单。
Example manifest entries.
{ "name": "aurora_list_examples", "arguments": { "kind": "valid" } }按 manifest 路径读取一个嵌入示例。
Reads an embedded example by manifest path.
Parameters:
-
path
必填。示例路径,例如valid/templates.as或invalid/const-assignment.as。Required. Example path such as
valid/templates.asorinvalid/const-assignment.as.
Returns
示例源文本和 MIME 类型。
Example source text and MIME type.
{ "name": "aurora_get_example", "arguments": { "path": "valid/templates.as" } }检查 AI 生成脚本中的已知写法问题。
Checks AI-authored source for known authoring-pattern issues.
Parameters:
-
source
必填。要检查的源码。Required. Source to check.
-
mode
可选。module或block。Optional.
moduleorblock.
Returns
最佳实践警告集合。
A collection of best-practice warnings.
{
"name": "aurora_validate_best_practices",
"arguments": { "mode": "block", "source": "for (var i = 0; i < items.length; i++) { total += items[i]; } return total;" }
}解释常见 AuroraScript 编译诊断及其可能修复方式。
Explains common AuroraScript compiler diagnostics and likely fixes.
Parameters:
-
message
必填。编译器诊断消息。Required. Compiler diagnostic message.
Returns
诊断含义与建议修复。
Diagnostic meaning and suggested fixes.
{ "name": "aurora_explain_diagnostic", "arguments": { "message": "Cannot assign to const value." } }aurora_check_file、aurora_run_file 和 aurora_build_workspace 会把可选内存 sources 放在磁盘 Resolver 之前。键会用 / 规范化并相对 rootDirectory 解析;较早的 Resolver 优先,但只有解析后的目标仍在内存 root 下时,内存覆盖才会命中。不同协议或不相交 root 不会相互覆盖。
aurora_check_file,aurora_run_file, andaurora_build_workspaceplace optional in-memorysourcesahead of the disk Resolver. Keys are normalized with/and resolved relative torootDirectory; earlier resolvers win, but an overlay only hits when the resolved target remains under the memory root. Different protocols or non-overlapping roots cannot override one another.
AuroraScript.JIT 4.0.0 · Documentation Home · Repository · MIT License