Skip to content

Commit 62af2f4

Browse files
committed
細かい修正
1 parent 1f87207 commit 62af2f4

11 files changed

Lines changed: 43 additions & 775 deletions

File tree

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
<!-- markdownlint-disable MD041 -->
2+
<!-- markdownlint-disable MD033 -->
23

34
## 概要
45

5-
概要を記述
6+
概要を簡潔に記述
67

78
## 変更点
89

10+
変更内容を簡潔に記述。
11+
12+
<details>
13+
<summary>修正ファイル一覧</summary>
14+
915
| 追加・変更・削除したファイル (リポジトリルートからの相対パス) | 変更内容 | 事由 |
1016
| --------------------------------------------------- | ------- | --- |
1117
| 変更したファイルのリポジトリルートからの相対パス | どんな変更を行なったのか? | 何故、変更が必要だったのか? |
1218

19+
</details>
20+
1321
## 関連Issue
1422

1523
- あれば記述(なければセクションを削除)
@@ -18,7 +26,7 @@
1826

1927
- [ ] (Typescriptの場合) `pnpm audit --fix` で脆弱性を修正済みか?
2028
- [ ] (Typescriptの場合) `pnpm lint-fix` でコードスタイルは修正済みか?
21-
- [ ] (Markdownの場合)`npx -y markdownlint-cli2@latest . --fix` で Markdown の lint は修正済みか?
29+
- [ ] (Markdownの場合)`pnx markdownlint-cli2@latest . --fix` で Markdown の lint は修正済みか?
2230

2331
## 特記事項
2432

.github/workflows/create-release-pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ jobs:
3333
run: |
3434
git config user.name "github-actions[bot]"
3535
git config user.email "github-actions[bot]@users.noreply.github.com"
36-
36+
3737
- name: Install pnpm
3838
uses: pnpm/setup@5d160c5bc68a09337ad0d5654e237e03253b5879 # v1.0.0
39-
39+
4040
# No need to install dependencies - npm version works without them
4141
- name: Version bump
4242
id: version

example/lambda/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ const createMcpServer = () => {
1010
const server = new McpServer({
1111
name: 'hello-server',
1212
version: '1.0.0',
13-
});
13+
},
14+
);
1415

1516
server.registerTool(
1617
'say_hello',
@@ -27,7 +28,9 @@ const createMcpServer = () => {
2728
);
2829
return server;
2930
};
30-
const app = createHonoApp(createMcpServer);
31+
const app = createHonoApp(createMcpServer, {
32+
host: '0.0.0.0',
33+
});
3134

3235
// Lambda handler
3336
export const handler = handle(app);

example/lib/example-stack.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export class ExampleStack extends cdk.Stack {
1919
],
2020
});
2121

22-
2322
const mcpServerFunctionName = `${projectName}-mcp-server-example`;
2423
const mcpServerLogGroup = new cdk.aws_logs.LogGroup(this, 'McpServerFunctionLogGroup', {
2524
logGroupName: `/aws/lambda/${mcpServerFunctionName}`,
@@ -40,7 +39,7 @@ export class ExampleStack extends cdk.Stack {
4039
bundling: {
4140
// No externalModules since we want to bundle everything
4241
nodeModules: [
43-
'@modelcontextprotocol/sdk',
42+
'@modelcontextprotocol/server',
4443
'hono',
4544
'zod',
4645
],
@@ -52,7 +51,7 @@ export class ExampleStack extends cdk.Stack {
5251
sourceMap: true, // ソースマップを有効化(デバッグ用)
5352
keepNames: true,
5453
format: cdk.aws_lambda_nodejs.OutputFormat.ESM,
55-
target: 'node22', // Target Node.js 22.x
54+
target: 'node24', // Target Node.js 24.x
5655
banner: 'import { createRequire } from \'module\';const require = createRequire(import.meta.url);',
5756
},
5857
});
@@ -66,7 +65,7 @@ export class ExampleStack extends cdk.Stack {
6665
allowMethods: cdk.aws_apigateway.Cors.ALL_METHODS,
6766
},
6867
deployOptions: {
69-
stageName: 'v1',
68+
stageName: 'v2',
7069
},
7170
endpointTypes: [cdk.aws_apigateway.EndpointType.REGIONAL],
7271
});

example/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
},
1818
"devDependencies": {
1919
"@eslint/js": "10.0.1",
20-
"@hono/mcp": "0.3.1",
2120
"@hono/node-server": "2.0.11",
2221
"@stylistic/eslint-plugin": "5.10.0",
2322
"@types/aws-lambda": "8.10.162",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"devEngines": {
2222
"packageManager": {
2323
"name": "pnpm",
24-
"version": "^11.17.0",
24+
"version": "^11.19.0",
2525
"onFail": "download"
2626
}
2727
},

package/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ npm install aws-lambda-mcp-server
2020
TypeScriptでの利用例です。
2121

2222
```typescript
23-
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
23+
import { McpServer } from '@modelcontextprotocol/server';
2424
import { createHonoApp } from 'aws-lambda-mcp-server';
2525
import { handle } from 'hono/aws-lambda';
2626
import { z } from 'zod';

package/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
},
5959
"dependencies": {
6060
"@aws-lambda-powertools/logger": "2.34.0",
61-
"@hono/mcp": "0.3.1",
6261
"@modelcontextprotocol/core": "^2.0.0",
6362
"@modelcontextprotocol/hono": "^2.0.0",
6463
"@modelcontextprotocol/server": "2.0.0",
@@ -67,7 +66,6 @@
6766
},
6867
"peerDependencies": {
6968
"@aws-lambda-powertools/logger": "^2.34.0",
70-
"@hono/mcp": "^0.3.1",
7169
"@modelcontextprotocol/server": "^2.0.0",
7270
"hono": "^4.12.31",
7371
"zod": "^3.25 || ^4.0"

package/src/index.ts

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import { Logger } from '@aws-lambda-powertools/logger';
1313
import { McpServer, WebStandardStreamableHTTPServerTransport } from '@modelcontextprotocol/server';
14-
import { createMcpHonoApp } from '@modelcontextprotocol/hono';
14+
import { createMcpHonoApp, CreateMcpHonoAppOptions } from '@modelcontextprotocol/hono';
1515
import { Context } from 'hono';
1616
import { BlankEnv, BlankInput } from 'hono/types';
1717

@@ -31,32 +31,6 @@ declare module 'hono' {
3131
}
3232
}
3333

34-
/**
35-
* 許可されていないHTTPメソッドに対するハンドラーです。
36-
*
37-
* @remarks
38-
* 405エラーのJSONレスポンスを返します。
39-
*
40-
* @param c Honoのコンテキスト
41-
* @returns 405エラーのJSONレスポンス
42-
* @private
43-
*/
44-
const methodNotAllowedHandler = async (
45-
c: Context<BlankEnv, '/mcp', BlankInput>,
46-
) => {
47-
return c.json(
48-
{
49-
jsonrpc: '2.0',
50-
error: {
51-
code: -32000,
52-
message: 'メソッドは許可されていません。',
53-
},
54-
id: null,
55-
},
56-
{ status: 405 },
57-
);
58-
};
59-
6034
/**
6135
* サーバーエラー発生時の共通エラーハンドラーです。
6236
*
@@ -176,21 +150,12 @@ const handleRequest = async (createMcpServer: () => McpServer, c: Context<BlankE
176150
* const app = createHonoApp(createMcpServer);
177151
* ```
178152
*/
179-
export const createHonoApp = (createMcpServer: () => McpServer) => {
180-
const app = createMcpHonoApp();
153+
export const createHonoApp = (createMcpServer: () => McpServer, options?: CreateMcpHonoAppOptions) => {
154+
const app = createMcpHonoApp(options);
181155

182-
app.post('/mcp', async (c) => {
156+
app.all('/mcp', async (c) => {
183157
return await handleRequest(createMcpServer, c);
184158
});
185159

186-
app.get('/mcp', async (c) => {
187-
return await handleRequest(createMcpServer, c);
188-
});
189-
190-
app.put('/mcp', methodNotAllowedHandler);
191-
app.delete('/mcp', methodNotAllowedHandler);
192-
app.patch('/mcp', methodNotAllowedHandler);
193-
app.options('/mcp', methodNotAllowedHandler);
194-
195160
return app;
196161
};

0 commit comments

Comments
 (0)