Skip to content

Commit 2f6622c

Browse files
authored
fix: fixed request error with header (#7)
1 parent c53a600 commit 2f6622c

File tree

7 files changed

+39
-27
lines changed

7 files changed

+39
-27
lines changed

.gitlab-ci.yml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -166,29 +166,29 @@ publish-dev-docker:
166166
# - echo "//${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=${CI_JOB_TOKEN}" >> .npmrc
167167
# - semantic-release
168168

169-
# publish-tag-docker:
170-
# stage: release
171-
# <<: *main_branch
172-
# needs:
173-
# - semantic-release
174-
# image: docker:27-dind
175-
# services:
176-
# - name: docker:27-dind
177-
# alias: docker
178-
# variables:
179-
# DOCKER_HOST: tcp://docker:2376
180-
# DOCKER_TLS_CERTDIR: '/certs'
181-
# DOCKER_TLS_VERIFY: 1
182-
# DOCKER_CERT_PATH: '$DOCKER_TLS_CERTDIR/client'
183-
# before_script: *before_script_docker
184-
# script:
185-
# - apk add --no-cache git
186-
# - git pull origin main
187-
# - PACKAGE_VERSION=$(grep -m1 version package.json | cut -c 15- | rev | cut
188-
# -c 3- | rev)
189-
# - GIT_HASH=$(git rev-parse --short HEAD)
190-
# - docker buildx build --progress plain --platform linux/amd64,linux/arm64
191-
# --allow network.host --provenance false
192-
# --build-arg PACKAGE_VERSION=$PACKAGE_VERSION --build-arg GIT_HASH=$GIT_HASH
193-
# --build-arg NODE_ENV=production --target production --pull --tag
194-
# $CI_REGISTRY/chrisleekr/${CI_PROJECT_NAME}:${PACKAGE_VERSION} --push .
169+
publish-tag-docker:
170+
stage: release
171+
<<: *main_branch
172+
# needs:
173+
# - semantic-release
174+
image: docker:27-dind
175+
services:
176+
- name: docker:27-dind
177+
alias: docker
178+
variables:
179+
DOCKER_HOST: tcp://docker:2376
180+
DOCKER_TLS_CERTDIR: "/certs"
181+
DOCKER_TLS_VERIFY: 1
182+
DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client"
183+
before_script: *before_script_docker
184+
script:
185+
- apk add --no-cache git
186+
- git pull origin main
187+
- PACKAGE_VERSION=$(grep -m1 version package.json | cut -c 15- | rev | cut
188+
-c 3- | rev)
189+
- GIT_HASH=$(git rev-parse --short HEAD)
190+
- docker buildx build --progress plain --platform linux/amd64,linux/arm64
191+
--allow network.host --provenance false
192+
--build-arg PACKAGE_VERSION=$PACKAGE_VERSION --build-arg GIT_HASH=$GIT_HASH
193+
--build-arg NODE_ENV=production --target production --pull --tag
194+
$CI_REGISTRY/chrisleekr/${CI_PROJECT_NAME}:${PACKAGE_VERSION} --push .

src/core/server/auth/handlers.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export function setupAuthHandlers(app: Application): void {
8080

8181
res.setHeader('Content-Type', 'application/json');
8282
res.status(200).json(metadata);
83+
return;
8384
}
8485
);
8586

@@ -91,6 +92,7 @@ export function setupAuthHandlers(app: Application): void {
9192

9293
res.setHeader('Content-Type', 'application/json');
9394
res.status(200).json(metadata);
95+
return;
9496
}
9597
);
9698

@@ -100,6 +102,7 @@ export function setupAuthHandlers(app: Application): void {
100102

101103
res.setHeader('Content-Type', 'application/json');
102104
res.status(200).json(response);
105+
return;
103106
});
104107

105108
app.get('/oauth/authorize', async (req: Request, res: Response) => {
@@ -108,6 +111,7 @@ export function setupAuthHandlers(app: Application): void {
108111
const response = await oauthService.handleAuthorization(request);
109112

110113
res.redirect(response.redirectUrl);
114+
return;
111115
});
112116

113117
app.post('/oauth/token', async (req: Request, res: Response) => {
@@ -116,6 +120,7 @@ export function setupAuthHandlers(app: Application): void {
116120

117121
res.setHeader('Content-Type', 'application/json');
118122
res.status(200).json(response);
123+
return;
119124
});
120125

121126
app.post('/oauth/revoke', async (req: Request, res: Response) => {
@@ -124,12 +129,14 @@ export function setupAuthHandlers(app: Application): void {
124129

125130
res.setHeader('Content-Type', 'application/json');
126131
res.status(200).json(response);
132+
return;
127133
});
128134

129135
app.get('/oauth/stats', async (_req: Request, res: Response) => {
130136
const response = await oauthService.getStats();
131137
res.setHeader('Content-Type', 'application/json');
132138
res.status(200).json(response);
139+
return;
133140
});
134141

135142
oauthService.setupHandlers(app);

src/core/server/auth/services/providers/auth0.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ export class Auth0Provider {
371371
req.query as Record<string, string>
372372
);
373373
res.redirect(response.redirectUrl);
374+
return;
374375
});
375376

376377
loggingContext.log('info', 'Auth0 handlers setup complete');

src/core/server/http/handlers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export function setupRequestHandlers(
1414
): void {
1515
app.get('/', (_req, res) => {
1616
res.send('Hello MCP Server');
17+
return;
1718
});
1819

1920
setupPingHandler(app);

src/core/server/http/handlers/mcpDelete.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ export function setupMCPDeleteHandler(
4646
loggingContext.log('info', 'Session terminated', {
4747
data: { sessionId },
4848
});
49-
res.status(200).json({ message: 'Session terminated' }); // Return 200 to gracefully handle the request
5049
} catch (error: unknown) {
5150
loggingContext.log('error', 'Error handling DELETE request', {
5251
data: {
@@ -57,6 +56,7 @@ export function setupMCPDeleteHandler(
5756
},
5857
});
5958
res.status(500).json({ error: 'Internal server error' });
59+
return;
6060
}
6161
})();
6262
});

src/core/server/http/handlers/mcpPost.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export function setupMCPPostHandler(
7676
}
7777

7878
await transport.handleRequest(req, res, requestBody);
79+
return;
7980
} catch (error) {
8081
loggingContext.log('error', 'Error handling HTTP request', {
8182
data: {
@@ -86,6 +87,7 @@ export function setupMCPPostHandler(
8687
},
8788
});
8889
res.status(500).json({ error: 'Internal server error' });
90+
return;
8991
}
9092
})();
9193
});

src/core/server/http/handlers/ping.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ import express from 'express';
33
export function setupPingHandler(app: express.Application): void {
44
app.get('/ping', (_req, res) => {
55
res.send('pong');
6+
return;
67
});
78
}

0 commit comments

Comments
 (0)