ollama-mcp-langgraph-lab
Docker Compose lab‑stack: Ollama + MCP (FastMCP) + LangChain/LangGraph агент. Всё настраивается через .env.
Overview Four services in one Compose:
- Ollama LLM server (pulls and runs models).
- FastMCP server exposes tools over HTTP at
/mcp. - L0 FastMCP server exposes deterministic SPIR tools at
/mcp. - LangChain/LangGraph agent CLI that uses ChatOllama + MCP tools.
Requirements
- Docker + Docker Compose.
- For GPU mode: NVIDIA driver +
nvidia-container-toolkit(Linux/WSL2). macOS has no GPU passthrough.
Quickstart
cp .env.example .env
mkdir -p workspace
# default is GPU now; use "cpu" explicitly if needed
./lab.sh up
./lab.sh pull qwen3:8b
./lab.sh ask "Сделай файл report.txt с текущим временем UTC и перечисли файлы в workspace"Common Commands
./lab.sh up [gpu|cpu]
./lab.sh down [gpu|cpu]
./lab.sh pull
./lab.sh list
./lab.sh ask "your prompt"
./lab.sh logsBDD + Allure
behave -f allure_behave.formatter:AllureFormatter -o allure-results
allure serve allure-resultsDefault testcontainers compose file: tests/compose/docker-compose.test.yml (L0 + hydra_mock).
Important Notes
- Default profile is
gpu(seelab.sh). Use./lab.sh up cpuif you do not have GPU support. - Ollama is exposed on
http://localhost:11434. - MCP server is exposed on
http://localhost:8000/mcp. - L0 MCP server is exposed on
http://localhost:8001/mcp. - Model, context size, and reasoning mode are controlled in
.env. - Flow mode runs the explicit graph: `python /app/flow.py "
"`.
L0 Syntax + Semantics Layer (SPIR v0.5.0) L0 now produces a structured syntax+semantics package:
syntax.paninian_edges: list of{head, dep, role}(karaka graph).syntax.ud.basic_edges: basic UD tree (rellabels, exactly one root).syntax.ud.enhanced_edges+syntax.ud.empty_nodes: UD-compatible enhanced layer (i.jempty nodes + DEPS).syntax.clauses+syntax.discourse_links: clause/discourse layer.semantics.kag: Event+Deontic KAG with provenance.- Clause spans use half-open policy:
token_span = [start, end).
Backend selection:
SYNTAX_BACKEND=rules(default) uses internal rule-based attachment.SYNTAX_BACKEND=hydra/hyderabaduses the external Hyderabad/Samsaadhanii parser.SYNTAX_BACKEND=nonedisables syntax.
UD mode:
ud_mode=head_rules(default) uses runtimehead_rules.yaml.ud_mode=projecteduses direct Paninian->UD projection (debug/compat inside v0.5 only).ud_mode=nonedisables UD.
Hyderabad parser wiring:
HYD_PARSER_URLto call a running HTTP/CGI service.HYD_PARSER_CMDto execute a local CLI command (use{text}placeholder or stdin).KARAKA_UD_MAP_PATHto override karaka->UD mapping JSON.UD_HEAD_RULES_PATHto override active UD head rules YAML.SYNTAX_OVERRIDES_PATHto apply deterministic per-input graph patches.RETRIEVAL_BACKEND=baseline|hybrid_prodto choose retrieval tier.
New L0 MCP tools:
l0_analyze(SPIR v0.5 output).l0_query_understand(NL|SPIR -> KAG query + retrieval plan).l0_retrieve(baseline|hybrid_prodtiered retrieval with fallback metadata).l0_export(sidecars: CoNLL-U basic/enhanced, KAG JSONL, align JSON).
CLI example:
SYNTAX_BACKEND=rules python -m sprs_l0.cli analyze --in src/l0/data/prepared/corpus.jsonl --out workspace/spir_samples_v05.jsonl
python -m sprs_l0.cli validate --in workspace/spir_samples_v05.jsonl
python -m sprs_l0.cli export --in workspace/spir_samples_v05.jsonl --out-dir workspace/exports