Skip to content

Commit 300c9a0

Browse files
fix: separate the mcp server running function
1 parent 406e574 commit 300c9a0

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

main.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,5 +136,12 @@ def run_ast_grep_yaml(yaml: str, project_folder: str) -> List[dict[str, Any]]:
136136
print("Command not found")
137137
return []
138138

139+
def run_mcp_server():
140+
"""
141+
Run the MCP server.
142+
This function is used to start the MCP server when this script is run directly.
143+
"""
144+
mcp.run(transport="stdio")
145+
139146
if __name__ == "__main__":
140-
mcp.run(transport = "stdio")
147+
run_mcp_server()

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ dependencies = [
1010
]
1111

1212
[project.scripts]
13-
ast-grep-server = "main:mcp.run"
13+
ast-grep-server = "main:run_mcp_server"

0 commit comments

Comments
 (0)