konokenj.cdk-api-mcp-server 0.2.3__tar.gz → 0.11.0__tar.gz

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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: konokenj.cdk-api-mcp-server
3
- Version: 0.2.3
3
+ Version: 0.11.0
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
 
@@ -5,6 +5,8 @@
5
5
 
6
6
  ---
7
7
 
8
+ 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.
9
+
8
10
  ## Usage
9
11
 
10
12
  Add to your mcp.json:
@@ -33,11 +35,8 @@ Registered as static resources. To get available modules under the package, call
33
35
 
34
36
  To get available documents under the module, call `read_resource(uri)` as MCP client.
35
37
 
36
- > [!Note]
37
- > Chagne first and second part of uri as you need.
38
-
39
- - `cdk-api-docs://constructs/@aws-cdk/{module}/`
40
- - `cdk-api-docs://constructs/aws-cdk-lib/{module}/`
38
+ - `cdk-api-docs://constructs/@aws-cdk/{module}`
39
+ - `cdk-api-docs://constructs/aws-cdk-lib/{module}`
41
40
 
42
41
  ### Resource Template: Read file contents
43
42
 
@@ -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.3"
4
+ __version__ = "0.11.0"
@@ -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")
@@ -86,6 +87,11 @@ def create_server(provider: Optional[ResourceProvider] = None) -> FastMCP:
86
87
  )
87
88
  def list_package_modules(package_name: str):
88
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
+
89
95
  modules = [
90
96
  item
91
97
  for item in resource_provider.list_resources(f"constructs/{package_name}")
@@ -111,9 +117,14 @@ def create_server(provider: Optional[ResourceProvider] = None) -> FastMCP:
111
117
  )
112
118
  def list_module_files(package_name: str, module_name: str):
113
119
  """List all files in the module."""
114
- files = resource_provider.list_resources(
115
- f"constructs/{package_name}/{module_name}"
116
- )
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)
117
128
  content = json.dumps(files)
118
129
 
119
130
  # JSONとしてレスポンスを返す
@@ -138,18 +149,8 @@ def create_server(provider: Optional[ResourceProvider] = None) -> FastMCP:
138
149
  resource_path = f"constructs/{package_name}/{module_name}/{file_name}"
139
150
 
140
151
  if not resource_provider.resource_exists(resource_path):
141
- error_message = f"Error: File '{resource_path}' not found"
142
- return TextResource(
143
- uri=AnyUrl.build(
144
- scheme="cdk-api-docs",
145
- host="constructs",
146
- path=f"/{package_name}/{module_name}/{file_name}",
147
- ),
148
- name=file_name,
149
- text=error_message,
150
- description=f"Error: {resource_path}",
151
- mime_type="text/plain",
152
- )
152
+ error_message = f"Unknown resource: '{resource_path}' not found"
153
+ raise McpError(ErrorData(message=error_message, code=404))
153
154
 
154
155
  # リソースプロバイダーからコンテンツを取得
155
156
  content = resource_provider.get_resource_content(resource_path)
@@ -169,10 +170,9 @@ def create_server(provider: Optional[ResourceProvider] = None) -> FastMCP:
169
170
  description = f"JSON file: {package_name}/{module_name}/{file_name}"
170
171
  else:
171
172
  # その他の場合はmimetypesモジュールで判定
172
- mime_type, _ = mimetypes.guess_type(file_name)
173
- if mime_type is None:
174
- # デフォルトはプレーンテキスト
175
- 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"
176
176
  description = f"File: {package_name}/{module_name}/{file_name}"
177
177
 
178
178
  # Create and return a TextResource
@@ -19,13 +19,7 @@ authors = [
19
19
  classifiers = [
20
20
  "Development Status :: 4 - Beta",
21
21
  "Programming Language :: Python",
22
- "Programming Language :: Python :: 3.8",
23
- "Programming Language :: Python :: 3.9",
24
- "Programming Language :: Python :: 3.10",
25
- "Programming Language :: Python :: 3.11",
26
- "Programming Language :: Python :: 3.12",
27
- "Programming Language :: Python :: Implementation :: CPython",
28
- "Programming Language :: Python :: Implementation :: PyPy",
22
+ "Programming Language :: Python :: 3.13",
29
23
  ]
30
24
  dependencies = [
31
25
  "fastmcp>=2.0.0",
@@ -113,5 +107,5 @@ features = ["dev"]
113
107
 
114
108
  [tool.hatch.envs.dev.scripts]
115
109
  download = "python cdk_api_downloader/main.py"
116
- download-force = "python cdk_api_downloader/main.py --force"
117
- check = "mypy --install-types --non-interactive {args:cdk_api_mcp_server tests}"
110
+ check-updates = "python cdk_api_downloader/main.py --check"
111
+ typecheck = "mypy --install-types --non-interactive {args:cdk_api_mcp_server tests}"