Skip to content

Commit 9503eed

Browse files
fix: Remove unsupported 'version' parameter from FastMCP initialization
Remove version parameter that causes TypeError in MCP SDK 1.12.3+ Refactor FastMCP initialization to use standard pattern Extract instructions and dependencies as constants Add create_server() function for better code organization Maintain full compatibility with existing functionality Fixes compatibility issue: TypeError: FastMCP.init() got an unexpected keyword argument 'version' This occurs because the current MCP SDK (1.12.3+) does not support the version parameter in FastMCP initialization.
1 parent e6c4675 commit 9503eed

File tree

1 file changed

+17
-9
lines changed
  • src/amazon-sns-sqs-mcp-server/awslabs/amazon_sns_sqs_mcp_server

1 file changed

+17
-9
lines changed

src/amazon-sns-sqs-mcp-server/awslabs/amazon_sns_sqs_mcp_server/server.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,28 @@
1515
"""Main server module for Amazon SNS and SQS MCP server."""
1616

1717
import argparse
18-
from awslabs.amazon_sns_sqs_mcp_server.consts import MCP_SERVER_VERSION
1918
from awslabs.amazon_sns_sqs_mcp_server.sns import register_sns_tools
2019
from awslabs.amazon_sns_sqs_mcp_server.sqs import register_sqs_tools
2120
from mcp.server.fastmcp import FastMCP
2221

22+
# Define server instructions and dependencies
23+
SERVER_INSTRUCTIONS = """Manage Amazon SNS topics, subscriptions, and Amazon SQS queues for messaging."""
2324

24-
# instantiate base server
25-
mcp = FastMCP(
26-
'awslabs.amazon-sns-sqs-mcp-server',
27-
instructions="""Manage Amazon SNS topics, subscriptions, and Amazon SQS queues for messaging.""",
28-
dependencies=['pydantic', 'boto3'],
29-
version=MCP_SERVER_VERSION,
30-
)
25+
SERVER_DEPENDENCIES = [
26+
'pydantic',
27+
'boto3'
28+
]
29+
30+
def create_server():
31+
"""Create and configure the MCP server instance."""
32+
return FastMCP(
33+
'awslabs.amazon-sns-sqs-mcp-server',
34+
instructions=SERVER_INSTRUCTIONS,
35+
dependencies=SERVER_DEPENDENCIES
36+
)
37+
38+
39+
mcp = create_server()
3140

3241

3342
def main():
@@ -51,6 +60,5 @@ def main():
5160

5261
mcp.run()
5362

54-
5563
if __name__ == '__main__':
5664
main()

0 commit comments

Comments
 (0)