mirror of
https://github.com/BerriAI/litellm.git
synced 2026-12-05 01:59:27 +00:00
Codex treats an MCP server that is not marked required as optional and gives it a one-second startup grace. When the server is still starting after that, Codex sends the turn without its tools. The Python vault server often takes longer than that on a busy runner, so the resumed turn went out with no read_secret tool. Claude then called the name it saw in history, mcp__vault__read_secret, the gateway had no namespace to map it back to, and Codex answered "unsupported call". GPT models said the tool was unavailable instead. Marking the server required makes Codex wait for it to start.
36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
from __future__ import annotations
|
|
|
|
import time
|
|
import tomllib
|
|
from pathlib import Path
|
|
from typing import Final
|
|
|
|
from cli_harness.rate_limiter import RateBucket, RateLimiter
|
|
from codex.harness import McpServer, codex_harness
|
|
|
|
|
|
def test_an_added_mcp_server_is_a_table_codex_reads_next_to_the_gateway_provider(tmp_path: Path) -> None:
|
|
server: Final = McpServer(
|
|
command='/opt/py "3.14"/bin/python',
|
|
args=("C:\\tools\\mcp_server.py", "--flag"),
|
|
env={"SECRET_FILE": "/tmp/a dir/secret.txt", "OTHER": "x"},
|
|
)
|
|
with codex_harness(
|
|
gateway="http://127.0.0.1:4000",
|
|
api_key="unused",
|
|
rate_bucket=RateBucket.OPENAI,
|
|
limiter=RateLimiter({}, tmp_path, time.monotonic, time.sleep),
|
|
) as codex:
|
|
codex.add_mcp_server("vault", server)
|
|
config: Final = tomllib.loads((codex.codex_home / "config.toml").read_text())
|
|
|
|
assert config["model_provider"] == "litellm"
|
|
assert config["mcp_servers"] == {
|
|
"vault": {
|
|
"command": server.command,
|
|
"args": list(server.args),
|
|
"env": dict(server.env),
|
|
"default_tools_approval_mode": "approve",
|
|
"required": True,
|
|
}
|
|
}
|