Skip to content

Commit bd5114e

Browse files
authored
Merge pull request #109 from sandialabs:copilot/split-up-docs-files
Split monolithic documentation files into topic-based structure
2 parents a4a5f0f + 71c0b2c commit bd5114e

27 files changed

+1338
-4
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ A modern LLM chat interface with MCP (Model Context Protocol) integration.
2727

2828
We have created a set of comprehensive guides to help you get the most out of Atlas UI 3.
2929

30-
* **[Getting Started](./docs/01_getting_started.md)**: The perfect starting point for all users. This guide covers how to get the application running with Docker or on your local machine.
30+
* **[Getting Started](./docs/getting-started/installation.md)**: The perfect starting point for all users. This guide covers how to get the application running with Docker or on your local machine.
3131

32-
* **[Administrator's Guide](./docs/02_admin_guide.md)**: For those who will deploy and manage the application. This guide details configuration, security settings, access control, and other operational topics.
32+
* **[Administrator's Guide](./docs/admin/README.md)**: For those who will deploy and manage the application. This guide details configuration, security settings, access control, and other operational topics.
3333

34-
* **[Developer's Guide](./docs/03_developer_guide.md)**: For developers who want to contribute to the project. It provides an overview of the architecture and instructions for creating new MCP servers.
34+
* **[Developer's Guide](./docs/developer/README.md)**: For developers who want to contribute to the project. It provides an overview of the architecture and instructions for creating new MCP servers.
3535

3636
## For AI Agent Contributors
3737

backend/mcp/progress_updates_demo/QUICKSTART.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,4 +270,4 @@ See `/backend/mcp/progress_updates_demo/main.py` for complete working examples.
270270

271271
## Documentation
272272

273-
Full documentation: [Developer Guide - Progress Updates](../docs/03_developer_guide.md#progress-updates-and-intermediate-results)
273+
Full documentation: [Developer Guide - Progress Updates](../../../docs/developer/progress-updates.md)

docs/admin/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Administrator's Guide
2+
3+
This guide is for administrators responsible for deploying, configuring, and managing the Atlas UI 3 application.
4+
5+
## Topics
6+
7+
### Configuration
8+
- [Configuration Architecture](configuration.md) - Understanding the layered configuration system
9+
- [MCP Server Configuration](mcp-servers.md) - Setting up and configuring MCP tool servers
10+
- [LLM Configuration](llm-config.md) - Configuring Large Language Models
11+
12+
### Security & Access Control
13+
- [Authentication & Authorization](authentication.md) - User authentication and group-based access control
14+
- [Compliance & Data Security](compliance.md) - Compliance levels and data segregation
15+
- [Tool Approval System](tool-approval.md) - Managing tool execution permissions
16+
17+
### Storage & Infrastructure
18+
- [File Storage (S3)](file-storage.md) - Configuring S3-compatible object storage
19+
20+
### Operations
21+
- [Logging & Monitoring](logging-monitoring.md) - Application logs and health monitoring
22+
- [Admin Panel](admin-panel.md) - Using the administrative interface
23+
24+
### UI Customization
25+
- [Help Modal](help-config.md) - Customizing the Help/About modal
26+
- [Splash Screen](splash-config.md) - Configuring the startup splash screen

docs/admin/admin-panel.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Admin Panel
2+
3+
The application includes an admin panel that provides access to configuration values and application logs.
4+
5+
* **Access**: To access the admin panel, a user must be in the `admin` group. This requires a correctly configured `is_user_in_group` function.
6+
* **Icon**: Admin users will see a shield icon on the main page, which leads to the admin panel.
7+
* **Features**:
8+
* View the current application configuration.
9+
* View the application logs (`app.jsonl`).

docs/admin/authentication.md

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
# Authentication & Authorization
2+
3+
The application is designed with the expectation that it operates behind a reverse proxy in a production environment. It does **not** handle user authentication (i.e., logging users in) by itself. Instead, it trusts a header that is injected by an upstream authentication service.
4+
5+
## Production Authentication Flow
6+
7+
The intended flow for user authentication in a production environment is as follows:
8+
9+
```
10+
+-----------+ +-----------------+ +----------------+ +--------------------+
11+
| | | | | | | |
12+
| User |----->| Reverse Proxy |----->| Auth Service |----->| Atlas UI Backend |
13+
| | 1. | | 2. | | 3. | |
14+
+-----------+ +-----------------+ +----------------+ +--------------------+
15+
```
16+
17+
1. The user makes a request to the application's public URL, which is handled by the **Reverse Proxy**.
18+
2. The Reverse Proxy communicates with an **Authentication Service** (e.g., an SSO provider, an OAuth server) to validate the user's credentials (like cookies or tokens).
19+
3. Once the user is authenticated, the Reverse Proxy **injects the user's identity** (e.g., their email address) into an HTTP header and forwards the request to the **Atlas UI Backend**.
20+
21+
The backend application reads this header to identify the user. The header name is configurable via the `AUTH_USER_HEADER` environment variable (default: `X-User-Email`). This allows flexibility for different reverse proxy setups that may use different header names (e.g., `X-Authenticated-User`, `X-Remote-User`). This model is secure only if the backend is not directly exposed to the internet, ensuring that all requests are processed by the proxy first.
22+
23+
If using AWS Application Load Balancer (ALB) as the Auth Service, the following authentication configuration should be used:
24+
25+
```
26+
AUTH_USER_HEADER=x-amzn-oidc-data
27+
AUTH_USER_HEADER_TYPE=aws-alb-jwt
28+
AUTH_AWS_EXPECTED_ALB_ARN=arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/app/your-alb-name/...
29+
AUTH_AWS_REGION=us-east-1
30+
```
31+
32+
This configuration will decode the base64-encoded JWT passed in the x-amzn-oidc-data header, validate it, and extract the user's email address from the validated JWT.
33+
34+
## Development Behavior
35+
36+
In a local development environment (when `DEBUG_MODE=true` in the `.env` file), the system falls back to using a default `[email protected]` user if the configured authentication header is not present.
37+
38+
## Configuring the Authentication Header
39+
40+
Different reverse proxy setups use different header names to pass authenticated user information. The application supports configuring the header name via the `AUTH_USER_HEADER` environment variable.
41+
42+
**Default Configuration:**
43+
```
44+
AUTH_USER_HEADER=X-User-Email
45+
```
46+
47+
**Common Alternative Headers:**
48+
```
49+
# For Apache mod_auth setups
50+
AUTH_USER_HEADER=X-Remote-User
51+
52+
# For some SSO providers
53+
AUTH_USER_HEADER=X-Authenticated-User
54+
55+
# For custom reverse proxy configurations
56+
AUTH_USER_HEADER=X-Custom-Auth-Header
57+
```
58+
59+
This setting allows the application to work with various authentication infrastructures without code changes.
60+
61+
## Proxy Secret Authentication (Optional Security Layer)
62+
63+
For additional security, you can configure the application to require a secret value in a specific header to validate that requests are coming from your trusted reverse proxy. This prevents direct access to the backend application, even if it's accidentally exposed.
64+
65+
**When to Use Proxy Secret Authentication:**
66+
- When you want an additional layer of security beyond network isolation
67+
- To prevent unauthorized access if the backend accidentally becomes publicly accessible
68+
- To ensure requests only come from your approved reverse proxy
69+
70+
**Configuration:**
71+
72+
Add the following to your `.env` file:
73+
74+
```bash
75+
# Enable proxy secret validation
76+
FEATURE_PROXY_SECRET_ENABLED=true
77+
78+
# Header name for the proxy secret (default: X-Proxy-Secret)
79+
PROXY_SECRET_HEADER=X-Proxy-Secret
80+
81+
# The actual secret value - use a strong, randomly generated value
82+
PROXY_SECRET=your-secure-random-secret-here
83+
84+
# Optional: Customize the redirect URL for failed authentication (default: /auth)
85+
AUTH_REDIRECT_URL=/auth
86+
```
87+
88+
**Reverse Proxy Configuration:**
89+
90+
Configure your reverse proxy to inject the secret header with every request. Examples:
91+
92+
**NGINX:**
93+
```nginx
94+
location / {
95+
proxy_pass http://backend:8000;
96+
proxy_set_header X-Proxy-Secret "your-secure-random-secret-here";
97+
proxy_set_header X-User-Email $remote_user;
98+
# ... other headers
99+
}
100+
```
101+
102+
**Apache:**
103+
```apache
104+
<Location />
105+
RequestHeader set X-Proxy-Secret "your-secure-random-secret-here"
106+
RequestHeader set X-User-Email %{REMOTE_USER}e
107+
ProxyPass http://backend:8000/
108+
ProxyPassReverse http://backend:8000/
109+
</Location>
110+
```
111+
112+
**Behavior:**
113+
- When enabled, the middleware validates the proxy secret on every request (except static files and the auth endpoint)
114+
- If the secret is missing or incorrect:
115+
- **API endpoints** (`/api/*`): Return 401 Unauthorized
116+
- **Browser endpoints**: Redirect to the configured auth URL
117+
- **Debug mode** (`DEBUG_MODE=true`): Proxy secret validation is automatically disabled for local development
118+
119+
**Security Best Practices:**
120+
- Generate a strong, random secret (e.g., 32+ characters)
121+
- Store the secret securely in environment variables, not in configuration files
122+
- Use different secrets for different environments (dev, staging, production)
123+
- Rotate the secret periodically as part of your security policy
124+
- Never commit the secret to version control
125+
126+
## Customizing Authorization
127+
128+
**IMPORTANT: For production deployments, configuring authorization is essential.** The default implementation is a mock and **must be replaced** with your organization's actual authorization system. You have two primary methods to achieve this:
129+
130+
### Recommended Method: HTTP Endpoint
131+
132+
You can configure the application to call an external HTTP endpoint to check for group membership. This is the most flexible and maintainable solution, requiring no code changes to the application itself.
133+
134+
1. **Configure the Endpoint in `.env`**:
135+
Add the following variables to your `.env` file:
136+
```
137+
# The URL of your authorization service
138+
AUTH_GROUP_CHECK_URL=https://your-auth-service.example.com/api/check-group
139+
140+
# The API key for authenticating with your service
141+
AUTH_GROUP_CHECK_API_KEY=your-secret-api-key
142+
```
143+
144+
2. **Endpoint Requirements**:
145+
Your authorization endpoint must:
146+
* Accept a `POST` request.
147+
* Expect a JSON body with `user_id` and `group_id`:
148+
```json
149+
{
150+
"user_id": "[email protected]",
151+
"group_id": "admin"
152+
}
153+
```
154+
* Authenticate requests using a bearer token in the `Authorization` header.
155+
* Return a JSON response with a boolean `is_member` field:
156+
```json
157+
{
158+
"is_member": true
159+
}
160+
```
161+
162+
If `AUTH_GROUP_CHECK_URL` is not set, the application will fall back to the mock implementation in `backend/core/auth.py`.
163+
164+
When using the mock implementation (no external endpoint configured), **all users are treated as part of the `users` group by default**. This ensures that basic, non-privileged features remain available even without an authorization service. Higher-privilege groups such as `admin` still require explicit membership via the mock group table or your real authorization system.
165+
166+
### Legacy Method: Modifying the Code
167+
168+
For advanced use cases, you can still directly modify the `is_user_in_group` function located in `backend/core/auth.py`. The default implementation is a mock and **must be replaced** if you are not using the HTTP endpoint method.

docs/admin/compliance.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Compliance and Data Security
2+
3+
The compliance system is designed to prevent the unintentional mixing of data from different security environments. This is essential for organizations that handle sensitive information.
4+
5+
## Compliance Levels
6+
7+
You can assign a `compliance_level` to LLM endpoints, RAG data sources, and MCP servers. These levels are defined in `config/defaults/compliance-levels.json` (which can be overridden).
8+
9+
**Example:** A tool that accesses internal-only data can be marked with `compliance_level: "Internal"`, while a tool that uses a public API can be marked as `compliance_level: "Public"`.
10+
11+
## The Allowlist Model
12+
13+
The compliance system uses an explicit **allowlist**. Each compliance level defines which other levels it is allowed to interact with. This prevents data from a highly secure environment (e.g., "HIPAA") from being accidentally sent to a less secure one (e.g., "Public").
14+
15+
For example, a session running with a "HIPAA" compliance level will not be able to use tools or data sources marked as "Public", preventing sensitive data from being exposed.

docs/admin/configuration.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Configuration Architecture
2+
3+
The application uses a layered configuration system that loads settings from three primary sources in the following order of precedence:
4+
5+
1. **Environment Variables (`.env`)**: Highest priority. These override any settings from files.
6+
2. **Override Files (`config/overrides/`)**: For custom, instance-specific configurations. These files are not checked into version control.
7+
3. **Default Files (`config/defaults/`)**: The base configuration that is part of the repository.
8+
9+
**Note**: The definitive source for all possible configuration options and their default values is the `AppSettings` class within `backend/modules/config/config_manager.py`. This class dictates how the application reads and interprets all its settings.
10+
11+
## Key Override Files
12+
13+
To customize your instance, you will place your own versions of the configuration files in the `config/overrides/` directory. The most common files to override are:
14+
15+
* **`mcp.json`**: Registers and configures the MCP (tool) servers that provide capabilities to the LLM.
16+
* **`llmconfig.yml`**: Defines the list of available Large Language Models and their connection details.
17+
* **`compliance-levels.json`**: Defines the security compliance levels (e.g., Public, Internal, HIPAA) and the rules for how they can interact.
18+
* **`help-config.json`**: Populates the content of the "Help" modal in the user interface.
19+
* **`splash-config.json`**: Configures the startup splash screen for displaying policies and information to users.
20+
* **`messages.txt`**: Defines the text for system-wide banner messages that can be displayed to all users.
21+
22+
## The `.env` File
23+
24+
This file is crucial for setting up your instance. Start by copying the example file:
25+
26+
```bash
27+
cp .env.example .env
28+
```
29+
30+
Key settings in the `.env` file include:
31+
32+
* **API Keys**: `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, etc.
33+
* **Authentication Header**: `AUTH_USER_HEADER` configures the HTTP header name used to extract the authenticated username from your reverse proxy (default: `X-User-Email`).
34+
* **Feature Flags**: Enable or disable major features like `FEATURE_AGENT_MODE_AVAILABLE`.
35+
* **S3 Connection**: Configure the connection to your S3-compatible storage. For local testing, you can set `USE_MOCK_S3=true` to use an in-memory mock instead of a real S3 bucket. **This mock must never be used in production.**
36+
* **Log Directory**: The `APP_LOG_DIR` variable points to the folder where the application log file (`app.jsonl`) will be stored. This path must be updated to a valid directory in your deployment environment.

docs/admin/file-storage.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# File Storage and Tool Integration
2+
3+
The application uses S3-compatible object storage for handling all user-uploaded files. This system is designed to be secure and flexible, allowing tools to access files without ever needing direct S3 credentials.
4+
5+
## Configuration Modes
6+
7+
You can configure the file storage in one of two modes using the `.env` file.
8+
9+
### 1. Development Mode (Mock S3)
10+
For local development and testing, you can use a built-in mock S3 service.
11+
12+
* **Setting**: `USE_MOCK_S3=true`
13+
* **Behavior**: Files are stored on the local filesystem in the `minio-data/` directory. This mode is convenient as it requires no external services or credentials.
14+
* **Use Case**: Ideal for local development. **This must not be used in production.**
15+
16+
### 2. Production Mode (Real S3)
17+
For production, you must connect to a real S3-compatible object store like AWS S3, MinIO, or another provider.
18+
19+
* **Setting**: `USE_MOCK_S3=false`
20+
* **Configuration**: You must provide the connection details in your `.env` file:
21+
```
22+
S3_ENDPOINT_URL=https://your-s3-provider.com
23+
S3_BUCKET_NAME=your-bucket-name
24+
S3_ACCESS_KEY=your-access-key
25+
S3_SECRET_KEY=your-secret-key
26+
S3_REGION=us-east-1
27+
```
28+
29+
## How MCP Tools Access Files
30+
31+
The application uses a secure workflow that prevents MCP tools from needing direct access to S3 credentials. Instead, the backend acts as a proxy.
32+
33+
```
34+
1. User uploads file
35+
[User] -> [Atlas UI Backend] -> [S3 Bucket]
36+
|
37+
| 2. LLM calls tool with filename
38+
v
39+
4. Tool downloads file from Atlas UI API
40+
[MCP Tool] <- [Atlas UI Backend] <- [S3 Bucket]
41+
^
42+
| 3. Backend creates temporary, secure URL
43+
```
44+
45+
1. **File Upload**: A user uploads a file, which is stored in the configured S3 bucket.
46+
2. **Tool Call**: The LLM decides to use a tool that needs the file and passes the `filename` as an argument.
47+
3. **Secure URL Generation**: The Atlas UI backend intercepts the tool call. It generates a temporary, secure URL that points back to its own API (e.g., `/api/files/download/...`). This URL contains a short-lived capability token that grants access only to that specific file.
48+
4. **Tool Execution**: The backend replaces the original `filename` argument with this new secure URL and sends it to the MCP tool. The tool can then make a simple `GET` request to the URL to download the file content.
49+
50+
This process ensures that MCP tools can access the files they need without ever handling sensitive S3 credentials, enhancing the overall security of the system.

docs/admin/help-config.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Customizing the Help Modal
2+
3+
You can customize the content that appears in the "Help" or "About" modal in the UI by creating a `help-config.json` file.
4+
5+
* **Location**: Place your custom file at `config/overrides/help-config.json`.
6+
7+
The file consists of a title and a list of sections, each with a title and content that can include markdown for formatting.
8+
9+
## Example `help-config.json`
10+
11+
```json
12+
{
13+
"title": "About Our Chat Application",
14+
"sections": [
15+
{
16+
"title": "Welcome",
17+
"content": "This is a custom chat application for our organization. It provides access to internal tools and data sources."
18+
},
19+
{
20+
"title": "Available Tools",
21+
"content": "You can use tools for:\n\n* Querying databases\n* Analyzing documents\n* Searching our internal knowledge base"
22+
},
23+
{
24+
"title": "Support",
25+
"content": "For questions or issues, please contact the support team at [[email protected]](mailto:[email protected])."
26+
}
27+
]
28+
}
29+
```

0 commit comments

Comments
 (0)