Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The official Model Context Protocol plugin for [Infernux](https://github.com/Che

New Infernux projects include this official plugin by default. Existing projects can install or update it from the Editor's **Plugins** window. You can disable or uninstall it there when agent access is not needed.

The Editor writes standard stdio client configurations for Cursor, Claude Code, VS Code, Trae and Gemini. Their small proxy forwards to `http://127.0.0.1:9713/mcp` and reads the current user's private credential for every request, including after an Editor restart. It does not initialize the engine. Direct HTTP clients must send a bearer credential; the built-in Python client handles this automatically. No credential is stored in project files, process arguments, or environment variables. Set `INFERNUX_MCP_PORT` before starting the Editor to choose another loopback port.
Point an MCP-compatible client to `http://127.0.0.1:9713/mcp`; no credential is needed. The Editor also writes ready-to-use client configurations for Cursor, Claude Code, VS Code, Trae and Gemini. The server accepts localhost connections only, and all capabilities are granted by default (narrow them in `ProjectSettings/mcp_capabilities.json`). Set `INFERNUX_MCP_PORT` before starting the Editor to choose another loopback port.

Start a session with `host_session_status`, then read `operation_schema_list`. Search the catalog with `operation_schema_search`, inspect the exact schema you need, and call it through `operation_command_execute`. Long-running builds belong in `operation_job_submit`; known ordered calls can be grouped with `operation_batch_execute`.

Expand Down
2 changes: 1 addition & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

Infernux 新项目默认带有这个官方插件。已有项目可以在编辑器的**插件**窗口中安装或更新;不需要 Agent 操作时,也可以在同一位置禁用或卸载。

编辑器为 Cursor、Claude Code、VS Code、Trae 和 Gemini 生成标准 stdio 配置。轻量代理把请求转发至 `http://127.0.0.1:9713/mcp`,每次请求读取当前用户的私有凭据,编辑器重启后也会使用新凭据;代理不会初始化引擎。直接连接 HTTP 的客户端必须携带 bearer 凭据,内置 Python 客户端会自动处理。凭据不会写入项目文件、进程参数或环境变量。如需更换端口,请在启动编辑器前设置 `INFERNUX_MCP_PORT`。
把支持 MCP 的客户端连接到 `http://127.0.0.1:9713/mcp` 即可,不需要凭据。编辑器也会为 Cursor、Claude Code、VS Code、Trae 和 Gemini 写好现成的客户端配置。服务只接受本机连接,默认授予全部能力(可在 `ProjectSettings/mcp_capabilities.json` 中收窄)。如需更换端口,请在启动编辑器前设置 `INFERNUX_MCP_PORT`。

Agent 应先调用 `host_session_status`,再读取 `operation_schema_list`。通过 `operation_schema_search` 找到所需能力、读取准确 schema,最后用 `operation_command_execute` 执行。构建等耗时任务使用 `operation_job_submit`,一组顺序明确的操作可以交给 `operation_batch_execute`,减少通信往返。

Expand Down
19 changes: 0 additions & 19 deletions package/editor/infernux_mcp/bridge.py

This file was deleted.

41 changes: 3 additions & 38 deletions package/editor/infernux_mcp/capabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,43 +16,9 @@

VALID_PROFILES = frozenset({"developer_assist", "global_validation"})

# Capability domains served by the built-in operation set. The default grant
# is an explicit enumeration instead of "*": the persisted project config
# shows the user exactly what the agent may touch, grants can be trimmed per
# project, and capabilities added by future operation domains are never
# granted silently. test_mcp_server guards this list against drift.
READ_CAPABILITY_DOMAINS = (
"asset",
"camera",
"capture",
"console",
"docs",
"input",
"material",
"particle",
"player",
"project",
"runtime",
"scene",
"session",
"ui",
)
WRITE_CAPABILITY_DOMAINS = (
"asset",
"camera",
"capture",
"input",
"material",
"particle",
"player",
"runtime",
"scene",
"session",
"ui",
)
DEFAULT_GRANTED_CAPABILITIES: tuple[str, ...] = tuple(
f"{domain}.read" for domain in READ_CAPABILITY_DOMAINS
) + tuple(f"{domain}.write" for domain in WRITE_CAPABILITY_DOMAINS)
# MCP is a user-directed development tool: every capability is granted unless
# the project narrows granted_capabilities (fnmatch patterns, e.g. "*.read").
DEFAULT_GRANTED_CAPABILITIES: tuple[str, ...] = ("*",)

DEFAULT_CAPABILITY_CONFIG: dict[str, Any] = {
"enabled": True,
Expand Down Expand Up @@ -236,7 +202,6 @@ def _normalized_config(config: dict[str, Any]) -> dict[str, Any]:
raise ValueError("configuration must be a JSON object")
source = config
normalized = copy.deepcopy(DEFAULT_CAPABILITY_CONFIG)
normalized["granted_capabilities"] = []
for key in ("enabled", "write_default_config_on_bootstrap"):
if key in source:
_validate_value(key, source[key], bool)
Expand Down
14 changes: 1 addition & 13 deletions package/editor/infernux_mcp/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,6 @@ def create_loopback_client(endpoint: str, *, timeout_seconds: float | None = Non
import httpx
from fastmcp import Client
from fastmcp.client.transports.http import StreamableHttpTransport
if __package__:
from .credentials import load_token
else:
from credentials import load_token

class EditorCredentialAuth(httpx.Auth):
async def async_auth_flow(self, request):
request.headers["Authorization"] = f"Bearer {load_token(endpoint)}"
yield request

def http_client_factory(headers=None, auth=None, follow_redirects=True, timeout=None):
return httpx.AsyncClient(
Expand All @@ -52,10 +43,7 @@ def http_client_factory(headers=None, auth=None, follow_redirects=True, timeout=
trust_env=False,
)

transport = StreamableHttpTransport(
str(endpoint), auth=EditorCredentialAuth(),
httpx_client_factory=http_client_factory,
)
transport = StreamableHttpTransport(str(endpoint), httpx_client_factory=http_client_factory)
return Client(transport, timeout=timeout_seconds, init_timeout=timeout_seconds)


Expand Down
108 changes: 0 additions & 108 deletions package/editor/infernux_mcp/credentials.py

This file was deleted.

35 changes: 19 additions & 16 deletions package/editor/infernux_mcp/player_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import json
import os
import threading

from infernux.host import EditorAutomationHost, Operation, OperationError, OperationKind, resolve_project_path

Expand All @@ -13,6 +14,7 @@


_LOCAL_SUPERVISORS: dict[tuple[str, str], SupervisorSession] = {}
_LOCAL_SUPERVISORS_LOCK = threading.Lock()


def build_player_operations(project_path: str) -> tuple[Operation, ...]:
Expand Down Expand Up @@ -245,22 +247,23 @@ def _supervisor() -> SupervisorSession:
if active.build_profile != "debug_feedback":
raise OperationError("player.unavailable", "Player validation requires debug_feedback.")
key = (active.project_root, active.session_id)
supervisor = _LOCAL_SUPERVISORS.get(key)
if supervisor is None:
try:
supervisor = SupervisorSession.attach_current_host(
active.project_root,
active.session_id,
mode=active.mode,
build_profile=active.build_profile,
editor_instance_id=active.editor_instance_id,
mcp_host=os.environ.get("INFERNUX_MCP_HOST", "127.0.0.1"),
mcp_port=int(os.environ.get("INFERNUX_MCP_PORT", "9713")),
)
except (OSError, RuntimeError, ValueError) as exc:
raise OperationError("player.supervisor_attach", str(exc)) from exc
_LOCAL_SUPERVISORS[key] = supervisor
return supervisor
with _LOCAL_SUPERVISORS_LOCK:
supervisor = _LOCAL_SUPERVISORS.get(key)
if supervisor is None:
try:
supervisor = SupervisorSession.attach_current_host(
active.project_root,
active.session_id,
mode=active.mode,
build_profile=active.build_profile,
editor_instance_id=active.editor_instance_id,
mcp_host=os.environ.get("INFERNUX_MCP_HOST", "127.0.0.1"),
mcp_port=int(os.environ.get("INFERNUX_MCP_PORT", "9713")),
)
except (OSError, RuntimeError, ValueError) as exc:
raise OperationError("player.supervisor_attach", str(exc)) from exc
_LOCAL_SUPERVISORS[key] = supervisor
return supervisor


def _build(
Expand Down
Loading
Loading