konokenj.cdk-api-mcp-server 0.2.2__py3-none-any.whl → 0.2.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of konokenj.cdk-api-mcp-server might be problematic. Click here for more details.

@@ -1,4 +1,4 @@
1
1
  # SPDX-FileCopyrightText: 2025-present Kenji Kono <konoken@amazon.co.jp>
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
- __version__ = "0.2.2"
4
+ __version__ = "0.2.4"
@@ -7,6 +7,7 @@ from typing import Optional
7
7
 
8
8
  from fastmcp import FastMCP
9
9
  from fastmcp.resources import TextResource
10
+ from mcp.shared.exceptions import ErrorData, McpError
10
11
  from pydantic import AnyUrl
11
12
 
12
13
  from cdk_api_mcp_server.resources import (
@@ -42,8 +43,8 @@ def create_server(provider: Optional[ResourceProvider] = None) -> FastMCP:
42
43
  # 新しいサーバーインスタンスを作成
43
44
  server: FastMCP = FastMCP()
44
45
 
45
- # nameフィールドにアクセスする方法は提供されていないため、descriptionを使う
46
- server.description = "AWS CDK API MCP Server"
46
+ # 説明はコメントで残しておく
47
+ # "AWS CDK API MCP Server"
47
48
 
48
49
  # 定義済みのパッケージとして直接リソース登録
49
50
  @server.resource("cdk-api-docs://constructs/@aws-cdk", mime_type="application/json")
@@ -81,14 +82,16 @@ def create_server(provider: Optional[ResourceProvider] = None) -> FastMCP:
81
82
  )
82
83
 
83
84
  # リソーステンプレート:パッケージ内のモジュール一覧
84
- @server.resource(
85
- "cdk-api-docs://constructs/{package_name}/", mime_type="application/json"
86
- )
87
85
  @server.resource(
88
86
  "cdk-api-docs://constructs/{package_name}", mime_type="application/json"
89
87
  )
90
88
  def list_package_modules(package_name: str):
91
89
  """List all modules in the package."""
90
+ # パッケージが存在するか確認
91
+ if not resource_provider.resource_exists(f"constructs/{package_name}"):
92
+ error_message = f"Unknown resource: package '{package_name}' not found"
93
+ raise McpError(ErrorData(message=error_message, code=404))
94
+
92
95
  modules = [
93
96
  item
94
97
  for item in resource_provider.list_resources(f"constructs/{package_name}")
@@ -108,19 +111,20 @@ def create_server(provider: Optional[ResourceProvider] = None) -> FastMCP:
108
111
  )
109
112
 
110
113
  # リソーステンプレート:モジュール内のファイル一覧
111
- @server.resource(
112
- "cdk-api-docs://constructs/{package_name}/{module_name}/",
113
- mime_type="application/json",
114
- )
115
114
  @server.resource(
116
115
  "cdk-api-docs://constructs/{package_name}/{module_name}",
117
116
  mime_type="application/json",
118
117
  )
119
118
  def list_module_files(package_name: str, module_name: str):
120
119
  """List all files in the module."""
121
- files = resource_provider.list_resources(
122
- f"constructs/{package_name}/{module_name}"
123
- )
120
+ resource_path = f"constructs/{package_name}/{module_name}"
121
+
122
+ # モジュールが存在するか確認
123
+ if not resource_provider.resource_exists(resource_path):
124
+ error_message = f"Unknown resource: module '{resource_path}' not found"
125
+ raise McpError(ErrorData(message=error_message, code=404))
126
+
127
+ files = resource_provider.list_resources(resource_path)
124
128
  content = json.dumps(files)
125
129
 
126
130
  # JSONとしてレスポンスを返す
@@ -145,18 +149,8 @@ def create_server(provider: Optional[ResourceProvider] = None) -> FastMCP:
145
149
  resource_path = f"constructs/{package_name}/{module_name}/{file_name}"
146
150
 
