Soustack MCP服务器
此存储库托管Soustack MCP服务器,这是一个小型模型上下文协议(MCP)服务,通过stdio公开Soustack功能。
构建
npm install
npm run build运行(开发)
npm run dev运行(生产)
node dist/cli.jsStdin/ststdout请求格式
服务器通过stdio进行通信,每行使用JSON消息,协议如下:
请求:
{ "id": "...", "tool": "tool.name", "input": { } }响应(成功):
{ "id": "...", "ok": true, "output": { } }响应(错误):
{ "id": "...", "ok": false, "error": { } }调用示例
Ping请求:
{ "id": "ping-1", "tool": "ping", "input": { } }Ping响应:
{ "id": "ping-1", "ok": true, "output": { "pong": true } }Soustack元请求:
{ "id": "meta-1", "tool": "soustack.meta", "input": { } }Soustack元响应:
{ "id": "meta-1", "ok": true, "output": { "mcpVersion": "0.1.0", "soustackVersion": null, "specVersion": null, "supportedProfiles": ["lite", "base", "timed", "scalable", "illustrated", "equipped", "prepped", "minimal", "core"], "timestamp": "2024-01-01T00:00:00.000Z" } }Soustack验证请求(无效配方):
{ "id": "validate-1", "tool": "soustack.validate", "input": { "recipe": { "title": "", "ingredients": [] } } }Soustack验证响应(无效配方):
{ "id": "validate-1", "ok": true, "output": { "ok": false, "warnings": [], "schemaErrors": [{ "path": "/name", "message": "Required" }], "conformanceIssues": [] } }工具架构
所有响应均遵循stdio合同: { "id": string, "ok": boolean, ... }刀具故障表面为 ok:false 具有一致的误差包络: { "error": { "code": string, "message": string, "details"?: unknown } }常见错误代码包括 BAD_JSON, INVALID_REQUEST, UNKNOWN_TOOL, MODULE_UNAVAILABLE, INVALID_MODE, INVALID_MULTIPLIER, CONVERSION_FAILED,以及 SCALE_FAILED.
soustack.meta
输入: {}\ 输出:
{
"mcpVersion": "0.1.0",
"soustackVersion": "0.4.0",
"specVersion": "0.3.0",
"canonicalSchema": "https://spec.soustack.org/soustack.schema.json",
"supportedProfiles": ["lite","base","timed","scalable","illustrated","equipped","prepped","minimal","core"],
"timestamp": "2024-01-01T00:00:00.000Z"
}soustack.validate
输入: { "recipe": unknown, "options"?: { "profile"?: string, "mode"?: "schema" | "full", "includeNormalized"?: boolean } }\ 输出:
{
"ok": true,
"warnings": [],
"schemaErrors": [],
"conformanceIssues": [],
"normalizedRecipe": { }
}soustack.detectProfiles
输入: { "recipe": unknown }\ 输出: { "profiles": string[] }
soustack.scale
输入: { "recipe": unknown, "options": { "multiplier": number } }\ 输出:
{
"recipe": { },
"equipment": [ ]
}soustack.convert
输入: { "from": "schemaorg" | "soustack", "to": "schemaorg" | "soustack", "payload": unknown }\ 输出: { "payload": { } }
