-
Notifications
You must be signed in to change notification settings - Fork 77
Open
Description
Describe the bug
OAuth authentication with clientId and clientSecret does not work properly, as the code is not replacing the SCHEMENAME correctly
To Reproduce
Steps to reproduce the behavior:
- Use an oauth2 security scheme in the openapi spec file, e.g. with name
myscheme - Generate the MCP server with command
openapi-mcp-generator --transport "web" --input ./pkg/spec/my-api.yml --output ./my-api-mcp --base-url "https://my-api.sample/rest/api" - Provide the variables in the generated
.envfile:
OAUTH_CLIENT_ID_MYSCHEME=789
OAUTH_CLIENT_SECRET_MYSCHEME=xyz
- The generated code in file
index.tscontains the following code:
async function acquireOAuth2Token(schemeName: string, scheme: any): Promise<string | null | undefined> {
try {
// Check if we have the necessary credentials
const clientId = process.env[`OAUTH_CLIENT_ID_SCHEMENAME`];
const clientSecret = process.env[`OAUTH_CLIENT_SECRET_SCHEMENAME`];
const scopes = process.env[`OAUTH_SCOPES_SCHEMENAME`];
whereas it should read the variables OAUTH_CLIENT_ID_MYSCHEME and OAUTH_CLIENT_SECRET_MYSCHEME
Expected behavior
The generated MCP server executes the necessary steps to obtain a token with provided clientId and clientSecret.
Desktop (please complete the following information):
- OS: macOS Tahoe 26.1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels