Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

2.1 KB
Raw Blame
import { definePlugin, registerPluginBehavior } from '@switch-console/core/agents/plugins';
import {
  buildStandardCommand,
  cursorMcpAdapter,
} from '@switch-console/core/agents/plugins/helpers';
import { icon } from './icon';

export const plugin = definePlugin(
  {
    id: 'cursor',
    name: 'Cursor',
    description:
      "Cursor's agent CLI; provides editor-style, location-aware assistance from the shell.",
    websiteUrl: 'https://cursor.com/docs/cli/overview',
    cliLabel: 'Cursor CLI',
  },
  {
    autoApprove: {
      kind: 'supported',
    },
    effort: {
      kind: 'none',
    },
    hostDependency: {
      id: 'cursor',
      binaryNames: ['agent', 'cursor-agent'],
      installCommands: {
        macos: [
          {
            method: 'curl',
            command: 'curl https://cursor.com/install -fsS | bash',
          },
        ],
        linux: [
          {
            method: 'curl',
            command: 'curl https://cursor.com/install -fsS | bash',
          },
        ],
      },
      updates: {
        kind: 'supported',
        releaseSource: {
          kind: 'none',
        },
        update: {
          kind: 'package-manager',
        },
      },
    },
    mcp: {
      kind: 'supported',
      scope: 'global',
      supportedTransports: ['stdio', 'http'],
    },
    models: {
      kind: 'none',
    },
    plugins: {
      kind: 'none',
    },
    prompt: {
      kind: 'argv',
      flag: '',
    },
    sessions: {
      kind: 'resumable',
    },
    repoAgents: { kind: 'none' },
  },
  { icon }
);

export const provider = registerPluginBehavior(plugin, {
  prompt: {
    buildCommand: (ctx) =>
      buildStandardCommand(ctx, {
        autoApproveFlag: '-f --approve-mcps',
        // No documented CLI flag selects Cursor's Auto-review run mode, so auto
        // mode launches it asking as approval-required does.
        initialPromptFlag: '',
        resumeFlag: '--resume',
      }),
  },
  mcp: {
    ...cursorMcpAdapter(),
    // Read at session start, and only the model and the instructions.
    launchProfileSettings: () => ({}),
  },
});