[FEATURE][UI-REWRITE]: One-click schema generation from OpenAPI in Create REST tool form
Type of Feature
- [x] New feature or capability
Background
The backend already exposes POST /admin/tools/generate-schemas-from-openapi (mcpgateway/admin.py:11799), which:
- Accepts a tool
url,request_type, and optionalopenapi_url - Fetches the OpenAPI 3.x spec (defaulting to
{scheme}://{host}/openapi.json) - Extracts
input_schemaandoutput_schemafor the requested path + method (resolving$refs incomponents.schemas) - Returns both schemas plus the
spec_urlthat was used
The endpoint requires tools.create permission (no admin bypass) and has SSRF protection built into mcpgateway/services/openapi_service.py.
No UI surface currently exists for this feature. The legacy admin.html doesn't expose it either, so this would be the first user-facing entry point for an otherwise-unused backend capability.
Proposal
Add a "Generate from OpenAPI" button option as a default in the Create REST Tool form. Users will continue to be able to add schemas manually, if preferred / necessary.
UX
- Button: Disabled until
urlandrequest_typeare filled (both are required by the backend endpoint). - On click: call the endpoint, show a loading state on the button (the request can take up to 10s).
- On success:
- Pretty-print the returned
input_schemaandoutput_schemaJSON into the corresponding fields - Show a small caption:
Generated from {spec_url}(the endpoint returns this)
- Pretty-print the returned
- On failure: map the typed error responses to clear messages:
400with SSRF-related message → "URL not reachable from the gateway (blocked by SSRF protection)"404→ "The path{path}with method{method}is not in the OpenAPI spec"502→ "Couldn't fetch the OpenAPI spec — check that the URL is correct and reachable"500→ generic fallback
- Don't overwrite silently: if either schema field is already non-empty, ask the user to confirm before replacing.
- Include the manual ways to add an input and optional output schemas that the user could use if they prefer / can't use the default method of generating the schema from
/admin/tools/generate-schemas-from-openapi
API client work
Extend client/src/api/tools.ts (created by the prerequisite issue) with:
async function generateSchemasFromOpenapi(input: {
url: string;
request_type: string;
openapi_url?: string;
}): Promise<{
message: string;
success: boolean;
input_schema: object | null;
output_schema: object | null;
spec_url: string;
}>;
Out of scope
- Bulk import of multiple endpoints from a single OpenAPI spec: the backend only extracts one path+method per call. A multi-endpoint flow would be a separate feature.
- Support for Swagger 2.0 specs the resolver doesn't currently handle, or YAML specs (backend uses
orjson.loads). - Inferring
name,description,tagsfrom the OpenAPIoperationId/summary/tags. This could be a nice follow-up but adds complexity.
Dependencies
- Blocked by: #4860 ([UI-REWRITE]: Create REST tool)
References
- Endpoint:
mcpgateway/admin.py:11799(POST /admin/tools/generate-schemas-from-openapi) - Service:
mcpgateway/services/openapi_service.py:162(fetch_and_extract_schemas) - Backend tests:
tests/unit/mcpgateway/test_admin_openapi.py - Parent epic: #4093
Hi @a-effort ! 👋
I'd like to work on this issue.
I've reviewed the scope, the servers.ts pattern, and issue #4175 for reference. I'm comfortable with TypeScript and React.
A few quick questions before I start:
- Which branch should I base this on? (ui-rewrite?)
- Any specific component library being used in the rewrite?
- Should I wait for triage to be resolved before opening a PR?
Happy to pick this up if it's still available!
This should be implemented after creating a new API endpoint described in https://github.com/IBM/mcp-context-forge/issues/5142
Thanks for the clarification!
I'll keep an eye on #5142 and start working on this once the API endpoint is available.
https://github.com/IBM/mcp-context-forge/issues/5142 is closed. The API endpoint is in main now.
@prince3235 - Do you still want to work on this issue?
Yess a i am still working on this issue. It's little bit complicated But I handle it...
@prince3235 - not sure if you're working on this issue. But we had to put down the PR 5604 for this issue.
Done!