Skip to content

Commit 47da97a

Browse files
abrichrClaude
and
Claude
committed
Improve OmniParser deployment and configuration options
- Add auto-deploy functionality with user confirmation - Add skip-confirmation flag to deploy without prompting - Add TODO for simplified AWS configuration in the future - Update documentation with new options and deployment scenarios - Expand README with detailed OmniParser configuration instructions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 22ac392 commit 47da97a

File tree

3 files changed

+83
-13
lines changed

3 files changed

+83
-13
lines changed

omnimcp/README.md

+24-2
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,15 @@ omnimcp debug
7272
# Connect to a remote OmniParser server
7373
omnimcp cli --server-url=https://your-omniparser-server.example.com
7474

75+
# Deploy OmniParser automatically without confirming
76+
omnimcp cli --auto-deploy-parser --skip-confirmation
77+
7578
# Allow running even if OmniParser isn't available (limited functionality)
7679
omnimcp cli --allow-no-parser
7780

81+
# Disable automatic OmniParser deployment attempt
82+
omnimcp cli --auto-deploy-parser=False
83+
7884
# With additional options
7985
omnimcp cli --use-normalized-coordinates
8086
omnimcp debug --debug-dir=/path/to/debug/folder
@@ -89,11 +95,27 @@ OmniMCP requires access to an OmniParser server for analyzing screenshots:
8995
omnimcp cli --server-url=https://your-omniparser-server.example.com
9096
```
9197

92-
2. **Use the Default Local Server**
98+
2. **Auto-Deploy OmniParser** (Convenient but requires AWS credentials)
99+
- By default, OmniMCP will offer to deploy OmniParser if not available
100+
- You can control this behavior with these flags:
101+
```bash
102+
# Deploy without asking for confirmation
103+
omnimcp cli --auto-deploy-parser --skip-confirmation
104+
105+
# Disable auto-deployment completely
106+
omnimcp cli --auto-deploy-parser=False
107+
```
108+
109+
3. **Use the Default Local Server**
93110
- OmniMCP will try to connect to `http://localhost:8000` by default
94111
- This requires running an OmniParser server locally
95112

96-
By default, OmniMCP will fail if it can't connect to an OmniParser server. Use the `--allow-no-parser` flag to run with limited functionality when no parser is available.
113+
4. **Run Without OmniParser** (Limited functionality)
114+
- Use the `--allow-no-parser` flag to run even without OmniParser
115+
- Claude will only see raw screenshots without UI element detection
116+
```bash
117+
omnimcp cli --allow-no-parser
118+
```
97119

98120
### Future Direction: Anthropic ComputerUse Integration
99121

openadapt/omnimcp.py

