Skip to content

Commit 0764b90

Browse files
committed
feat: Add Lambda function URL to mcpdoc example
1 parent 662db8b commit 0764b90

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

examples/servers/mcpdoc/cdk_stack.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from aws_cdk import (
22
App,
33
Aspects,
4+
CfnOutput,
45
DockerVolume,
56
Environment,
67
RemovalPolicy,
@@ -55,7 +56,7 @@ def __init__(
5556
removal_policy=RemovalPolicy.DESTROY,
5657
)
5758

58-
lambda_python.PythonFunction(
59+
lambda_function = lambda_python.PythonFunction(
5960
self,
6061
"ServerFunction",
6162
function_name="mcp-server-mcpdoc" + stack_name_suffix,
@@ -83,6 +84,21 @@ def __init__(
8384
),
8485
)
8586

87+
# Function URL with AWS IAM authorization
88+
function_url = lambda_.FunctionUrl(
89+
self,
90+
"FunctionUrl",
91+
function=lambda_function,
92+
auth_type=lambda_.FunctionUrlAuthType.AWS_IAM,
93+
)
94+
95+
CfnOutput(
96+
self,
97+
"FunctionUrlOutput",
98+
value=function_url.url,
99+
export_name=f"McpDocServerUrl{stack_name_suffix}",
100+
)
101+
86102

87103
app = App()
88104
env = Environment(account=os.environ["CDK_DEFAULT_ACCOUNT"], region="us-east-2")

0 commit comments

Comments
 (0)