Skip to content

Commit edeef75

Browse files
committed
feat: add --version flag to mcp-server-code-extractor command
1 parent 251dd01 commit edeef75

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

code_extractor/server.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def find_function(node):
226226
func_node = find_function(tree.root_node)
227227

228228
if not func_node:
229-
return {"error": f"Function '{function_name}' not found in {file_path}"}
229+
return {"error": f"Function '{function_name}' not found in {path_or_url}"}
230230

231231
# Extract the function code
232232
source_bytes = source.encode('utf-8') if isinstance(source, str) else source
@@ -327,7 +327,7 @@ def find_class(node):
327327
class_node = find_class(tree.root_node)
328328

329329
if not class_node:
330-
return {"error": f"Class '{class_name}' not found in {file_path}"}
330+
return {"error": f"Class '{class_name}' not found in {path_or_url}"}
331331

332332
# Extract the class code
333333
source_bytes = source.encode('utf-8') if isinstance(source, str) else source
@@ -437,6 +437,23 @@ def get_signature(path_or_url: str, function_name: str, git_revision: Optional[s
437437

438438
def main():
439439
"""Main entry point for the MCP server."""
440+
import argparse
441+
import sys
442+
443+
# Parse command line arguments
444+
parser = argparse.ArgumentParser(
445+
description="MCP Server Code Extractor - Precise code extraction using tree-sitter",
446+
prog="mcp-server-code-extractor"
447+
)
448+
parser.add_argument(
449+
"--version",
450+
action="version",
451+
version="mcp-server-code-extractor 0.2.3"
452+
)
453+
454+
# Parse args but ignore them for MCP server mode
455+
args = parser.parse_args()
456+
440457
# Initialize FastMCP server
441458
mcp = FastMCP("extract")
442459

0 commit comments

Comments
 (0)