
njayp/ophis
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
njayp/ophis は [https://github.com/njayp/ophis.] からインポートされた MCP サーバーの候補です
概要
njayp/ophis は [https://github.com/njayp/ophis.] からインポートされた MCP サーバーの候補です
概要(AI 翻訳)
Cobra CLIをMCPサーバーに変換
Ophis は、Cobra コマンドを MCP ツールに自動的に変換し、Claude デスクトップ、VSCode、および Cursor と統合するための CLI コマンドを提供します。
クイックスタート
インストール
##CLIに追加
##Claude デスクトップ、VSCode、または Cursor で有効
MCP ツールとして CLI コマンドが使用可能になりました!
ストリームオーバー HTTP
リモートアクセスのための HTTP 上で MCP サーバーを公開します。
コマンド
[ophis.Command(nil)] は、これらのサブコマンドを CLI に追加します (デフォルトのコマンド名は mcp]] で設定できます)。
設定
セレクターを使用して、コマンドとフラグが MCP ツールとして公開されるように制御します。 デフォルトでは、すべてのコマンドとフラグが露出されます(非表示/非推奨を除く)。
カスタムコマンド名
デフォルトでは、 ophis コマンドは [mcp] と表示されます。 CLI が mcp を既に使用している場合、衝突を避けるために [CommandName を設定してください。
コマンドツリー、エディタコンフィグ(enable)/[disable])、および内部フィルタは、設定された名前を自動的に使用します。
デフォルト環境変数
エディタは、最小限の環境でMCPサーバーのサブプロセスを起動します.
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
README
以下は原文 README の抜粋です。原文を見る。
Transform any Cobra CLI into an MCP server
Ophis automatically converts your Cobra commands into MCP tools, and provides CLI commands for integration with Claude Desktop, VSCode, and Cursor.
Quick Start
Install
go get github.com/njayp/ophis
Add to your CLI
package main
import (
"os"
"github.com/njayp/ophis"
)
func main() {
rootCmd := createMyRootCommand()
rootCmd.AddCommand(ophis.Command(nil))
if err := rootCmd.Execute(); err != nil {
os.Exit(1)
}
}
Enable in Claude Desktop, VSCode, or Cursor
# Claude Desktop
./my-cli mcp claude enable
# Restart Claude Desktop
# VSCode (requires Copilot in Agent Mode)
./my-cli mcp vscode enable
# Cursor
./my-cli mcp cursor enable
Your CLI commands are now available as MCP tools!
Stream over HTTP
Expose your MCP server over HTTP for remote access:
./my-cli mcp stream --host localhost --port 8080
Commands
The ophis.Command(nil) adds these subcommands to your CLI (the default command name is mcp, configurable via Config.CommandName):
mcp
├── start # Start MCP server on stdio
├── stream # Stream MCP server over HTTP
├── tools # Export available MCP tools as JSON
├── claude
│ ├── enable # Add server to Claude Desktop config
│ ├── disable # Remove server from Claude Desktop config
│ └── list # List Claude Desktop MCP servers
├── vscode
│ ├── enable # Add server to VSCode config
│ ├── disable # Remove server from VSCode config
│ └── list # List VSCode MCP servers
└── cursor
├── enable # Add server to Cursor config
├── disable # Remove server from Cursor config
└── list # List Cursor MCP servers
Configuration
Control which commands and flags are exposed as MCP tools using selectors. By default, all commands and flags are exposed (except hidden/deprecated).
config := &ophis.Config{
Selectors: []ophis.Selector{
{
CmdSelector: ophis.AllowCmdsContaining("get", "list"),
LocalFlagSelector: ophis.ExcludeFlags("token", "secret"),
InheritedFlagSelector: ophis.NoFlags, // Exclude persistent flags
// Middleware wraps command execution
Middleware: func(ctx context.Context, req *mcp.CallToolRequest, in ophis.ToolInput, next func(context.Context, *mcp.CallToolRequest, ophis.ToolInput) (*mcp.CallToolResult, ophis.ToolOutput, error)) (*mcp.CallToolResult, ophis.ToolOutput, error) {
ctx, cancel := context.WithTimeout(ctx, time.Minute)
defer cancel()
return next(ctx, req, in)
},
},
},
}
rootCmd.AddCommand(ophis.Command(config))
Custom Command Name
By default the ophis command is named mcp. If your CLI already uses mcp for something else, set CommandName to avoid the collision:
インストール
This server does not publish a one-line install command.
Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →