Skip to content

Commit b6f0cd0

Browse files
Merge pull request #5 from cognitive-glitch/feat/uvx-support
Feat: uv/uvx support
2 parents aeea091 + adede60 commit b6f0cd0

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,17 @@ This MCP server enables AI assistants (like Cursor, Claude Desktop, etc.) to sea
4545
```bash
4646
ast-grep --version
4747
```
48+
49+
## Running with `uvx`
50+
51+
You can run the server directly from GitHub using `uvx`:
52+
53+
```bash
54+
uvx --from git+https://github.com/ast-grep/ast-grep-mcp ast-grep-server
55+
```
56+
57+
This is useful for quickly trying out the server without cloning the repository.
58+
4859
## Configuration
4960

5061
### For Cursor

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() -> None:
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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ dependencies = [
88
"pydantic>=2.11.0",
99
"mcp[cli]>=1.6.0",
1010
]
11+
12+
[project.scripts]
13+
ast-grep-server = "main:run_mcp_server"

0 commit comments

Comments
 (0)