147
151
  if not resource_provider.resource_exists(resource_path):
148
- error_message = f"Error: File '{resource_path}' not found"
149
- return TextResource(
150
- uri=AnyUrl.build(
151
- scheme="cdk-api-docs",
152
- host="constructs",
153
- path=f"/{package_name}/{module_name}/{file_name}",
154
- ),
155
- name=file_name,
156
- text=error_message,
157
- description=f"Error: {resource_path}",
158
- mime_type="text/plain",
159
- )
152
+ error_message = f"Unknown resource: '{resource_path}' not found"
153
+ raise McpError(ErrorData(message=error_message, code=404))
160
154
 
161
155
  # リソースプロバイダーからコンテンツを取得
162
156
  content = resource_provider.get_resource_content(resource_path)
@@ -176,10 +170,9 @@ def create_server(provider: Optional[ResourceProvider] = None) -> FastMCP:
176
170
  description = f"JSON file: {package_name}/{module_name}/{file_name}"
177
171
  else:
178
172
  # その他の場合はmimetypesモジュールで判定
179
- mime_type, _ = mimetypes.guess_type(file_name)
180
- if mime_type is None:
181
- # デフォルトはプレーンテキスト
182
- mime_type = "text/plain"
173
+ mime_type_guess, _ = mimetypes.guess_type(file_name)
174
+ # None の場合はデフォルトのtext/plainを使用
175
+ mime_type = mime_type_guess if mime_type_guess is not None else "text/plain"
183
176
  description = f"File: {package_name}/{module_name}/{file_name}"
184
177
 
185
178
  # Create and return a TextResource
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: konokenj.cdk-api-mcp-server
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: An MCP server provides AWS CDK API Reference
5
5
  Project-URL: Documentation, https://github.com/konokenj/cdk-api-mcp-server#readme
6
6
  Project-URL: Issues, https://github.com/konokenj/cdk-api-mcp-server/issues
@@ -10,13 +10,7 @@ License-Expression: MIT
10
10
  License-File: LICENSE.txt
11
11
  Classifier: Development Status :: 4 - Beta
12
12
  Classifier: Programming Language :: Python
13
- Classifier: Programming Language :: Python :: 3.8
14
- Classifier: Programming Language :: Python :: 3.9
15
- Classifier: Programming Language :: Python :: 3.10
16
- Classifier: Programming Language :: Python :: 3.11
17
- Classifier: Programming Language :: Python :: 3.12
18
- Classifier: Programming Language :: Python :: Implementation :: CPython
19
- Classifier: Programming Language :: Python :: Implementation :: PyPy
13
+ Classifier: Programming Language :: Python :: 3.13
20
14
  Requires-Python: >=3.8
21
15
  Requires-Dist: fastmcp>=2.0.0
22
16
  Requires-Dist: pydantic>=2.10.6
@@ -33,6 +27,8 @@ Description-Content-Type: text/markdown
33
27
 
34
28
  ---
35
29
 
30
+ Provide AWS CDK API references and integration test code for sample. Can be used in offline because all documents are included in the released python artifact.
31
+
36
32
  ## Usage
37
33
 
38
34
  Add to your mcp.json:
@@ -61,11 +57,8 @@ Registered as static resources. To get available modules under the package, call
61
57
 
62
58
  To get available documents under the module, call `read_resource(uri)` as MCP client.
63
59
 
64
- > [!Note]
65
- > Chagne first and second part of uri as you need.
66
-
67
- - `cdk-api-docs://constructs/@aws-cdk/{module}/`
68
- - `cdk-api-docs://constructs/aws-cdk-lib/{module}/`
60
+ - `cdk-api-docs://constructs/@aws-cdk/{module}`
61
+ - `cdk-api-docs://constructs/aws-cdk-lib/{module}`
69
62
 
70
63
  ### Resource Template: Read file contents
71
64
 
