Skip to content
nikcli
Docs
Documentation

Connectors

How nikcli connects external services, stores credentials, exposes connector tools, and receives bot webhooks.

Overview

Connectors are service-specific integrations configured under connectors in nikcli.json. The runtime lives in packages/nikcli/src/connectors. It checks credentials, runs health checks, creates AI SDK tools for services with operations, exposes prompts, and caches status/tool results.

Agent

Tool connectors

Figma, Slack, GitHub, and Lovable expose operations as dynamic agent tools.

Webhook

Bot connectors

Discord, Teams, Google Chat, Linear, GitHub, and Slack are also used by chatbot webhook routes.

Secrets

Credential store

Saved connector credentials are written to Global.Path.data/connectors-auth.json with 0600 on Unix.

Resolution

Config first, auth second

Environment flags win, then inline config credentials, then saved connector auth records.

Connector types

TypeCredentialHealth checkAgent tools
figmaPersonal access tokenFigmaApi.getMeFile, components, styles, comments.
slackBot tokenSlackApi.listUsersList channels, send message, search, channel info, thread reply.
githubPersonal access tokenGithubApi.getUserRepo, file, issue, issue list, code search, repo list.
lovableToken or API keyLovableApi.getProjectsProjects, project, chats, send message, files, run prompt.
discordBot tokenNo-op health checkNo connector tools; bot/webhook use.
teamsBot tokenNo-op health checkNo connector tools; bot/webhook use.
gchatBot tokenNo-op health checkNo connector tools; bot/webhook use.
linearBot tokenNo-op health checkNo connector tools; bot/webhook use.

Add and authenticate

nikcli connectors add patches either the current project config or global config. If you provide a credential during the wizard, it writes the credential to the connector auth store, not into the config file. auth and logout manage that store.

Terminal
bash
nikcli connectors add
nikcli connectors list
nikcli connectors auth github
nikcli connectors logout github
CommandBehavior
connectors addSelect scope, name, type, enabled state, optional credential.
connectors listShow configured connector status and saved credential hint.
connectors auth [name]Save a token, bot token, or API key for the selected connector.
connectors logout [name]Remove saved credentials from connectors-auth.json.

Credential resolution

resolveCredential uses a strict order: environment flag, config inline credential, saved auth record, then no credential.

TypeEnv flagConfig fieldSaved field
figmaNIKCLI_FIGMA_TOKENtokentoken
githubNIKCLI_GITHUB_TOKENtokentoken
slackNIKCLI_SLACK_BOT_TOKENbotTokenbotToken
lovableNIKCLI_LOVABLE_TOKEN or NIKCLI_LOVABLE_API_KEYtoken or apiKeytoken or apiKey
Inline config credentials are supported but not preferred

The CLI wizard stores credentials separately so project config can be shared without tokens. Use inline credentials only when you intentionally want config-managed secrets.

Tool operations

Tool-capable connectors generate names by prefixing the configured connector name and operation name. For a connector named github, operation github_get_repo becomes github_github_get_repo.

ConnectorOperations
Figmafigma_get_file, figma_get_components, figma_get_styles, figma_get_comments.
Slackslack_list_channels, slack_send_message, slack_search_messages, slack_get_channel_info, slack_reply_to_thread.
GitHubgithub_get_repo, github_get_file, github_create_issue, github_list_issues, github_search_code, github_list_repos.
Lovablelovable_get_projects, lovable_get_project, lovable_get_chats, lovable_send_message, lovable_get_project_files, lovable_run_prompt.

Each operation is wrapped as a dynamic tool with a JSON schema built from the operation args. Results are returned as strings or pretty JSON.

Bot connectors

Bot/webhook platforms are mounted under /chatbot. The route file exposes webhook handlers for Discord, Slack, Teams, Google Chat, Linear, and GitHub. These are separate from connector tool operations even when they share the same service name.

Webhook routePlatform
POST /chatbot/discord/:nameDiscord
POST /chatbot/slack/:nameSlack
POST /chatbot/teams/:nameMicrosoft Teams
POST /chatbot/gchat/:nameGoogle Chat
POST /chatbot/linear/:nameLinear
POST /chatbot/github/:nameGitHub

API routes

RouteBehavior
GET /connectors/statusReturn status for configured connectors.
POST /connectors/:name/authSet token, bot token, or API key for a connector.
DELETE /connectors/:name/authRemove connector auth entry.
POST /connectors/:name/invalidateInvalidate cached status/tools for one connector.
Terminal
bash
curl http://127.0.0.1:4096/connectors/status

curl -X POST http://127.0.0.1:4096/connectors/github/auth \
  -H "Content-Type: application/json" \
  -d '{"token":"ghp_example"}'

curl -X POST http://127.0.0.1:4096/connectors/github/invalidate

Caches and invalidation

Connector status and tool creation are cached based on the active config. Auth writes, removals, and explicit invalidation should clear the relevant cache so the next list/tool call rechecks credentials and health.

CacheInvalidated by
StatusinvalidateStatusCache and connector invalidation.
ToolsinvalidateToolsCache and connector invalidation.
One connectorinvalidateConnectorCache(name).

Config examples

connectors config
json
{
  "connectors": {
    "github": {
      "type": "github",
      "enabled": true
    },
    "figma-design": {
      "type": "figma",
      "enabled": true
    },
    "slack-builds": {
      "type": "slack",
      "enabled": true
    },
    "linear-bot": {
      "type": "linear",
      "enabled": true
    }
  }
}

Use distinct names when the same service is used for different contexts, such as slack-builds and slack-support. Tool names include the connector name, so a descriptive name helps the model choose the correct integration.

Failure modes

SymptomLikely causeFix
needs_authNo env, config, or saved credential resolved.Run nikcli connectors auth <name> or set the provider env flag.
failedHealth check failed or connector type is unknown.Check token scope and service API response.
Tools missingConnector disabled, not authenticated, or type has no operations.Check status and remember bot-only connectors have no agent tools.
Old credential still usedStatus/tool cache was not invalidated after credential change.Invalidate connector or restart the process.
Lovable token ignoredCredential stored as API key but type resolution expected token.Lovable supports token fallback to API key; verify saved field and config field.

Source anchors

NeedFile
Connector servicepackages/nikcli/src/connectors/index.ts
Connector registry and toolspackages/nikcli/src/connectors/registry.ts
Credential resolutionpackages/nikcli/src/connectors/credentials.ts
Credential storepackages/nikcli/src/connectors/auth.ts
CLI commandpackages/nikcli/src/cli/cmd/connectors.ts
Server routespackages/nikcli/src/server/httpapi/connectors.ts
Chatbot routespackages/nikcli/src/server/httpapi/chatbot.ts
Service APIspackages/nikcli/src/connectors/api