Skip to content

feat: add opt-in call_endpoint HTTP execution - #3

Merged
fqueis merged 9 commits into
mainfrom
feat/call-endpoint-opt-in
Jul 24, 2026
Merged

feat: add opt-in call_endpoint HTTP execution#3
fqueis merged 9 commits into
mainfrom
feat/call-endpoint-opt-in

Conversation

@fqueis

@fqueis fqueis commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Description

Adds optional HTTP execution to the OpenAPI Contract MCP via a new call_endpoint tool, gated behind OPENAPI_MCP_ENABLE_CALLS. By default the server stays read-only (contract inspection only); when enabled, agents can execute operations against registered backends with timeout and response-body limits, header/headerEnv auth, and URL building from OpenAPI path templates and servers.

Key Changes & Features Implemented

HTTP execution core

  • Added call helpers for header merging, body serialization, and result materialization (94c34a4)
  • Added buildCallUrl for absolute URL assembly from base URL, servers, path params, and query (eb8ab30)
  • Implemented OpenApiContractService.callEndpoint for operation resolution and HTTP execution with abort timeout (eb8ab30)

Opt-in config and MCP tool surface

  • Extended config with enableCalls, callTimeoutMs, and callMaxBodyBytes from env (57f1fbe)
  • Registered call_endpoint only when OPENAPI_MCP_ENABLE_CALLS is truthy (3ee7a3c, 3b52fde)

Tests and CI

  • Added coverage for callEndpoint, call tool registration, URL building, and call-related config (8a23f35)
  • Switched PR checks to run tests with coverage floors (cb0b59e)

Documentation and release

  • Updated README and ARCHITECT for default read-only behavior, enablement examples, and new env vars (c7a5e5d)
  • Bumped package version to 1.1.0 (4f62744)

How to Test

  1. Run pnpm test (or pnpm test:coverage) and confirm call endpoint, call tools, call-url, config, and service suites pass.
  2. Start the server without OPENAPI_MCP_ENABLE_CALLS and confirm call_endpoint is not listed among tools.
  3. Start with OPENAPI_MCP_ENABLE_CALLS=1, register a backend via use_backend, then call call_endpoint for a known operation (method+path or operationId).
  4. Verify auth via headerEnv (preferred) and that timeouts / body truncation respect OPENAPI_MCP_CALL_TIMEOUT_MS and OPENAPI_MCP_CALL_MAX_BODY_BYTES.
  5. Spot-check README enablement example and env table against the behavior above.

fqueis added 9 commits July 23, 2026 23:09
- Added `call.ts` with functions for merging headers, materializing call results, serializing request bodies, and flattening headers.
- Introduced `CallEndpointResult` type for structured API call responses.
- Added support for enabling `call_endpoint` with a new `enableCalls` flag.
- Introduced timeout and maximum response body size settings for HTTP requests via `callTimeoutMs` and `callMaxBodyBytes`.
- Updated `loadConfig` function to read new environment variables for these settings.
…LE_CALLS flag. Updated main function to include call tools if enabled.
- Introduced `registerCallTools` function to wire the `call_endpoint` tool to the MCP server.
- Added `registerCallToolsIfEnabled` function to conditionally register call tools based on the `enableCalls` flag.
- Enhanced input schema for `call_endpoint` to support various HTTP request parameters and headers.
…tion

- Added `callEndpoint` method to `OpenApiContractService` for executing HTTP requests against registered backends.
- Introduced `buildCallUrl` utility for constructing absolute URLs from OpenAPI specifications.
- Enhanced documentation for service orchestration and input types for better clarity on usage.
…d URL building

- Introduced tests for `OpenApiContractService.callEndpoint` covering various scenarios including successful calls, error handling, and response body truncation.
- Added tests for `registerCallToolsIfEnabled` to verify conditional registration of call tools based on the `enableCalls` flag.
- Implemented tests for `buildCallUrl` to ensure correct URL assembly from base URL and path templates, including handling of path parameters and query string encoding.
- Enhanced configuration tests to validate new environment variables for call execution limits and enabling calls.
- Modified the test job in `pr-checks.yml` to run tests with coverage instead of standard tests.
- Updated comments to reflect the inclusion of coverage floors from `vitest.config.ts`.
- Clarified that the server is read-only by default, with optional HTTP execution available when `OPENAPI_MCP_ENABLE_CALLS` is set.
- Updated the architecture document to include new responsibilities related to HTTP call helpers.
- Enhanced README to provide examples for enabling HTTP calls and detailed environment variable descriptions.
- Adjusted sections on tool registration and call limits to align with recent changes in functionality.
@fqueis fqueis self-assigned this Jul 24, 2026
@fqueis fqueis added the enhancement New feature or request label Jul 24, 2026
@fqueis
fqueis merged commit b1fd39f into main Jul 24, 2026
2 checks passed
@fqueis
fqueis deleted the feat/call-endpoint-opt-in branch July 24, 2026 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant