|
16 | 16 | from typing import AsyncIterator, Dict, Any, List |
17 | 17 |
|
18 | 18 | # Third-party imports |
19 | | -from mcp import types |
20 | 19 | from mcp.server.fastmcp import FastMCP, Context |
21 | 20 |
|
22 | 21 | # Local imports |
@@ -106,13 +105,7 @@ def get_file_content(file_path: str) -> str: |
106 | 105 | # Use FileService for simple file reading - this is appropriate for a resource |
107 | 106 | return FileService(ctx).get_file_content(file_path) |
108 | 107 |
|
109 | | -@mcp.resource("structure://project") |
110 | | -@handle_mcp_resource_errors |
111 | | -def get_project_structure() -> str: |
112 | | - """Get the structure of the project as a JSON tree.""" |
113 | | - ctx = mcp.get_context() |
114 | | - return ProjectManagementService(ctx).get_project_structure() |
115 | | - |
| 108 | +# Removed: structure://project resource - not necessary for most workflows |
116 | 109 | # Removed: settings://stats resource - this information is available via get_settings_info() tool |
117 | 110 | # and is more of a debugging/technical detail rather than context AI needs |
118 | 111 |
|
@@ -305,62 +298,7 @@ def configure_file_watcher( |
305 | 298 | return SystemManagementService(ctx).configure_file_watcher(enabled, debounce_seconds, additional_exclude_patterns) |
306 | 299 |
|
307 | 300 | # ----- PROMPTS ----- |
308 | | - |
309 | | -@mcp.prompt() |
310 | | -def analyze_code(file_path: str = "", query: str = "") -> list[types.PromptMessage]: |
311 | | - """Prompt for analyzing code in the project.""" |
312 | | - messages = [ |
313 | | - types.PromptMessage(role="user", content=types.TextContent(type="text", text=f"""I need you to analyze some code from my project. |
314 | | -
|
315 | | -{f'Please analyze the file: {file_path}' if file_path else ''} |
316 | | -{f'I want to understand: {query}' if query else ''} |
317 | | -
|
318 | | -First, let me give you some context about the project structure. Then, I'll provide the code to analyze. |
319 | | -""")), |
320 | | - types.PromptMessage( |
321 | | - role="assistant", |
322 | | - content=types.TextContent( |
323 | | - type="text", |
324 | | - text="I'll help you analyze the code. Let me first examine the project structure to get a better understanding of the codebase." |
325 | | - ) |
326 | | - ) |
327 | | - ] |
328 | | - return messages |
329 | | - |
330 | | -@mcp.prompt() |
331 | | -def code_search(query: str = "") -> types.TextContent: |
332 | | - """Prompt for searching code in the project.""" |
333 | | - search_text = "\"query\"" if not query else f"\"{query}\"" |
334 | | - return types.TextContent( |
335 | | - type="text", |
336 | | - text=f"""I need to search through my codebase for {search_text}. |
337 | | -
|
338 | | -Please help me find all occurrences of this query and explain what each match means in its context. |
339 | | -Focus on the most relevant files and provide a brief explanation of how each match is used in the code. |
340 | | -
|
341 | | -If there are too many results, prioritize the most important ones and summarize the patterns you see.""" |
342 | | - ) |
343 | | - |
344 | | -@mcp.prompt() |
345 | | -def set_project() -> list[types.PromptMessage]: |
346 | | - """Prompt for setting the project path.""" |
347 | | - messages = [ |
348 | | - types.PromptMessage(role="user", content=types.TextContent(type="text", text=""" |
349 | | - I need to analyze code from a project, but I haven't set the project path yet. Please help me set up the project path and index the code. |
350 | | -
|
351 | | - First, I need to specify which project directory to analyze. |
352 | | - """)), |
353 | | - types.PromptMessage(role="assistant", content=types.TextContent(type="text", text=""" |
354 | | - Before I can help you analyze any code, we need to set up the project path. This is a required first step. |
355 | | -
|
356 | | - Please provide the full path to your project folder. For example: |
357 | | - - Windows: "C:/Users/username/projects/my-project" |
358 | | - - macOS/Linux: "/home/username/projects/my-project" |
359 | | -
|
360 | | - Once you provide the path, I'll use the `set_project_path` tool to configure the code analyzer to work with your project. |
361 | | - """)) |
362 | | - ] |
363 | | - return messages |
| 301 | +# Removed: analyze_code, code_search, set_project prompts |
364 | 302 |
|
365 | 303 | def main(): |
366 | 304 | """Main function to run the MCP server.""" |
|
0 commit comments