Ophis

v1.0.0Developer Toolsstable

Transform any Cobra CLI into an MCP server

clicobracobra-cligogolang
Share:
85
Stars
0
Downloads
0
Weekly
0/5

What is Ophis?

Ophis is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to transform any cobra cli into an mcp server

Transform any Cobra CLI into an MCP server

This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • Transform any Cobra CLI into an MCP server

Use Cases

Transform any Cobra CLI into an MCP server automatically.
Expose Go CLI tools to AI agents through MCP.
Create MCP servers from existing CLI applications.
njayp

Maintainer

LicenseApache-2.0
Languagego
Versionv1.0.0
UpdatedMay 13, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx ophis

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use Ophis

Ophis is a Go library that automatically converts any Cobra CLI application into a fully functional MCP server, requiring minimal changes to existing code. It recursively walks the Cobra command tree, generates JSON schemas from command flags, and exposes each subcommand as an MCP tool that AI agents can invoke. This means any CLI tool built with Cobra — internal tooling, platform CLIs, or DevOps utilities — becomes immediately accessible to Claude, VS Code, Cursor, and other MCP-compatible clients without building a separate integration.

Prerequisites

  • Go 1.21 or later
  • An existing Cobra CLI application or a new Go project
  • The ophis Go module added as a dependency
  • An MCP client such as Claude Desktop, Claude Code, or Cursor
1

Add ophis as a dependency to your Go module

Run go get to add the ophis library to your existing Cobra CLI project.

go get github.com/njayp/ophis
2

Register the ophis MCP command with your root Cobra command

In your CLI's main.go or command setup, import ophis and call its enable function to attach the mcp subcommand to your root command.

import "github.com/njayp/ophis"

// In your root command setup:
ophisCmd := ophis.NewCommand(rootCmd, ophis.Config{
    CommandName: "mcp",
})
rootCmd.AddCommand(ophisCmd)
3

Build your CLI with the new mcp subcommand

Recompile your CLI. It now has an 'mcp' subcommand with start, stream, tools, and editor integration subcommands.

go build -o my-cli .
4

Enable the MCP server for Claude Desktop

Use the built-in claude integration subcommand to register your CLI as an MCP server in Claude Desktop's config.

./my-cli mcp claude enable
# Then restart Claude Desktop
5

Or configure manually in claude_desktop_config.json

Alternatively, add the server manually to your MCP client configuration file.

{
  "mcpServers": {
    "my-cli": {
      "command": "/absolute/path/to/my-cli",
      "args": ["mcp", "start"],
      "env": {}
    }
  }
}
6

For remote access, stream the MCP server over HTTP

Use the stream subcommand to expose your CLI's MCP tools over HTTP for remote or shared access.

./my-cli mcp stream --host localhost --port 8080

Ophis Examples

Client configuration

Claude Desktop JSON config for a Cobra CLI named my-cli converted to an MCP server with ophis.

{
  "mcpServers": {
    "my-cli": {
      "command": "/usr/local/bin/my-cli",
      "args": ["mcp", "start"],
      "env": {}
    }
  }
}

Prompts to try

Example prompts once your Cobra CLI is exposed as an MCP server via ophis.

- "List all the tools available from my-cli."
- "Run the deploy subcommand with environment=staging and version=1.2.3."
- "Use my-cli to check the status of the production environment."
- "Export the available MCP tools from my-cli as a JSON schema."
- "Enable my-cli for use in VS Code via the MCP integration."

Troubleshooting Ophis

The mcp subcommand does not appear after adding ophis

Ensure you called rootCmd.AddCommand(ophisCmd) in your command setup before calling rootCmd.Execute(). Rebuild the binary after making the change and run './my-cli --help' to verify the mcp subcommand appears.

Some CLI flags are not appearing as MCP tool parameters

Ophis uses Selectors to control which commands and flags are exposed. By default it exposes all commands and flags. If you customized the Config with CmdSelector, LocalFlagSelector, or InheritedFlagSelector, review those filters to ensure the desired flags are included.

Claude Desktop does not pick up the enabled MCP server after running 'mcp claude enable'

The 'mcp claude enable' command modifies Claude Desktop's config file. You must fully restart Claude Desktop (quit and reopen) for the changes to take effect. Check the config file at ~/Library/Application Support/Claude/claude_desktop_config.json to confirm the entry was added.

Frequently Asked Questions about Ophis

What is Ophis?

Ophis is a Model Context Protocol (MCP) server that transform any cobra cli into an mcp server It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Ophis?

Follow the installation instructions on the Ophis GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with Ophis?

Ophis works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is Ophis free to use?

Yes, Ophis is open source and available under the Apache-2.0 license. You can use it freely in both personal and commercial projects.

Browse More Developer Tools MCP Servers

Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "ophis": { "command": "npx", "args": ["-y", "ophis"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use Ophis?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides