Skip to main content
Glama

codex-advisor

OpenAI Codex CLI に Claude Code の advisor 相当の「セカンドオピニオン」を追加する 個人用 MCP サーバー。既定では、ChatGPT でログイン済みの Codex CLI を介して GPT を利用する。Codex CLI の ChatGPT認証またはAPIキー認証、OpenAI API・Claude・Gemini、および OpenAI 互換エンドポイントの任意モデルにも切り替えられる。

公開範囲と利用条件

このリポジトリは公開準備中の実験的な個人用ツールです。公開しても、現時点で マルチユーザー対応、互換性の保証、運用サポート SLA は提供しません。

ライセンス: この個人開発ではライセンスを付与していません。リポジトリには LICENSE ファイルを含めていません。

Related MCP server: LLM Council MCP

セットアップ

前提: Python 3.12以上、uv、Codex CLI 0.144.1以上。codex/ providerは 既定でChatGPTログインを使う。

bash install.sh                # advisor.toml / advisor.env 作成 + MCP 登録 + AGENTS.md 誘導
codex login status             # ChatGPT認証を使う場合に確認
vi ~/.codex/advisor.env        # API provider または Codex API認証で使うキーを記入

install.sh は既存の advisor.toml を上書きしない。旧版から移行する場合は、 下記の model を手動で変更する。

使い方

  • Codex が計画前・エラー反復時・完了宣言前に自動で consult_advisor を呼ぶ

  • 手動相談: 「advisor に相談して」

  • ChatGPT認証のGPT: model = "codex/gpt-5.6-sol"(既定)

  • Codex APIキーのGPT: model = "codex/gpt-5.6-sol" に加えて、下記の [providers.codex] を設定

  • OpenAI API: model = "openai/<Chat Completions 対応モデル ID>"

  • モデル切替: 「advisor を codex/gpt-5.6-sol にして」(または ~/.codex/advisor.tomlmodel = を編集)

  • 無効化: 「advisor を off にして」または advisor.tomlenabled = false

codex/openai/ は同居できる。codex/ は隔離した Codex CLI 経由で、認証方式を chatgpt(既定)または api から明示的に選ぶ。openai/ は直接HTTP呼び出しで OPENAI_API_KEY を使う。1回の相談では model が示す一方だけを使い、認証失敗時に 別の認証方式や openai/ へ自動フォールバックしない。

設定 (~/.codex/advisor.toml)

enabled = true
model = "codex/gpt-5.6-sol"            # "<provider>/<model>"。モデル名は無検証
max_context_chars = 400000            # advisor に渡す会話の上限(古い方から切り詰め)
max_consults_per_session = 20         # セッションあたり相談回数上限
reasoning = "medium"      # 任意: low/medium/high/xhigh。デフォルトは medium。reasoning = "" でプロバイダ既定に戻せる

# Codex CLI のAPIキー認証を使う場合だけ指定(ChatGPT認証が既定)
[providers.codex]
auth_method = "api"                    # chatgpt または api
api_key_env = "OPENAI_API_KEY"         # 省略時はCodex CLI保存済み認証を使う

# OpenAI 互換エンドポイントの追加例(OpenRouter / ollama など)
[providers.openrouter]
kind = "openai"
base_url = "https://openrouter.ai/api/v1"
api_key_env = "OPENROUTER_API_KEY"

advisor.toml は相談ごとに読み直すため、モデル切替にMCP再起動は不要。 advisor.env はMCP起動時にだけ読むため、APIキーの追加・変更後はCodexセッションを 再起動する。

xhighcodex/openai/ providerで利用できる。選択モデルが非対応の場合は 下流のCodex CLIまたはAPIがエラーを返し、値を自動変更しない。Anthropic/Geminiでは 意味の異なる値へ推測変換せず、相談実行前に明示的な非対応エラーを返す。

セキュリティ

API キーは ~/.codex/advisor.env のみに置く。ChatGPT認証の codex/ 子プロセスには advisor用credentialを渡さない。API認証の codex/ では、設定した api_key_env の 値だけを子プロセス用の CODEX_API_KEY として渡し、それ以外のcredentialは除去する。 環境変数を指定しない場合は、Codex CLIの codex login --with-api-key で保存した認証を使う。 api_key_env を指定した場合、その変数が未設定なら保存済み認証へ切り替えずエラーにする。 子Codexは 一時directory、read-only sandbox、ephemeral sessionで実行し、shell・Web・MCP・ app・subagent等を無効化する。APIエラーに含まれる選択providerのキー値は伏せ字化する。

データ送信: consult_advisor は、現在のセッションから復元した user/assistant メッセージ、 tool call、tool result を、設定された advisor provider に送信します。codex/ では ログイン中のChatGPT workspace、API providerでは各APIアカウントのデータ処理条件が 適用されます。transcript の秘密情報は自動除去されません。

開発

uv run pytest -q          # テスト
uv run ruff check src tests && uv run pyright   # lint+型

Available Tools

2 tools
advisor_configA

Get or change advisor settings. Use when the user asks.

action='get' shows current settings. action='set' changes the advisor model; pass model as '/', e.g. 'codex/gpt-5.6-sol', 'openai/gpt-5.2', 'anthropic/claude-opus-4-8', 'gemini/gemini-2.5-pro'. Any model name is accepted (no allowlist). action='off' disables consultations.

ParametersJSON Schema
NameRequiredDescriptionDefault
modelNo
actionYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It clearly discloses the three supported actions, the exact model format with examples, and the notable fact that any model is accepted with no allowlist. It does not detail persistence or side effects of 'set'/'off', but the core behavior is transparent and useful.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and front-loaded, but the sentence 'Use when the user asks' is vague filler that doesn't earn its place. The inline examples, while long, are valuable for establishing the model format. Overall it remains appropriately concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (multiple actions, a model parameter with format requirements) and the presence of an output schema, the description covers the essential usage points well. It could be more complete by explicitly referencing the sibling tool's role, but nothing critical is missing for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, yet the description fully compensates. It explains the valid values for 'action', the required model format for 'set', and that the model parameter is needed only in that case, plus examples of acceptable formats. This adds substantial meaning beyond the raw schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb+resource: 'Get or change advisor settings,' which clearly identifies the tool's domain. It further details distinct actions ('get', 'set', 'off') and confirms this is about configuration, which distinguishes it from the sibling 'consult_advisor' without being explicit.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The phrase 'Use when the user asks' is generic and provides no concrete decision guidance. The action descriptions imply usage (get vs. set vs. off), but the tool never explicitly contrasts itself with the sibling 'consult_advisor' or states when not to use it, leaving the comparison to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

consult_advisorA

Consult the configured advisor model for strategic guidance.

Call this at decision points: before committing to a non-trivial plan, when the same error persists after two fix attempts, or before declaring a complex task complete. The current session transcript is attached automatically; put the specific decision to evaluate in question.

ParametersJSON Schema
NameRequiredDescriptionDefault
questionYes
context_hintNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the burden of disclosing behavior. It adds a key behavioral detail: 'The current session transcript is attached automatically,' which clarifies input handling. However, it does not disclose the output format, potential side effects, or any restrictions, leaving the safety profile somewhat opaque.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded, with the core purpose in the first sentence. The subsequent usage guidance adds valuable, non-redundant detail without wasting words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple, has an output schema to cover return values, and the description provides purpose, usage triggers, and a key behavioral trait. It is slightly incomplete due to the undocumented 'context_hint' parameter, but overall it is sufficiently complete for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must compensate. It explains the 'question' parameter well ('put the specific decision to evaluate in question'), but the optional 'context_hint' parameter is not mentioned at all, leaving a gap for the second parameter.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Consult the configured advisor model for strategic guidance.' It uses a specific verb and resource, and distinguishes itself from the sibling 'advisor_config' by focusing on querying the advisor rather than configuring it.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly lists when to call the tool: at decision points, after repeated errors, or before declaring a complex task complete. It provides clear context but does not mention when not to use it or name alternative tools, so it stops short of a full 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 2 tool updatesv0.2.0
    • First observedadvisor_config
    • First observedconsult_advisor

TDQS

A4/5.0
Disambiguation5/5

The two tools are completely distinct: one performs a consultation, the other manages configuration. No overlap or ambiguity exists between them.

Naming Consistency3/5

Tool names use different patterns: 'consult_advisor' follows verb_noun, while 'advisor_config' is noun_noun. The inconsistency is noticeable but both names are clear and self-explanatory.

Tool Count3/5

With only 2 tools, the set feels thin but is appropriate for the narrow scope of advisor consultation and configuration. It covers the essential actions without unnecessary bloat.

Completeness4/5

The domain of consulting and configuring an advisor is well-covered. A minor gap is the lack of consultation history or logging, but for the stated purpose (strategic guidance and settings) the surface is essentially complete.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tonny-lec/codex-advisor'

If you have feedback or need assistance with the MCP directory API, please join our Discord server