Files
Artemis-Eapil/mcp_server/base.py
chenmingxuan e1ea099592 feat: add official Codex skill and harden task execution
Install and update artemis-use with task diagnostics and plugin guidance. Preserve cross-device file receipts, review canonical reports, guard stage transitions and reduce small history summaries. Improve exploration lifecycle, request recovery and browser live connections.
2026-10-18 14:18:37 +08:00

56 lines
2.9 KiB
Python

# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Shared FastMCP instance definition for the mobile automation MCP server."""
import logging
from mcp.server.fastmcp import FastMCP
logger = logging.getLogger(__name__)
try:
from mcp.server.fastmcp.server import Settings as FastMCPSettings
FastMCPSettings.model_rebuild()
except Exception as exc:
# Version-compat shim: older/newer FastMCP releases may not expose
# Settings or need the rebuild; the server works without it.
logger.debug("FastMCP Settings.model_rebuild skipped: %s", exc, exc_info=True)
# Define the shared FastMCP instance for external IDE and agent clients.
mcp = FastMCP(
"artemis",
instructions=(
"ARTEMIS executes Android, computer and mixed tests with Flash, Pro or interactive exploration. The user starts the service; MCP only connects. Use the official artemis-use Skill for workflows and plugin development. "
"For the full workflow use mobile_workspace (devices/queue), mobile_config (non-secret saved defaults), "
"mobile_task_file (XLSX template/preview), mobile_batch (JSON cases + execution), "
"mobile_search_history and mobile_export_report (Word/Excel/ZIP). "
"For interactive test design use mobile_exploration: one conversation, user guidance, "
"recorded demonstrations, resumable active-time limits and versioned cases for Flash/Pro. "
"Task action replay is unavailable; trace inspection is read-only. "
"Use mobile_run_task to launch autonomous UI workflows on connected Android devices or emulators, "
"mobile_manage_task to check status or steer execution, "
"mobile_get_device_state to inspect real-time device screen/hierarchy, "
"mobile_inspect_trace for bounded report/usage/request/log/evidence inspection and step screenshots; use stable request_id for task submission and lookup uncertain replies, "
"and mobile_diagnose whenever a tool errors, no device is found, or the user says "
"ARTEMIS is not working: it checks the environment and returns ordered fix steps."
),
)
# Tool registration is intentionally NOT done here: mcp_server/__init__.py
# imports mcp_server.tools (which imports this module), so importing this
# module from anywhere already registers every tool. Importing tools here as
# well would create a circular import (base -> tools -> base).