+35-5
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,9 @@ def __init__(
303303
server_url: Optional[str] = None,
304304
claude_api_key: Optional[str] = None,
305305
use_normalized_coordinates: bool = False,
306-
allow_no_parser: bool = False
306+
allow_no_parser: bool = False,
307+
auto_deploy_parser: bool = True,
308+
skip_confirmation: bool = False
307309
):
308310
"""Initialize OmniMCP.
309311
@@ -312,6 +314,8 @@ def __init__(
312314
claude_api_key: API key for Claude (overrides config)
313315
use_normalized_coordinates: If True, use normalized (0-1) coordinates
314316
allow_no_parser: If True, continue even if OmniParser is not available
317+
auto_deploy_parser: If True, attempt to deploy OmniParser if not available
318+
skip_confirmation: If True, skip user confirmation for deployment
315319
"""
316320
self.omniparser = OmniParserProvider(server_url)
317321
self.visual_state = VisualState()
@@ -330,13 +334,39 @@ def __init__(
330334

331335
# Ensure OmniParser is running
332336
if not self.omniparser.is_available():
333-
logger.info("OmniParser not available, attempting to deploy...")
334-
self.omniparser.deploy()
337+
# Inform user about missing OmniParser
338+
if auto_deploy_parser:
339+
# Get user confirmation if needed
340+
deploy_confirmed = skip_confirmation
341+
# TODO: Implement a simplified AWS configuration process
342+
# Create an OpenAdapt.AI API key generation system that eliminates the need
343+
# for users to manually configure AWS_SECRET_ACCESS_KEY and AWS_ACCESS_ID
344+
if not skip_confirmation:
345+
user_input = input(
346+
"\nOmniParser is not available. Would you like to deploy it now? [y/N]: "
347+
).lower()
348+
deploy_confirmed = user_input in ["y", "yes"]
349+
350+
# Attempt to deploy OmniParser if confirmed
351+
if deploy_confirmed:
352+
logger.info("Deploying OmniParser service...")
353+
deploy_success = self.omniparser.deploy()
354+
if deploy_success:
355+
logger.info("OmniParser deployed successfully.")
356+
else:
357+
logger.error("Failed to deploy OmniParser.")
358+
elif not allow_no_parser:
359+
# User declined deployment and allow_no_parser isn't set
360+
raise RuntimeError(
361+
"OmniParser deployment was declined. Please ensure it's running, "
362+
"use --auto-deploy-parser, or use --allow-no-parser flag."
363+
)
335364

336-
# Check again after deployment attempt
365+
# Final check after deployment attempt
337366
if not self.omniparser.is_available() and not allow_no_parser:
338367
raise RuntimeError(
339-
"OmniParser server is not available. Please ensure it's running or use --allow-no-parser flag."
368+
"OmniParser server is not available. Please ensure it's running, "
369+
"use --auto-deploy-parser, or use --allow-no-parser flag."
340370
)
341371

342372
def update_visual_state(self) -> VisualState:

openadapt/run_omnimcp.py

+24-6
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ def cli(
6868
claude_api_key=None,
6969
use_normalized_coordinates=False,
7070
debug_dir=None,
71-
allow_no_parser=False
71+
allow_no_parser=False,
72+
auto_deploy_parser=True,
73+
skip_confirmation=False
7274
):
7375
"""Run OmniMCP in CLI mode.
7476
@@ -87,13 +89,17 @@ def cli(
8789
use_normalized_coordinates: Use normalized (0-1) coordinates instead of pixels
8890
debug_dir: Directory to save debug visualizations
8991
allow_no_parser: If True, continue even if OmniParser is not available
92+
auto_deploy_parser: If True, attempt to deploy OmniParser if not available (default: True)
93+
skip_confirmation: If True, skip user confirmation for OmniParser deployment
9094
"""
9195
# Create OmniMCP instance
9296
omnimcp = OmniMCP(
9397
server_url=server_url,
9498
claude_api_key=claude_api_key, # Will use config.ANTHROPIC_API_KEY if None
9599
use_normalized_coordinates=use_normalized_coordinates,
96-
allow_no_parser=allow_no_parser
100+
allow_no_parser=allow_no_parser,
101+
auto_deploy_parser=auto_deploy_parser,
102+
skip_confirmation=skip_confirmation
97103
)
98104

99105
# Handle debug directory if specified
@@ -119,7 +125,9 @@ def server(
119125
claude_api_key=None,
120126
use_normalized_coordinates=False,
121127
debug_dir=None,
122-
allow_no_parser=False
128+
allow_no_parser=False,
129+
auto_deploy_parser=True,
130+
skip_confirmation=False
123131
):
124132
"""Run OmniMCP as an MCP server.
125133
@@ -140,13 +148,17 @@ def server(
140148
use_normalized_coordinates: Use normalized (0-1) coordinates instead of pixels
141149
debug_dir: Directory to save debug visualizations
142150
allow_no_parser: If True, continue even if OmniParser is not available
151+
auto_deploy_parser: If True, attempt to deploy OmniParser if not available (default: True)
152+
skip_confirmation: If True, skip user confirmation for OmniParser deployment
143153
"""
144154
# Create OmniMCP instance
145155
omnimcp = OmniMCP(
146156
server_url=server_url,
147157
claude_api_key=claude_api_key, # Will use config.ANTHROPIC_API_KEY if None
148158
use_normalized_coordinates=use_normalized_coordinates,
149-
allow_no_parser=allow_no_parser
159+
allow_no_parser=allow_no_parser,
160+
auto_deploy_parser=auto_deploy_parser,
161+
skip_confirmation=skip_confirmation
150162
)
151163

152164
# Handle debug directory if specified
@@ -172,7 +184,9 @@ def debug(
172184
claude_api_key=None,
173185
use_normalized_coordinates=False,
174186
debug_dir=None,
175-
allow_no_parser=False
187+
allow_no_parser=False,
188+
auto_deploy_parser=True,
189+
skip_confirmation=False
176190
):
177191
"""Run OmniMCP in debug mode.
178192
@@ -190,13 +204,17 @@ def debug(
190204
use_normalized_coordinates: Use normalized (0-1) coordinates instead of pixels
191205
debug_dir: Directory to save debug visualizations
192206
allow_no_parser: If True, continue even if OmniParser is not available
207+
auto_deploy_parser: If True, attempt to deploy OmniParser if not available (default: True)
208+
skip_confirmation: If True, skip user confirmation for OmniParser deployment
193209
"""
194210
# Create OmniMCP instance
195211
omnimcp = OmniMCP(
196212
server_url=server_url,
197213
claude_api_key=claude_api_key, # Will use config.ANTHROPIC_API_KEY if None
198214
use_normalized_coordinates=use_normalized_coordinates,
199-
allow_no_parser=allow_no_parser
215+
allow_no_parser=allow_no_parser,
216+
auto_deploy_parser=auto_deploy_parser,
217+
skip_confirmation=skip_confirmation
200218
)
201219

202220
# Create debug directory if not specified

0 commit comments

Comments
 (0)