@@ -1,8 +1,8 @@
1
- cdk_api_mcp_server/__about__.py,sha256=ManuVQpBt-rzN64C95D8i3MDeyMz3p55IIaI5Jf6SrA,128
1
+ cdk_api_mcp_server/__about__.py,sha256=0szfKEU5ZuacFMdiLx41G7WJUoec_X8zt8q0OlzSGR4,128
2
2
  cdk_api_mcp_server/__init__.py,sha256=yJA6yIEhJviC-qNlB-nC6UR1JblQci_d84i-viHZkc0,187
3
3
  cdk_api_mcp_server/models.py,sha256=cMS1Hi29M41YjuBxqqrzNrNvyG3MgnUBb1SqYpMCJ30,692
4
4
  cdk_api_mcp_server/resources.py,sha256=R7LVwn29I4BJzU5XAwKbX8j6uy-3ZxcB1b0HzZ_Z2PI,6689
5
- cdk_api_mcp_server/server.py,sha256=_Eng7kuY_1zd-oi8xB1PtFq9js0ropqM1DdgaFPo-ec,8063
5
+ cdk_api_mcp_server/server.py,sha256=uN5SE6PHpiOYY8QlNID1a0j2hLdeO61QX3kgC_oTODg,8055
6
6
  cdk_api_mcp_server/resources/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/app-staging-synthesizer-alpha/README.md,sha256=rAatqlr_JE06sjgcBVdXszpwh3grV4aFkkb9L2s8IIU,16492
8
8
  cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/app-staging-synthesizer-alpha/resource-names.md,sha256=oSTmVHH2AZ9cd-KiITtuS0nJMOWGC0FpVg3t7p6UPMM,1323
@@ -1353,8 +1353,8 @@ cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/pipelines/integ.pipe
1353
1353
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/region-info/README.md,sha256=vewWkV3ds9o9iyyYaJBNTkaKJ2XA6K2yF17tAxUnujg,2718
1354
1354
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/triggers/README.md,sha256=hYIx7DbG_7p4LYLUfxDwgIQjw9UNdz1GLrqDe8_Dbko,4132
1355
1355
  cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/triggers/integ.triggers.ts,sha256=4OHplMoBOgHGkktAzoU-TuNmJQS5wGAUvBfj5bGSe_Y,2807
1356
- konokenj_cdk_api_mcp_server-0.2.2.dist-info/METADATA,sha256=s-Vsg2FrqdeV0QAvWLUDbnNwuY82YuwatB5_fqXZv8U,2678
1357
- konokenj_cdk_api_mcp_server-0.2.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
1358
- konokenj_cdk_api_mcp_server-0.2.2.dist-info/entry_points.txt,sha256=bVDhMdyCC1WNMPOMbmB82jvWII2CIrwTZDygdCf0cYQ,79
1359
- konokenj_cdk_api_mcp_server-0.2.2.dist-info/licenses/LICENSE.txt,sha256=5OIAASeg1HM22mVZ1enz9bgZ7TlsGfWXnj02P9OgFyk,1098
1360
- konokenj_cdk_api_mcp_server-0.2.2.dist-info/RECORD,,
1356
+ konokenj_cdk_api_mcp_server-0.2.4.dist-info/METADATA,sha256=TXqvU9TIp7zaPDFHV8p56E4NcJPEf-C8kGLiV9HZEPY,2432
1357
+ konokenj_cdk_api_mcp_server-0.2.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
1358
+ konokenj_cdk_api_mcp_server-0.2.4.dist-info/entry_points.txt,sha256=bVDhMdyCC1WNMPOMbmB82jvWII2CIrwTZDygdCf0cYQ,79
1359
+ konokenj_cdk_api_mcp_server-0.2.4.dist-info/licenses/LICENSE.txt,sha256=5OIAASeg1HM22mVZ1enz9bgZ7TlsGfWXnj02P9OgFyk,1098
1360
+ konokenj_cdk_api_mcp_server-0.2.4.dist-info/RECORD,,