Soustack MCP摄入
用法
启动服务器:
soustack-mcp-ingest协议
服务器从stdin读取换行的JSON请求,并将换行的JSON响应写入stdout。每个请求必须包括:
id:唯一请求标识符。tool:工具名称。input:工具输入有效载荷的JSON对象。
请求形状:
{"id":"request-1","tool":"","input":{}}成功响应形状:
{"id":"request-1","ok":true,"output":{}}错误响应形状:
{"id":"request-1","ok":false,"error":{"code":"tool_not_found","message":"Tool \"unknown\" is not available."}}工具
ping
服务器的运行状况检查。
{"id":"ping-1","tool":"ping","input":{}}ingest.meta
返回版本和支持的输入类型。
{"id":"meta-1","tool":"ingest.meta","input":{}}ingest.segment
使用 soustack-ingest 模块。
{"id":"segment-1","tool":"ingest.segment","input":{"text":"# Title\n\nFirst paragraph.\n\nSecond paragraph.","options":{"maxChunks":2}}}ingest.extract
从块中提取中间配方。
{"id":"extract-1","tool":"ingest.extract","input":{"text":"# Title\n\nIngredients:\n- eggs\n- butter\n\nSteps:\n1. Mix.\n2. Cook.","chunk":{"startLine":1,"endLine":8,"titleGuess":"Title"}}}ingest.toSoustack
将中间配方转换为Soustack配方。
{"id":"to-soustack-1","tool":"ingest.toSoustack","input":{"intermediate":{"title":"Scrambled Eggs","ingredients":["2 eggs","1 tbsp butter"],"instructions":["Whisk eggs.","Cook in butter."],"source":{"startLine":1,"endLine":4,"evidence":"Scrambled Eggs"}},"options":{"sourcePath":"/recipes/breakfast.md"}}}ingest.validate
验证Soustack配方有效载荷。
{"id":"validate-1","tool":"ingest.validate","input":{"recipe":{"name":"Sample","ingredients":[],"instructions":[]}}}ingest.document
在文件或目录上运行端到端摄取管道。
{"id":"document-1","tool":"ingest.document","input":{"inputPath":"/data/notes","outDir":"/data/out","options":{"emitFiles":true,"returnRecipes":true,"maxRecipes":50,"strictValidation":true}}}工作流示例(分阶段+端到端)
下面是一个完整的工作流程,显示了各个阶段之间的关系。 ingest.extract, ingest.toSoustack,以及 ingest.validate 是从 soustack-ingest 模块;它们在内部执行 ingest.document 工具,也作为单独的MCP工具公开。
ingest.segment--将文本分割成块以供下游处理。
{"id":"workflow-segment-1","tool":"ingest.segment","input":{"text":"# Intro\n\nHello world.\n\n## Details\nMore text here."}}ingest.extract--从每个块中提取结构化数据。
{"id":"workflow-extract-1","tool":"ingest.extract","input":{"text":"# Intro\n\nHello world.\n\n## Details\nMore text here.","chunk":{"startLine":1,"endLine":4,"titleGuess":"Intro"}}}ingest.toSoustack--将提取的数据转换为Soustack食谱。
{"id":"workflow-to-soustack-1","tool":"ingest.toSoustack","input":{"intermediate":{"title":"Intro","ingredients":["Hello world"],"instructions":["More text here."],"source":{"startLine":1,"endLine":4,"evidence":"# Intro"}},"options":{"sourcePath":"/docs/example.md"}}}ingest.validate--根据Soustack规则验证食谱。
{"id":"workflow-validate-1","tool":"ingest.validate","input":{"recipe":{"name":"Intro","ingredients":["Hello world"],"instructions":["More text here."]}}}ingest.document--在磁盘输入端对端运行所有阶段。
{"id":"workflow-document-1","tool":"ingest.document","input":{"inputPath":"/data/notes","options":{"emitFiles":false,"returnRecipes":true}}}