Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

mycoder

drivecore234MIT1.6.0TypeScript support: included

A command line tool using agent that can do arbitrary tasks, including coding tasks

ai, agent, mycoder, swe, swe-agent, claude, auto-coder, auto-gpt, typescript, openai, automation

readme

MyCoder CLI

Command-line interface for AI-powered coding tasks. Full details available on the main MyCoder.ai website and the Official MyCoder.Ai Docs website.

Features

  • 🤖 AI-Powered: Leverages Anthropic's Claude, OpenAI models, and Ollama for intelligent coding assistance
  • 🛠️ Extensible Tool System: Modular architecture with various tool categories
  • 🔄 Parallel Execution: Ability to spawn sub-agents for concurrent task processing
  • 📝 Self-Modification: Can modify code, it was built and tested by writing itself
  • 🔍 Smart Logging: Hierarchical, color-coded logging system for clear output
  • 👤 Human Compatible: Uses README.md, project files and shell commands to build its own context
  • 🌐 GitHub Integration: GitHub mode for working with issues and PRs as part of workflow
  • 📄 Model Context Protocol: Support for MCP to access external context sources

Installation

npm install -g mycoder

For detailed installation instructions for macOS and Linux, including how to set up Node.js using NVM, see our Getting Started guide.

Usage

# Interactive mode
mycoder -i

# Run with a prompt
mycoder "Implement a React component that displays a list of items"

# Run with a prompt from a file
mycoder -f prompt.txt

# Disable user prompts for fully automated sessions
mycoder --userPrompt false "Generate a basic Express.js server"

# Disable user consent warning and version upgrade check for automated environments
mycoder --upgradeCheck false "Generate a basic Express.js server"

# Enable GitHub mode via CLI option (overrides config file)
mycoder --githubMode true

GitHub Mode

MyCoder includes a GitHub mode that enables the agent to work with GitHub issues and PRs as part of its workflow. When enabled, the agent will:

  • Start from existing GitHub issues or create new ones for tasks
  • Create branches for issues it's working on
  • Make commits with descriptive messages
  • Create PRs when work is complete
  • Create additional GitHub issues for follow-up tasks or ideas

GitHub mode is enabled by default but requires the Git and GitHub CLI tools to be installed and configured:

  • Git CLI (git) must be installed
  • GitHub CLI (gh) must be installed and authenticated

MyCoder will automatically check for these requirements when GitHub mode is enabled and will:

  • Warn you if any requirements are missing
  • Automatically disable GitHub mode if the required tools are not available or not authenticated

To manually enable/disable GitHub mode:

  1. Via CLI option (overrides config file):
mycoder --githubMode true   # Enable GitHub mode
mycoder --githubMode false  # Disable GitHub mode
  1. Via configuration file:
// mycoder.config.js
export default {
  githubMode: true, // Enable GitHub mode (default)
  // other configuration options...
};

Requirements for GitHub mode:

  • Git CLI (git) needs to be installed
  • GitHub CLI (gh) needs to be installed and authenticated
  • User needs to have appropriate GitHub permissions for the target repository

If GitHub mode is enabled but the requirements are not met, MyCoder will provide instructions on how to install and configure the missing tools.

Configuration

MyCoder is configured using a configuration file in your project. MyCoder supports multiple configuration file locations and formats, similar to ESLint and other modern JavaScript tools.

Configuration File Locations

MyCoder will look for configuration in the following locations (in order of precedence):

  1. mycoder.config.js in your project root
  2. .mycoder.config.js in your project root
  3. .config/mycoder.js in your project root
  4. .mycoder.rc in your project root
  5. .mycoder.rc in your home directory
  6. mycoder field in package.json
  7. ~/.config/mycoder/config.js (XDG standard user configuration)

Multiple file extensions are supported: .js, .ts, .mjs, .cjs, .json, .jsonc, .json5, .yaml, .yml, and .toml.

Creating a Configuration File

Create a configuration file in your preferred location:

// mycoder.config.js
export default {
  // GitHub integration
  githubMode: true,

  // Browser settings
  headless: true,
  userSession: false,
  pageFilter: 'none', // 'simple', 'none', or 'readability'

  // Model settings
  provider: 'anthropic',
  model: 'claude-3-7-sonnet-20250219',
  maxTokens: 4096,
  temperature: 0.7,

  // Custom settings
  // customPrompt can be a string or an array of strings for multiple lines
  customPrompt: '',
  // Example of multiple line custom prompts:
  // customPrompt: [
  //   'Custom instruction line 1',
  //   'Custom instruction line 2',
  //   'Custom instruction line 3',
  // ],
  profile: false,
  tokenCache: true,

  // Base URL configuration (for providers that need it)
  baseUrl: 'http://localhost:11434', // Example for Ollama

  // MCP configuration
  mcp: {
    servers: [
      {
        name: 'example',
        url: 'https://mcp.example.com',
        auth: {
          type: 'bearer',
          token: 'your-token-here',
        },
      },
    ],
    defaultResources: ['example://docs/api'],
    defaultTools: ['example://tools/search'],
  },

  // Custom commands
  // Uncomment and modify to add your own commands
  /*
  commands: {
    // Function-based command example
    "search": {
      description: "Search for a term in the codebase",
      args: [
        { name: "term", description: "Search term", required: true }
      ],
      execute: (args) => {
        return `Find all instances of ${args.term} in the codebase and suggest improvements`;
      }
    },

    // Another example with multiple arguments
    "fix-issue": {
      description: "Fix a GitHub issue",
      args: [
        { name: "issue", description: "Issue number", required: true },
        { name: "scope", description: "Scope of the fix", default: "full" }
      ],
      execute: (args) => {
        return `Analyze GitHub issue #${args.issue} and implement a ${args.scope} fix`;
      }
    }
  }
  */
};

MyCoder will search for configuration in the following places (in order of precedence):

  1. CLI options (e.g., --githubMode true)
  2. Configuration file (mycoder.config.js)
  3. Default values

Model Selection

NOTE: Anthropic Claude 3.7 works the best by far in our testing.

MyCoder supports Anthropic, OpenAI, and Ollama models. You can configure which model provider and model name to use either via CLI options or in your configuration file:

# Via CLI options (overrides config file)
mycoder --provider anthropic --model claude-3-7-sonnet-20250219 "Your prompt here"

Or in your configuration file:

// mycoder.config.js
export default {
  // Model settings
  provider: 'anthropic',
  model: 'claude-3-7-sonnet-20250219', // or any other Anthropic model
  // other configuration options...
};

Available Configuration Options

  • githubMode: Enable GitHub mode (requires "gh" cli to be installed) for working with issues and PRs (default: true)
  • headless: Run browser in headless mode with no UI showing (default: true)
  • userSession: Use user's existing browser session instead of sandboxed session (default: false)
  • pageFilter: Method to process webpage content: 'simple', 'none', or 'readability' (default: none)
  • customPrompt: Custom instructions to append to the system prompt for both main agent and sub-agents (default: "")
  • tokenCache: Enable token caching for LLM API calls (default: true)
  • mcp: Configuration for Model Context Protocol (MCP) integration (default: { servers: [], defaultResources: [] })
  • commands: Custom commands that can be executed via the CLI (default: {})

Model Context Protocol (MCP) Configuration

MyCoder supports the Model Context Protocol (MCP), which allows the agent to access external context sources and tools. MyCoder uses the official @modelcontextprotocol/sdk package for MCP integration.

To configure MCP support, add an mcp section to your mycoder.config.js file:

// mycoder.config.js
export default {
  // Other configuration...

  // MCP configuration
  mcp: {
    // MCP Servers to connect to
    servers: [
      {
        name: 'company-docs',
        url: 'https://mcp.example.com/docs',
        // Optional authentication
        auth: {
          type: 'bearer',
          token: process.env.MCP_SERVER_TOKEN,
        },
      },
    ],

    // Optional: Default context resources to load
    defaultResources: ['company-docs://api/reference'],

    // Optional: Default tools to make available
    defaultTools: ['company-docs://tools/search'],
  },
};

When MCP is configured, the agent will have access to a new mcp tool that allows it to:

  • List available resources from configured MCP servers
  • Fetch resources to use as context for its work
  • List available tools from configured MCP servers
  • Execute tools provided by MCP servers

CLI-Only Options

These options are available only as command-line parameters and are not stored in the configuration:

  • upgradeCheck: Disable version upgrade check for automated/remote usage (default: true)
  • userPrompt: Enable or disable the userPrompt tool (default: true)

Example setting these options via CLI arguments (which will override the config file):

# Set browser to show UI for this session only
mycoder --headless false "Your prompt here"

# Use existing browser session for this session only
mycoder --userSession true "Your prompt here"

Environment Variables

  • ANTHROPIC_API_KEY: Your Anthropic API key (required when using Anthropic models)
  • OPENAI_API_KEY: Your OpenAI API key (required when using OpenAI models)
  • SENTRY_DSN: Optional Sentry DSN for error tracking

Note: Ollama models do not require an API key as they run locally or on a specified server.

Development

# Clone the repository
git clone https://github.com/drivecore/mycoder.git
cd mycoder

# Install dependencies
pnpm install

# Build the CLI
pnpm build

# Run the locally built CLI
pnpm cli -i

License

MIT

changelog

mycoder-v1.6.0 (2025-03-21)

Features

  • browser: add system browser detection for Playwright (00bd879), closes #333

mycoder-v1.5.0 (2025-03-20)

Bug Fixes

  • list default model correctly in logging (5b67b58)
  • restore visibility of tool execution output (0809694), closes #328
  • update CLI cleanup to use ShellTracker instead of processStates (3dca767)

Features

  • Add interactive correction feature to CLI mode (de2861f), closes #326
  • add stdinContent parameter to shell commands (5342a0f), closes #301

mycoder-v1.4.1 (2025-03-14)

Bug Fixes

mycoder-v1.4.0 (2025-03-14)

Bug Fixes

  • perfect gpustack compatibility, fix openai edge case (9359f62)

Features

  • replace cosmiconfig with c12 for configuration management (cc17315), closes #260
  • support multiple line custom prompts in mycoder.config.js (fa7f45e), closes #249

mycoder-v1.3.1 (2025-03-13)

Bug Fixes

  • redo ollama llm provider using ollama sdk (586fe82)

mycoder-v1.3.0 (2025-03-12)

Features

  • implement MCP tools support (2d99ac8)

mycoder-v1.2.0 (2025-03-12)

Features

  • Add basic Model Context Protocol (MCP) support (8ec9619)
  • agent: implement incremental resource cleanup for agent lifecycle (576436e), closes #236
  • background tools is now scope to agents (e55817f)

mycoder-v1.1.1 (2025-03-12)

Bug Fixes

  • remove userWarning option from docs and Github Action. (35617c1)

mycoder-v1.1.0 (2025-03-12)

Bug Fixes

  • implement resource cleanup to prevent CLI hanging issue (d33e729), closes #141
  • llm choice working well for openai, anthropic and ollama (68d34ab)
  • remove unreliable init command and createDefaultConfigFile function (5559567), closes #225
  • replace @semantic-release/npm with @anolilab/semantic-release-pnpm to properly resolve workspace references (bacb51f)

Features

  • add git and gh CLI tools availability check (8996f36), closes #217
  • add Ollama configuration options (d5c3a96)
  • cli: Add checking for git and gh CLI tools in GitHub mode (5443185), closes #217
  • llm: add OpenAI support to LLM abstraction (7bda811)
  • refactor: agent (a2f59c2)
  • Replace config CLI commands with config file-based approach (#215) (8dffcef)

mycoder-v1.0.0 (2025-03-11)

Bug Fixes

  • add deepmerge to cli package.json (ab66377)
  • don't save consent when using --userWarning=false (41cf69d)
  • monorepo: implement semantic-release-monorepo for proper versioning of sub-packages (96c6284)
  • update hierarchical configuration system to fix failing tests (93d949c)

Features

  • add --githubMode and --userPrompt as boolean CLI options that override config settings (0390f94)
  • add CLI options for automated usage scenarios (00419bc)
  • add maxTokens and temperature config options to CLI (b461d3b), closes #118
  • implement hierarchical configuration system (84d73d1), closes #153
  • remove modelProvider and modelName - instant decrepation (59834dc)

mycoder

0.7.0 (2025-03-10)

Bug Fixes

  • change where anthropic key is declared (f6f72d3)
  • ensure npm publish only happens on release branch (ec352d6)

Features

  • add GitHub Action for issue comment commands (136950f), closes #162
  • allow for generic /mycoder commands (4b6608e)
  • release: implement conventional commits approach (5878dd1), closes #140

0.6.1

Patch Changes

  • 5f43eeb: Improve check for API keys with better help messages.
  • Updated dependencies [5f43eeb]

0.6.0

Minor Changes

  • Simplify browser message tool parameter schema to make it easier for AI to call.

Patch Changes

0.5.0

Minor Changes

  • a51b970: Convert from JsonSchema7Type to ZodSchema for tool parameters and returns, required for Vercel AI SDK integration.
  • 27f73e3: Add GitHub mode to MyCoder for working with issues and PRs
  • 66ff39e: Add support for OpenAI models (o3 mini and GPT-4o) via Vercel AI SDK
  • 9b9d953: Add performance profiler via --profile to diagnose slow start-up times on some OSes.
  • 9b9d953: Use cross platform compatibility tooling to build up context, rather than Linux/MacOS specific tools.

0.4.0

Minor Changes

  • Adds sentry error reporting for quality monitoring.

Patch Changes

0.3.0

Minor Changes

  • Better browser experience: show browser, take over user session, content filter, robustness improvements to browsing.

Patch Changes

0.2.3

Patch Changes

  • Ensure all logging follows logLevel cli option.

0.2.2

Patch Changes

  • Fix version check to handle packages in the future (like during dev)

0.2.1

Patch Changes

  • Removed debug logging, fixed package.json urls for git repo.
  • Updated dependencies

0.2.0

Minor Changes

  • Add token caching, better user input handling, token usage logging (--tokenUsage), the ability to see the browser (--headless=false), and log prefixes with emojis.

Patch Changes

0.2.2

Patch Changes

  • Replaced --tokenLog with --tokenUsage boolean flag that outputs token usage at info log level when enabled

0.2.1

Patch Changes

  • Added --tokenLog option to output token usage at specified log level (defaults to debug), helping to monitor token caching effectiveness

0.2.0

Minor Changes

  • Make the warning a consent based single show to reduce distractions. Made the initial user prompt green to better conform to the user prompts from the agents being green.

0.1.3

Patch Changes

  • Improved sub-agent directions, do not assume a lack of a response is an agent being done, rather look for explicit confirmation, allow for sub-agents to have optional custom working directorires, break agent framework into the mycoder-agent package
  • Updated dependencies

0.1.2

Patch Changes

  • add sleep tool to allow the agent to wait for tasks (like browse or shell commands) to complete.

0.1.1

Patch Changes

  • add respawn tool to help reduce context size

0.1.0

Minor Changes

  • Add support for browsing the web

0.0.23

Patch Changes

  • upgrade dependency to fix windows bug

0.0.22

Patch Changes

  • Alternative windows fix

0.0.21

Patch Changes

  • Fix windows compatibility for cli tool.

0.0.20

Patch Changes

  • A very fast and simple background version check

0.0.19

Patch Changes

  • ensure the cli works on windows

0.0.18

Patch Changes

  • better fix for linux cli that still hides deprecations

0.0.17

Patch Changes

  • Fix the linux cli and add a test to ensure it doesn't break again.

0.0.16

Patch Changes

  • Improve check for new versions, simplify the logging.

0.0.15

Patch Changes

  • add support for async shell commands, but retain sync mode while viewing async as fallback

0.0.14

Patch Changes

  • Add new version check, use sub-agents for context more freely.

0.0.13

Patch Changes

  • Put all development guidelines in contributing.md and not in readme.md

0.0.12

Patch Changes

  • ensure warning always appears

0.0.11

Patch Changes

  • reduce expectations in the readme to start

0.0.10

Patch Changes

  • add warning, better docs, license

0.0.9

Patch Changes

  • Remove test files

0.0.8

Patch Changes

  • improved checking for API KEY

0.0.7

Patch Changes

  • Cleaner log output

0.0.6

Patch Changes

  • Better agent prompt

0.0.5

Patch Changes

  • refactor default command to use yargs-file-commands, added -i alias for interactive mode

0.0.4

Patch Changes

  • fix dependencies for runtime

0.0.3

Patch Changes

  • Fixed readme file that got clobbered.

0.0.2

Patch Changes

  • c762ce8: Initial public release