Hugging Face リモートMCPを OpenAI Codex CLI にMCP接続する方法(設定手順)
Hugging Face のリモートMCPサーバーを OpenAI Codex CLI に約1分でMCP接続。OAuth / 401 の問題は先に OAuth 2.1 デバッガーで確認できます。
🔒 Client-side only — never leaves your browser.
Or add to ~/.cursor/mcp.json:
{
"mcpServers": {
"huggingface": {
"url": "https://huggingface.co/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}claude mcp add --transport http huggingface https://huggingface.co/mcp
With credential header:
claude mcp add --transport http huggingface https://huggingface.co/mcp --header "Authorization: Bearer YOUR_API_KEY"
Or add to .vscode/mcp.json:
{
"servers": {
"huggingface": {
"type": "http",
"url": "https://huggingface.co/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}- Open Settings → Connectors (Integrations) → Add Custom Connector.
- Paste the endpoint URL:
https://huggingface.co/mcp - Provide your API key / Bearer token when prompted.
Bridge the remote endpoint into stdio with mcp-remote in claude_desktop_config.json:
{
"mcpServers": {
"huggingface": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://huggingface.co/mcp",
"--header",
"Authorization: Bearer YOUR_API_KEY"
]
}
}
}Add to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"huggingface": {
"serverUrl": "https://huggingface.co/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}Add to ~/.kiro/settings/mcp.json (or .kiro/settings/mcp.json in your workspace), then reopen Kiro's Agent panel to pick up the server:
{
"mcpServers": {
"huggingface": {
"url": "https://huggingface.co/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}Add to ~/.codex/config.toml — Codex reads remote HTTP servers from [mcp_servers.*] tables:
[mcp_servers.huggingface] url = "https://huggingface.co/mcp" bearer_token_env_var = "HUGGINGFACE_TOKEN"
Add to cline_mcp_settings.json (Cline → MCP Servers → Configure), or paste it via Cline's MCP marketplace file:
{
"mcpServers": {
"huggingface": {
"type": "streamableHttp",
"url": "https://huggingface.co/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}Add to ~/.gemini/settings.json under mcpServers — httpUrl for Streamable HTTP, url for legacy SSE:
{
"mcpServers": {
"huggingface": {
"httpUrl": "https://huggingface.co/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}接続手順
- TOML を編集 —
~/.codex/config.tomlに[mcp_servers.huggingface]とurl = "https://huggingface.co/mcp"を追記します。 - 資格情報を設定 —
bearer_token_env_var = "HUGGINGFACE_TOKEN"を追加し、同名の環境変数にキーを export します。 - 検証 — オンライン Inspector に
https://huggingface.co/mcpを貼り付け、initialize と tools/list を実行して接続を確認します。
🧰 ツール一覧(12)
| Tool | Safety | Description | Parameters |
|---|---|---|---|
| hf_doc_search ~31 tok | 🟢 Read | Search Hugging Face documentation. | — |
| hf_doc_fetch ~30 tok | 🟢 Read | Fetch a Hugging Face docs page. | — |
| model_search ~29 tok | 🟢 Read | Search models on the Hub. | — |
| dataset_search ~30 tok | 🟢 Read | Search datasets on the Hub. | — |
| space_search ~29 tok | 🟢 Read | Search Spaces on the Hub. | — |
| paper_search ~29 tok | 🟢 Read | Search papers on the Hub. | — |
| hub_repo_details ~31 tok | 🟢 Read | Get details of a Hub repository. | — |
| hf_whoami ~29 tok | 🟢 Read | Get the authenticated HF user. | — |
| space_info ~28 tok | 🟢 Read | Get details of a Space. | — |
| use_space ~28 tok | 🟠 Write | Call a Hugging Face Space. | — |
| model_info ~27 tok | 🟢 Read | Get model card info. | — |
| dataset_info ~28 tok | 🟢 Read | Get dataset card info. | — |