We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Liam-Deacon/zettelkasten-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
"""Configuration module for the Zettelkasten MCP server."""
import os
from pathlib import Path
from typing import Optional, Literal
from dotenv import load_dotenv
from pydantic import BaseModel, Field
# Load environment variables
load_dotenv()
class ZettelkastenConfig(BaseModel):
"""Configuration for the Zettelkasten server."""
# Base directory for the project
base_dir: Path = Field(
default_factory=lambda: Path(os.getenv("ZETTELKASTEN_BASE_DIR") or ".")
)
# Storage configuration
notes_dir: Path = Field(
default_factory=lambda: Path(
os.getenv("ZETTELKASTEN_NOTES_DIR") or "data/notes"
)
)
# Database configuration
database_path: Path = Field(
default_factory=lambda: Path(
os.getenv("ZETTELKASTEN_DATABASE_PATH") or "data/db/zettelkasten.db"
)
)
# Server configuration
server_name: str = Field(
default=os.getenv("ZETTELKASTEN_SERVER_NAME", "zettelkasten-mcp")
)
server_version: str = Field(default="1.2.1")
# Date format for ID generation (using ISO format for timestamps)
id_date_format: str = Field(default="%Y%m%dT%H%M%S")
# Default note template
default_note_template: str = Field(
default=(
"# {title}\n\n"
"## Metadata\n"
"- Created: {created_at}\n"
"- Tags: {tags}\n\n"
"## Content\n\n"
"{content}\n\n"
"## Links\n"
"{links}\n"
)
)
def get_absolute_path(self, path: Path) -> Path:
"""Convert a relative path to an absolute path based on base_dir."""
if path.is_absolute():
return path
return self.base_dir / path
def get_db_url(self) -> str:
"""Get the database URL for SQLite."""
db_path = self.get_absolute_path(self.database_path)
db_path.parent.mkdir(parents=True, exist_ok=True)
return f"sqlite:///{db_path}"
# Create a global config instance
config = ZettelkastenConfig()