5.3 KiB
MiroFish MCP Server
The MCP server exposes MiroFish lifecycle tools, not a Graphiti proxy.
Start:
cd /Users/leaf/Documents/future/MiroFish/backend
uv run mirofish-mcp
Tools:
mirofish_create_runmirofish_runmirofish_resume_runmirofish_get_statusmirofish_get_current_stagemirofish_update_simulation_settingsmirofish_approve_stagemirofish_reject_stagemirofish_rerun_stagemirofish_list_requestsmirofish_get_requestmirofish_submit_responsemirofish_validate_responsemirofish_build_graphmirofish_search_graphmirofish_export_graphmirofish_start_simulationmirofish_resume_simulationmirofish_generate_reportmirofish_get_reportmirofish_ask_followup_questionmirofish_get_followup_answermirofish_list_artifactsmirofish_doctor
Interaction Tools
After a run completes, these tools let you interact with agents through the queue:
mirofish_generate_web_console— generates an interactive HTML console atruns/<run_id>/artifacts/web/index.html.mirofish_list_agents— lists all agent profiles from a completed run.mirofish_get_agent— returns a single agent's profile.mirofish_ask_agent— sends a question to a specific agent viaagent_queue. Returnsneed_agent_responsewith arequest_id.mirofish_get_agent_answer— after the desktop agent writes the response file, call this to validate, persist, and retrieve the answer.mirofish_send_questionnaire— sends a batch questionnaire to all agents.questions_jsonis a JSON string:'[{"question_id":"q1","question":"Biggest risk?"}, ...]'.mirofish_get_questionnaire_result— retrieves questionnaire answers and summary.mirofish_ask_report_question— asks a question about the report viaagent_queue.mirofish_get_report_question_answer— retrieves and persists a report question answer.
Web Console
The Web Console is a static HTML page with embedded run data plus live API interaction when the Flask backend is running.
-
Generate the console:
uv run mirofish-agent web generate --run ../runs/chip-2036 --jsonOr via MCP: call
mirofish_generate_web_console. -
Open the generated file:
runs/<run_id>/artifacts/web/index.html -
Start the Flask backend for interactive features:
cd /Users/leaf/Documents/future/MiroFish/backend uv run flask --app app run --port 5001 -
The console auto-detects the API at
http://localhost:5001. You can change the base URL in the sidebar.
When the API is offline, the console falls back to displaying embedded static data from the run artifacts.
Agent Q&A Flow
- Call
mirofish_ask_agent(run, agent_id, question)— returnsrequest_id. - A desktop agent reads
runs/<run_id>/requests/<request_id>.jsonand writesruns/<run_id>/responses/<request_id>.json. - Call
mirofish_get_agent_answer(run, request_id)to validate the response and persist it toartifacts/interactions/agent_questions/.
Questionnaire Flow
- Call
mirofish_send_questionnaire(run, questions_json)with a JSON array of{question_id, question}objects. - Each agent gets a separate
agent_queuerequest per question. - Call
mirofish_get_questionnaire_result(run, questionnaire_id)to collect answers and summary.
Staged Mode
Use staged mode when a desktop agent should mirror the original MiroFish step-by-step UI flow. The simulation round count is a hard MCP field, not text hidden in the requirement.
Typical Qoder/Codex/Claude Code sequence:
- Call
mirofish_doctor. - Call
mirofish_create_runwithmode="staged",rounds=10,round_unit="year", and the seed/requirement/output path. - Call
mirofish_get_current_stageand show the user the stage summary. - After user confirmation, call
mirofish_approve_stage. - Call
mirofish_resume_run; staged mode advances only to the next pause point orneed_agent_response. - When
need_agent_responseappears, readrequest_file, write the response JSON, callmirofish_validate_response, thenmirofish_submit_response. - Repeat resume/approve until
report.md,verdict.json,timeline.json, andgraph_snapshot.jsonexist. - Use
mirofish_ask_followup_questionfor post-report questions.
Example mirofish_create_run arguments:
{
"seed": "/Users/leaf/Documents/future/MiroFish/seeds/chip.md",
"requirement": "预测未来10年全球芯片能力格局变化",
"output": "/Users/leaf/Documents/future/MiroFish/runs/chip-2036",
"mode": "staged",
"rounds": 10,
"round_unit": "year",
"minutes_per_round": 525600,
"pause_each_round": false,
"agent_count": 5,
"simulation_name": "chip-2036"
}
If the user changes hard parameters before approval, call mirofish_update_simulation_settings. The engine marks dependent stages stale/pending so old profile/config/simulation/report outputs are not silently reused.
Example MCP server config:
{
"mcpServers": {
"mirofish": {
"command": "uv",
"args": ["run", "mirofish-mcp"],
"cwd": "/Users/leaf/Documents/future/MiroFish/backend",
"env": {
"MIROFISH_MODE": "agent",
"MIROFISH_LLM_PROVIDER": "agent_queue",
"MIROFISH_GRAPH_PROVIDER": "graphiti",
"MIROFISH_RUNS_DIR": "./runs"
}
}
}
}
Reference: https://modelcontextprotocol.github.io/python-sdk/server/