Files
obsidian-wiki/.env.example
T
Codex e7adfbe9a6 fix(mcp): stage ingest uploads outside vault
Move remote MCP ingest uploads from the vault inbox to the MCP runtime staging area so uploaded files are not accepted into the vault before wiki-ingest processes them.

Reject ingest runtime roots that resolve inside the vault, and update the generated OpenCode prompt plus docs to describe uploads as temporary staging inputs.

Validation: python3 -m unittest discover -v; python3 -m py_compile obsidian_wiki/mcp_ingest.py tests/test_mcp_ingest.py; git diff --check
2026-07-05 15:04:16 +00:00

124 lines
4.7 KiB
Bash

# =============================================================================
# Obsidian Wiki — Environment Configuration
# Copy this to .env and set your vault path
# =============================================================================
# --- Required ---
# Absolute path to your Obsidian vault
OBSIDIAN_VAULT_PATH=
# --- Optional ---
# Comma-separated source directories to ingest documents from
# Leave empty to skip document ingestion
OBSIDIAN_SOURCES_DIR=
# Copy file-based sources into the vault before ingest so citations survive
# machine moves and Linux/Web deployment. Archived files are immutable and
# tracked in _meta/source-registry.jsonl.
WIKI_ARCHIVE_SOURCES=true
OBSIDIAN_SOURCE_ARCHIVE_DIR=_sources/archive
# Maintain content-based source catalog pages that link to archived originals
# without copying the same file into multiple folders.
WIKI_SOURCE_CATALOG=true
OBSIDIAN_SOURCE_CATALOG_DIR=_sources/catalog
# SQLite source-file locator. Leave empty to use _meta/file-assets.sqlite.
OBSIDIAN_FILE_ASSET_DB=
# --- Source File MCP Server (optional) ---
#
# Run with: obsidian-wiki-mcp
# Install extra: pip install "obsidian-wiki[mcp]"
# The MCP server serves only safe engineering source files by default.
OBSIDIAN_MCP_BOT_PROFILE=bjd-general-bot
OBSIDIAN_MCP_MAX_FILE_BYTES=26214400
OBSIDIAN_MCP_EXPOSE_PATHS=false
# Optional remote Streamable HTTP MCP mode.
# Run locally:
# OBSIDIAN_MCP_TOKEN='<long-random-token>' obsidian-wiki-mcp --transport streamable-http
# Or manage a user-level service:
# bash scripts/mcp_service.sh start
# Rotate token later with:
# bash scripts/mcp_service.sh new-token
OBSIDIAN_MCP_TOKEN=
OBSIDIAN_MCP_HOST=127.0.0.1
OBSIDIAN_MCP_PORT=8765
OBSIDIAN_MCP_PATH=/mcp
# Optional write-capable MCP ingest tools. Default is disabled.
# When enabled, remote MCP clients sharing this token can upload files and
# trigger a local `opencode run --auto` wiki-ingest job for those uploads.
# Keep this runtime root outside OBSIDIAN_VAULT_PATH; uploads are staging inputs,
# and wiki-ingest decides how sources are archived into the vault.
OBSIDIAN_MCP_ENABLE_INGEST=0
OBSIDIAN_MCP_INGEST_MAX_FILE_BYTES=104857600
OBSIDIAN_MCP_INGEST_MAX_CHUNK_BYTES=4194304
OBSIDIAN_MCP_INGEST_MAX_FILES_PER_JOB=10
OBSIDIAN_MCP_INGEST_OPENCODE_PATH=opencode
OBSIDIAN_MCP_INGEST_RUNTIME_ROOT=.runtime/mcp-ingest
# Wiki categories (directories created in the vault)
OBSIDIAN_CATEGORIES=concepts,entities,skills,references,synthesis,journal
# Max pages to create/update per ingest operation
OBSIDIAN_MAX_PAGES_PER_INGEST=15
# Claude conversation history path (auto-discovered from ~/.claude if empty)
CLAUDE_HISTORY_PATH=
# Codex history path (defaults to ~/.codex if empty)
CODEX_HISTORY_PATH=
# Pi agent session history path (defaults to ~/.pi/agent/sessions if empty)
PI_HISTORY_PATH=
# Lint schedule: daily | weekly | manual
LINT_SCHEDULE=weekly
# Internal link format for generated/updated pages
# wikilink (default) → [[concepts/foo]] or [[concepts/foo|display text]]
# markdown → [display text](relative/path.md)
# Only affects future writes — existing vault content is never migrated automatically.
OBSIDIAN_LINK_FORMAT=wikilink
# --- QMD Semantic Search (optional) ---
#
# QMD indexes your wiki and sources for fast semantic search.
# Install: https://github.com/tobi/qmd
# After installing, point these at your QMD collection names (set when you ran `qmd index`).
#
# Without QMD: wiki-ingest and wiki-query fall back to Grep/Glob — fully functional, just slower.
# With QMD: semantic search replaces grep passes, enabling concept-level matches and cross-collection queries.
# Name of the QMD collection indexing your compiled wiki pages (OBSIDIAN_VAULT_PATH)
QMD_WIKI_COLLECTION=
# Name of the QMD collection indexing your raw source documents (OBSIDIAN_SOURCES_DIR or _raw/)
QMD_PAPERS_COLLECTION=
# QMD integration transport: mcp | cli
# mcp preserves the original behavior and uses an agent-configured QMD MCP server.
# cli runs the local qmd command directly; useful for agents without QMD MCP support.
QMD_TRANSPORT=mcp
# CLI search quality mode: quality | balanced | fast
# quality: qmd query with reranking (best relevance, slowest on CPU)
# balanced: qmd query --no-rerank (good hybrid results, faster)
# fast: qmd vsearch (semantic only) or qmd search when exact terms matter
QMD_CLI_SEARCH_MODE=quality
# Optional qmd binary override if qmd is not on PATH.
QMD_CLI=qmd
# --- Raw Staging Directory (optional) ---
#
# A directory inside OBSIDIAN_VAULT_PATH for unprocessed draft pages.
# Drop rough notes, clipboard pastes, or quick captures here.
# wiki-ingest will promote them to proper wiki pages when you run it.
# Promoted files are deleted from _raw/ after processing.
OBSIDIAN_RAW_DIR=_raw