@insourcia/cli
v0.2.0
Published
Command-line client for the Insourcia tools RPC API. Pilot the agent surface (search companies, get directors, financials, business events, credit risk, watchlists) from the terminal or shell scripts - no MCP client required.
Readme
@insourcia/cli
Command-line client for the Insourcia tools RPC API. Pilot the agent surface (search FR companies, get directors, financials, business events, credit risk, watchlists) from the terminal or shell scripts - no MCP client required.
Zero runtime dependencies. Works on Node.js ≥ 20.
Install
# One-off (no install)
npx @insourcia/cli --help
# Or install globally
npm install -g @insourcia/cli
insourcia --helpAuthentication
Two options:
OAuth login (recommended for humans)
insourcia auth login # opens browser, complete login + consent
insourcia auth status # show current user
insourcia auth logout # forget stored credentialsThe OAuth flow uses Authorization Code + PKCE with a loopback redirect (the same pattern as gh auth login and infisical login). Credentials live in ~/.config/insourcia/credentials.json (mode 0600). The access token is refreshed automatically when it expires.
API key (recommended for CI / scripts)
Generate an API key from your Insourcia dashboard, then:
export INSOURCIA_API_TOKEN=isk_...Or pass --token isk_... on every call.
Resolution order: --token > INSOURCIA_API_TOKEN > OAuth credentials from auth login.
Usage
# List available tools
insourcia tools list
# Invoke a tool (JSON in --input)
insourcia tools call search_companies --input '{"query":"vinci","limit":3}'
# From file
insourcia tools call search_companies --input @search.json
# From stdin
echo '{"siren":"552120222"}' | insourcia tools call get_company --input -
# Keep the {success,data} envelope (default unwraps to data)
insourcia tools call get_company --input '{"siren":"552120222"}' --rawAvailable tools
Generated from the API tool registry - the same list insourcia tools list
returns, with the same descriptions. Do not edit by hand.
| Tool | Description |
|---|---|
| search_companies | Recherche d'entreprises francaises par nom, SIREN, activite, et criteres financiers. |
| resolve_companies | Rapprochement EN LOT de fiches mal identifiees vers leur SIREN - la forme qu'un CRM, un tableur ou un export CSV contient. |
| get_company | Fiche complete d'une entreprise francaise identifiee par son SIREN. |
| get_financials | Historique financier detaille d'une entreprise sur plusieurs exercices. |
| get_directors | Detail des dirigeants d'une entreprise avec structure hierarchique. |
| search_directors | Recherche de personnes (dirigeants) a travers toutes les entreprises francaises, par nom de famille. |
| search_director_companies | Cartographie de l'empreinte corporate d'UNE personne physique : toutes les entreprises ou elle detient un mandat direct, identifiee de facon non ambigue par nom + prenom + date de naissance exacte. |
| search_events | Recherche unifiee d'evenements d'entreprise (cross-SIREN), basee sur notre index ES. |
| get_events | Timeline unifiee des evenements d'UNE entreprise (par SIREN). |
| get_credit_risk | Score de risque credit d'UNE entreprise francaise (par SIREN). |
| get_company_graph | Cartographie des entites autour d'UNE entreprise (par SIREN) : graphe ORIENTE et TYPE construit sur les mandats RCS/RNE et les liens de groupe. |
| create_saved_search | Creation d'une recherche sauvegardee pour l'utilisateur, visible dans l'app Insourcia (page /news - Veille). |
| watch_company | Mise sous surveillance d'une societe : l'ajoute a une liste de veille de l'utilisateur, visible dans l'app Insourcia (page /lists). |
| unwatch_company | Retrait d'une societe de la surveillance : l'enleve d'une liste de veille de l'utilisateur (page /lists de l'app Insourcia). |
| list_saved_searches | Liste des recherches sauvegardees de l'utilisateur (page /news - Veille de l'app Insourcia). |
| list_watched_companies | Liste des societes surveillees par l'utilisateur dans ses listes de veille (page /lists de l'app Insourcia). |
| get_news | Veille quotidienne de l'utilisateur : le fil d'actualite de ses societes surveillees, tel qu'il apparait sur la page /news de l'app Insourcia. |
| mark_news_read | Marque comme lus des signaux precis de la veille de l'utilisateur (page /news de l'app Insourcia). |
Full reference: insourcia.io/docs/tools.
Exit codes
0— success1— usage error (missing token, bad args, invalid JSON)2— API error (4xx/5xx) or network failure
Configuration
| Option | Env var | Default |
|---|---|---|
| --token | INSOURCIA_API_TOKEN | (falls back to OAuth creds from auth login) |
| --base-url | INSOURCIA_API_BASE_URL | https://api.insourcia.io |
| --auth-base-url | INSOURCIA_AUTH_BASE_URL | https://app.insourcia.io |
Examples
# Pipe with jq
insourcia tools list | jq '.tools[].name'
# CSV export of P&L for a list of SIRENs
for siren in $(cat sirens.txt); do
insourcia tools call get_financials --input "{\"siren\":\"$siren\"}" \
| jq -r '[.exercices[] | [.annee, .chiffre_affaires, .resultat_net]] | @csv'
done > export.csv
# Smoke test staging
insourcia tools list --base-url https://staging.insourcia.io > /dev/null \
&& echo "✓ OK"Links
License
MIT
