We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Gassandrid/obsidian-emergent-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
#!/usr/bin/env bash
set -euo pipefail
REPO_URL="https://raw.githubusercontent.com/Gassandrid/obsidian-emergent-mcp/main"
REQUIRED_PYTHON_VERSION="3.10"
die() {
echo "error: $*" >&2
exit 1
}
info() { echo ":: $*"; }
VAULT_PATH="${1:-.}"
# Resolve to absolute path
VAULT_PATH="$(cd "$VAULT_PATH" && pwd)" || die "Directory not found: $VAULT_PATH"
# Validate vault
[ -d "$VAULT_PATH" ] || die "Directory not found: $VAULT_PATH"
[ -d "$VAULT_PATH/.obsidian" ] || die "Not an Obsidian vault (no .obsidian folder): $VAULT_PATH"
info "Installing into vault: $VAULT_PATH"
find_python() {
for cmd in python3 python; do
if command -v "$cmd" &>/dev/null; then
local version
version=$("$cmd" -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')" 2>/dev/null)
if [ -n "$version" ]; then
local major minor
major=$(echo "$version" | cut -d. -f1)
minor=$(echo "$version" | cut -d. -f2)
if [ "$major" -ge 3 ] && [ "$minor" -ge 10 ]; then
echo "$(command -v "$cmd")"
return 0
fi
fi
fi
done
return 1
}
PYTHON=$(find_python) || die "Python >= $REQUIRED_PYTHON_VERSION not found. Install it and retry."
PYTHON_VERSION=$("$PYTHON" -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}')")
info "Using Python: $PYTHON ($PYTHON_VERSION)"
CLAUDE_DIR="$VAULT_PATH/.claude"
mkdir -p "$CLAUDE_DIR"
info "Created $CLAUDE_DIR"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
copy_file() {
local filename="$1"
local dest="$CLAUDE_DIR/$filename"
# If running from the repo directory, copy locally
if [ -f "$SCRIPT_DIR/$filename" ]; then
cp "$SCRIPT_DIR/$filename" "$dest"
info "Copied $filename"
else
# Download from GitHub
curl -fsSL "$REPO_URL/$filename" -o "$dest" || die "Failed to download $filename"
info "Downloaded $filename"
fi
}
copy_file "obsidian_tools.py"
copy_file "vault_mcp_server.py"
info "Installing Python dependencies..."
if [ -f "$SCRIPT_DIR/requirements.txt" ]; then
"$PYTHON" -m pip install -q -r "$SCRIPT_DIR/requirements.txt"
else
"$PYTHON" -m pip install -q "mcp>=1.0.0" numpy pyyaml scikit-learn
fi
"$PYTHON" -c "from mcp.server import Server; from sklearn.feature_extraction.text import TfidfVectorizer; import yaml; import numpy" ||
die "Dependency verification failed"
info "Dependencies installed"
MCP_JSON="$VAULT_PATH/.mcp.json"
SERVER_PATH="$CLAUDE_DIR/vault_mcp_server.py"
if [ -f "$MCP_JSON" ]; then
# Check if obsidian-vault is already registered
if "$PYTHON" -c "import json; d=json.load(open('$MCP_JSON')); exit(0 if 'obsidian-vault' in d.get('mcpServers',{}) else 1)" 2>/dev/null; then
info "MCP server already registered in .mcp.json — updating path"
fi
fi
"$PYTHON" -c "
import json
from pathlib import Path
mcp_path = Path('$MCP_JSON')
config = {}
if mcp_path.exists():
try:
config = json.loads(mcp_path.read_text())
except Exception:
pass
config.setdefault('mcpServers', {})
config['mcpServers']['obsidian-vault'] = {
'command': '$PYTHON',
'args': ['$SERVER_PATH']
}
mcp_path.write_text(json.dumps(config, indent=2) + '\n')
"
info "Registered MCP server in .mcp.json"
JOURNAL="$CLAUDE_DIR/journal.jsonl"
if [ ! -f "$JOURNAL" ]; then
touch "$JOURNAL"
info "Initialized journal at $JOURNAL"
fi
info ""
info " install done "
info ""
info " Vault: $VAULT_PATH"
info " Server: $SERVER_PATH"
info " Config: $MCP_JSON"
info " Journal: $JOURNAL"
info ""