Connect your data sources
Anything CLI queries data where it already lives — Postgres, MySQL, MongoDB, Salesforce,
CSV files, and more. You do not paste connection strings into playbooks or chat. Instead, you register
named sources in profiles/local.yaml and keep secrets in .env.
1. Put credentials in
.env (gitignored)2. Register each source in
profiles/local.yaml with an adapter type3. Restart the stack (
anythinggraph start or ./start-all.sh)4. Map playbook entities to sources in bindings via
source_id
profiles/local.yaml by hand (or in your
deployment repo). MCP admin tools can list and introspect sources after they are configured —
they do not create profile entries for you.
Where is local.yaml?
The profile file is always named local.yaml and lives under a profiles/ directory
in your Anything CLI workspace.
| Install method | Profile path |
|---|---|
npm CLI (anythinggraph onboard) |
~/.anythinggraph/source/profiles/local.yaml |
| Git clone (contributors) | ./profiles/local.yaml in the repo root |
| Custom path | Set AG_PROFILE_PATH to your YAML file |
Credentials live next to the workspace in .env — for npm installs:
~/.anythinggraph/source/.env. Copy from .env.example if you have not already.
# npm CLI install
cp ~/.anythinggraph/source/.env.example ~/.anythinggraph/source/.env
# edit AG_SQL_DSN, AG_MYSQL_DSN, etc.
# git clone
cp .env.example .env
Profile structure
A profile is a YAML file with a top-level sources: map. Each key is a source id
you choose (for example warehouse_pg, mysql_main). Bindings reference that key as
source_id.
Shipped example (from the repo)
sources:
warehouse_pg:
adapter: sql
dsn: env:AG_SQL_DSN
salesforce_main:
adapter: soql
instance_url: env:AG_SF_INSTANCE_URL
auth: env:AG_SF_ACCESS_TOKEN
payroll_csv:
adapter: csv
file_path: env:AG_PAYROLL_CSV_PATH
mongo_main:
adapter: mongodb
dsn: env:AG_MONGODB_DSN
database: env:AG_MONGODB_DATABASE
| Field | Purpose |
|---|---|
sources.<key> |
Named source — becomes source_id in bindings |
adapter |
Which connector to use: sql, mysql, mongodb, csv, soql, rest, … |
dsn |
Database connection string (SQL, MySQL, MongoDB) |
file_path |
Path to a CSV file (CSV adapter) |
instance_url + auth |
Salesforce org URL and access token (SOQL adapter) |
database |
MongoDB database name (optional; can also pass at introspect time) |
env:AG_* |
Prefix meaning “read this value from an environment variable at startup” |
How profiles work
-
Secrets stay in
.env— connection strings, tokens, and file paths. Never put them in playbooks, bindings, or git. -
profiles/local.yamlnames each source — adapter type +env:…references only. -
Bindings point at a profile key —
source_id: warehouse_pgtells the runtime which credentials and adapter to use for that mapping file. -
One playbook, many sources — you often have one binding YAML per source (for example
my-playbook.postgres.yamlandmy-playbook.csv.yaml), each with its ownsource_id.
source_id: warehouse_pg. See
Bindings and the
playbooks guide for entity mapping.
Quick checklist (every source)
- Add the credential to
.env - Add or edit an entry under
sources:inprofiles/local.yaml - Restart:
anythinggraph startor./start-all.sh - Confirm with MCP
list_sources(admin token) oranythinggraph doctor - Author a binding with
source_idmatching your profile key
MySQL
1. Set credentials in .env
AG_MYSQL_DSN=mysql://user:pass@localhost:3306/yourdb
2. Register in profiles/local.yaml
sources:
mysql_main:
adapter: mysql
dsn: env:AG_MYSQL_DSN
3. Use in a binding
# bindings/your-playbook.mysql.yaml
source_id: mysql_main
entities:
crm_user:
from: users
id: user_id
fields: [full_name]
from is the table name; id is the primary key column. SQL is compiled for MySQL
dialect automatically. Introspect via MCP: introspect_source with
source_id: mysql_main and optional schema_name for the database schema.
Salesforce
1. Set credentials in .env
AG_SF_INSTANCE_URL=https://your-org.my.salesforce.com
AG_SF_ACCESS_TOKEN=your_access_token
2. Register in profiles/local.yaml
sources:
salesforce_main:
adapter: soql
instance_url: env:AG_SF_INSTANCE_URL
auth: env:AG_SF_ACCESS_TOKEN
3. Use in a binding
# bindings/your-playbook.salesforce.yaml
source_id: salesforce_main
entities:
crm_user:
from: User
id: Id
fields:
full_name: Name
from is the Salesforce object API name (User,
Account, Lead, …). Field names use Salesforce API names. Introspect with
introspect_source and optional schema_name=Account,Contact to limit described
objects.
CSV files
1. Set file path in .env
AG_PAYROLL_CSV_PATH=./data/payroll.csv
Use an absolute path or a path relative to the workspace root when the service starts.
2. Register in profiles/local.yaml
sources:
payroll_csv:
adapter: csv
file_path: env:AG_PAYROLL_CSV_PATH
3. Use in a binding
# bindings/your-playbook.csv.yaml
source_id: payroll_csv
entities:
crm_user:
from: payroll.csv
id: user_id
fields:
user_id: user
full_name: full_name
from is the filename (not the full path — the path lives in the profile only).
Map playbook fields to CSV column headers when names differ. Introspect reads column headers from the file:
introspect_source with source_id: payroll_csv.
MongoDB
1. Set credentials in .env
AG_MONGODB_DSN=mongodb://localhost:27017
AG_MONGODB_DATABASE=your_database_name
2. Register in profiles/local.yaml
sources:
mongo_main:
adapter: mongodb
dsn: env:AG_MONGODB_DSN
database: env:AG_MONGODB_DATABASE
3. Use in a binding
# bindings/your-playbook.mongodb.yaml
source_id: mongo_main
entities:
crm_customer:
from: customers
id: customer_id
fields:
customer_id: _id
full_name: name
from is the collection name. Field values are document field paths. Introspect
with introspect_source, source_id: mongo_main, and
schema_name set to the database name if not set in the profile.
For a full Postgres + MongoDB walkthrough, see Cross-source CRM walkthrough.
Verify your connection
After editing .env and profiles/local.yaml, restart the stack, then:
CLI health
anythinggraph doctor
anythinggraph status
MCP (admin token)
From Cursor or another MCP client connected to http://127.0.0.1:3334/mcp:
list_sources— shows configured profile keys and adapter types (no secrets)introspect_source— schema, tables/collections, or Salesforce objectssample_source— a few live rows or documents to confirm connectivity
list_sources, check YAML syntax, restart the service, and confirm
AG_PROFILE_PATH points at the file you edited.
What comes next
- Bindings — map playbook entities to tables, collections, or objects
- Playbooks & bindings guide — step-by-step authoring
- MCP setup — connect Claude or Cursor
- All data adapters — Postgres, REST, SQL Server, and planned connectors