Agentic AI assistant for Alzheimer's disease research with literature retrieval and knowledge synthesis
This is an agentic AI assistant built with:
- NiceGUI for the web interface
- Claude Code CLI for agentic orchestration
- CBORG API (LBL proxy for accessing AI models)
- artl-mcp for scientific literature retrieval
- mcp-server-fetch for web content fetching
Required Software:
- Node.js 18+ (for Claude Code CLI)
- Python 3.10+ with
uvpackage manager - Claude Code CLI (installed globally via npm)
Required Data: You need access to the indexed PaperQA corpora:
- Paper corpus directory (e.g.,
~/curategpt/data/alz_papers_1k_text/) - PaperQA index directory (usually in
.pqa/indexes/after indexing)
-
Install Node.js and Claude Code CLI (if not already installed):
# Install Node.js (Ubuntu/Debian) curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - sudo apt-get install -y nodejs # Install Claude Code CLI sudo npm install -g @anthropic-ai/claude-code
-
Install Python dependencies:
uv sync
-
IMPORTANT: Configure environment variables:
All configuration uses
.envfile (NOTmcp_config.jsonfor secrets):cp .env.example .env # Edit .env with your settings - this file contains ALL secrets and pathsRequired variables in
.env:PORT: Port to run the application on (default: 8602 for agent.alzassistant.org)PQA_HOME: Absolute path to your paper corpus directoryPQA_INDEX: Absolute path to your PaperQA index directoryOPENAI_API_KEY: Your OpenAI API key (required for PaperQA)APP_PASSWORD_HASH: Bcrypt hash for login passwordSTORAGE_SECRET: Secret for encrypting session cookies (change in production)ANTHROPIC_AUTH_TOKEN: Your CBORG API key
How environment variables work:
- The
.envfile is loaded byapp.pyat startup usingpython-dotenv - All environment variables are inherited by child processes (including MCP servers and Claude CLI)
- The Claude Code CLI subprocess inherits
ANTHROPIC_AUTH_TOKENfrom the environment mcp_config.jsononly defines which MCP servers to run, NOT secrets- This ensures ONE source of truth for all configuration
How Claude authentication works:
- The app spawns Claude Code CLI as a subprocess
- Claude CLI reads
ANTHROPIC_AUTH_TOKENfrom environment variables - This token is used to authenticate with the CBORG API
- The
.envfile provides this token to the subprocess environment
To generate a new password hash:
python -c "import bcrypt; print(bcrypt.hashpw(b'yourpassword', bcrypt.gensalt()).decode())" -
IMPORTANT: Configure MCP servers (defines which servers to load, uses env vars from
.env):cp mcp_config.json.example mcp_config.json # Edit the --directory path in the paperqa server config to point to your installation # Example: "/Users/yourname/PythonProject/agent-alz-assistant" or "/home/ubuntu/agent-alz-assistant"
The application will NOT work without this file! The
query_paperstool requires the MCP server to be configured. -
Customize the agent (optional):
- Edit
CLAUDE.mdto modify the system prompt - Edit
mcp_config.jsonto add/remove MCP servers
- Edit
make startOr for other commands:
make help # Show all available commands
make stop # Stop the application
make restart # Restart the applicationuv run python app.pyThen open your browser to the configured port (default: http://localhost:8602)
Edit mcp_config.json:
{
"mcpServers": {
"my-tool": {
"command": "uvx",
"args": ["my-mcp-server"]
}
}
}Edit CLAUDE.md to change how the agent behaves.
make test # Run tests
make lint # Lint code
make format # Format code
make clean # Clean temporary filesRun tests:
uv run pytestLint code:
uv run ruff check .Format code:
uv run ruff format .The application is configured to run on port 8602 for deployment to agent.alzassistant.org (proxied through Cloudflare).
Deployment checklist:
- Ensure
.envfile is properly configured on the server with production values - Set
STORAGE_SECRETto a random string (not the example value) - Set
APP_PASSWORD_HASHto a strong password hash - Verify
PORT=8602in.env - Run
make startto start the application
BSD-3-Clause
Justin Reese [email protected]