-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
140 lines (116 loc) · 5.1 KB
/
Copy pathserver.py
File metadata and controls
140 lines (116 loc) · 5.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#!/usr/bin/env python3
import sys
from mcp.server.fastmcp import FastMCP
from config import config
from tools.context.code_indexer import index_project, get_symbol_info
from tools.context.dependency_graph import get_dependency_graph
from tools.context.project_stats import get_project_stats
from tools.knowledge.doc_search import search_docs
from tools.knowledge.package_info import get_package_info
from tools.knowledge.code_search import search_code_examples
from tools.knowledge.compatibility import check_compatibility
from tools.workflow.git_ops import git_status, git_history, git_branch_analysis
from tools.workflow.ci_github import ci_status, issue_list, pr_summary
from tools.specs.spec_manager import list_specs, get_spec, search_specs, create_spec
from tools.specs.scaffold import scaffold_project
from tools.specs.validator import validate_structure
mcp = FastMCP(
name="ai-coding",
instructions="""
AI Coding MCP Server provides structured data for coding tasks:
- Project context: index_project, get_symbol_info, get_dependency_graph, get_project_stats
- External knowledge: search_docs, get_package_info, search_code_examples, check_compatibility
- Workflow: git_status, git_history, git_branch_analysis, ci_status, issue_list, pr_summary
- Specs: list_specs, get_spec, search_specs, create_spec, scaffold_project, validate_structure
"""
)
@mcp.tool()
async def health_check() -> dict:
"""Health check endpoint."""
return {"status": "healthy", "version": "2.0.0"}
@mcp.tool()
async def tool_index_project(root_path: str, language: str = "python") -> dict:
"""Index project files and extract symbols."""
return await index_project(root_path, language)
@mcp.tool()
async def tool_get_symbol_info(root_path: str, symbol_name: str) -> dict:
"""Get information about a specific symbol."""
return await get_symbol_info(root_path, symbol_name)
@mcp.tool()
async def tool_get_dependency_graph(root_path: str, file_path: str) -> dict:
"""Get dependency graph for a file."""
return await get_dependency_graph(root_path, file_path)
@mcp.tool()
async def tool_get_project_stats(root_path: str) -> dict:
"""Get project statistics."""
return await get_project_stats(root_path)
@mcp.tool()
async def tool_search_docs(query: str, library: str = None, version: str = None) -> dict:
"""Search documentation."""
return await search_docs(query, library, version)
@mcp.tool()
async def tool_get_package_info(package_name: str, ecosystem: str) -> dict:
"""Get package information."""
return await get_package_info(package_name, ecosystem)
@mcp.tool()
async def tool_search_code_examples(query: str, language: str) -> dict:
"""Search code examples."""
return await search_code_examples(query, language)
@mcp.tool()
async def tool_check_compatibility(project_path: str) -> dict:
"""Check dependency compatibility."""
return await check_compatibility(project_path)
@mcp.tool()
async def tool_git_status(repo_path: str) -> dict:
"""Get git status."""
return await git_status(repo_path)
@mcp.tool()
async def tool_git_history(repo_path: str, file_path: str = None, author: str = None, since: str = None) -> dict:
"""Get git history."""
return await git_history(repo_path, file_path, author, since)
@mcp.tool()
async def tool_git_branch_analysis(repo_path: str) -> dict:
"""Analyze git branches."""
return await git_branch_analysis(repo_path)
@mcp.tool()
async def tool_ci_status(repo_path: str = None, repo_url: str = None) -> dict:
"""Get CI status."""
return await ci_status(repo_path, repo_url)
@mcp.tool()
async def tool_issue_list(repo_url: str, state: str = "open", labels: str = None) -> dict:
"""List issues."""
return await issue_list(repo_url, state, labels)
@mcp.tool()
async def tool_pr_summary(repo_url: str, pr_number: int = None) -> dict:
"""Get PR summary."""
return await pr_summary(repo_url, pr_number)
@mcp.tool()
async def tool_list_specs(project_path: str, type: str = None) -> dict:
"""List spec files."""
return await list_specs(project_path, type)
@mcp.tool()
async def tool_get_spec(project_path: str, spec_path: str) -> dict:
"""Get spec file content."""
return await get_spec(project_path, spec_path)
@mcp.tool()
async def tool_search_specs(project_path: str, query: str) -> dict:
"""Search specs."""
return await search_specs(project_path, query)
@mcp.tool()
async def tool_create_spec(project_path: str, type: str, name: str) -> dict:
"""Create new spec file."""
return await create_spec(project_path, type, name)
@mcp.tool()
async def tool_scaffold_project(template: str, target_path: str, params: dict) -> dict:
"""Scaffold new project from template."""
return await scaffold_project(template, target_path, params)
@mcp.tool()
async def tool_validate_structure(project_path: str, template: str = None) -> dict:
"""Validate project structure."""
return await validate_structure(project_path, template)
def main():
print("AI Coding MCP v2 starting...", file=sys.stderr)
print(f"Server: {config.server.host}:{config.server.port}", file=sys.stderr)
mcp.run()
if __name__ == "__main__":
main()