feat: add caller-controlled MCP methods - #95
Open
HareeshBahuleyan wants to merge 3 commits into
Open
HareeshBahuleyan wants to merge 3 commits into
HareeshBahuleyan wants to merge 3 commits into
Conversation
Expose sync and async stored-server discovery and execution with public generated types, required server revisions, and MCP-specific typed errors. Use HTTPX's zero-retry transport instead of the generated urllib3 retry path. Preserve indeterminate outcomes and disable redirects; test request counts beneath the connection retry loop. Document approval boundaries, correlation-only execution IDs, cancellation, and the separate gateway endpoint-manifest follow-up. Fixes #65
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Typed errors currently rewrite the valid completed execution state to not_started, potentially misleading callers about retry safety.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Adds public synchronous and asynchronous caller-controlled MCP operations with single-attempt execution safeguards.
Changes:
- Adds MCP tool discovery and execution resources.
- Adds typed MCP errors and generated model exports.
- Adds extensive transport, authentication, and response tests.
| File | Description |
|---|---|
src/otari/mcp.py |
Implements sync and async MCP operations. |
src/otari/client.py |
Exposes the synchronous MCP resource. |
src/otari/async_client.py |
Exposes the asynchronous MCP resource. |
src/otari/errors.py |
Adds MCP-specific exceptions. |
src/otari/types.py |
Re-exports generated MCP models. |
src/otari/__init__.py |
Publishes MCP types and errors. |
tests/unit/test_mcp.py |
Tests MCP contracts and single-attempt behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Why
Applications need supported SDK methods to discover MCP tools and execute the exact caller-authorized call through Otari, without losing approval boundaries or indeterminate outcomes.
The auto-generated PR updates only
src/otari/_client/; this separate PR exposes those endpoints through the hand-written public SDK and adds the single-attempt execution guarantees and typed error handling that code generation does not provide.What changed
Add sync/async
mcp.list_tools(...)andmcp.execute(...)on/api/v1, public generated types, requiredserver_revision, and MCP errors preservingcode,execution_state, andrequest_id. Execution bypasses urllib3 retries, never follows redirects, and treats untyped transport failures as outcome-unknown. Tests count attempts beneath HTTPX's connection retry loop, including environment proxies. No generated code, Files changes, or Octonous integration is included.Notes
UV_FROZEN=true uv run pytest: 319 passed, 7 integration tests skipped (no gateway), including 180 mocked MCP cases. The same counts passed withuv run --isolated --python 3.11 --extra dev pytest -qand--python 3.13; default Python was 3.12.8. Both isolated runs also usedUV_FROZEN=true. No real MCP tools ran.UV_FROZEN=true uv run ruff check .passed;UV_FROZEN=true uv run mypy src/passed (10 files);UV_FROZEN=true uv run pytest tests/unit/test_endpoint_coverage.py -vpassed (3 tests).uv build,uvx twine check dist/otari-0.4.0.tar.gz dist/otari-0.4.0-py3-none-any.whl, isolated installed-wheel smoke checks (public exports, typing marker, sync/async resources and close), andgit diff --checkpassed.GET /api/v1/mcp/servers/{mcp_server_id}/toolsandPOST /api/v1/mcp/executefrom excluded to covered inmozilla-ai/otari/scripts/sdk_codegen/sdk-endpoints.txt, then regenerate the SDK copy. That generated file is intentionally untouched here. A new SDK release is needed after merge; no release was published.uv.lockrecords the root package as 0.2.0 whilepyproject.tomlis 0.4.0. Final runs usedUV_FROZEN=trueto avoid an unrelated lockfile edit. No SDK implementation blockers remain; gateway deployment was not verified.gpt-6-astra.Fixes #65