Files
Artemis-Eapil/mcp_server/base.py
T
somew1nd 9e5aee85c8 fix(mcp): auto-register tools on startup and support cross-platform setup for all major AI IDEs
- Fix missing mcp_server.tools import on server initialization so mobile_run_task, mobile_manage_task, mobile_get_device_state, and mobile_inspect_trace are automatically registered.

- Inject PYTHONPATH in generated and installed MCP configurations to guarantee Python module resolution across Windows, macOS, and Linux regardless of IDE CWD.

- Expand artemis mcp --install and --generate-config to support VS Code, Cline, Roo Code, Claude Code CLI (~/.claude.json), Cursor, Windsurf, Antigravity, and OpenClaw.

- Enhance config file merging with robust exception handling and fallback initialization.
2026-08-18 17:49:47 -07:00

40 lines
1.5 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."""
from mcp.server.fastmcp import FastMCP
try:
from mcp.server.fastmcp.server import Settings as FastMCPSettings
FastMCPSettings.model_rebuild()
except Exception:
pass
# Define the shared FastMCP instance for external IDE and agent clients.
mcp = FastMCP(
"artemis",
instructions=(
"ARTEMIS is an autonomous mobile AI agent and Android UI automation engine. "
"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, "
"and mobile_inspect_trace to inspect detailed execution steps and visual action overlays."
),
)
# Import tools so they are registered with the mcp instance upon module load
import mcp_server.tools # noqa: E402, F401