Abid Ali Awan
commited on
Commit
Β·
ff1fa38
1
Parent(s):
146552c
Update SDK version to 5.33.0, enhance README with integration instructions for SSE and stdio clients, and improve descriptions in app.py for code analysis and scoring features.
Browse files- README.md +33 -1
- requirements.txt +0 -2
- src/app.py +4 -3
README.md
CHANGED
@@ -4,7 +4,7 @@ emoji: π§βπ»
|
|
4 |
colorFrom: gray
|
5 |
colorTo: yellow
|
6 |
sdk: gradio
|
7 |
-
sdk_version: 5.
|
8 |
app_file: src/app.py
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
@@ -57,6 +57,38 @@ This project is a Gradio-based MCP server that provides two code analysis functi
|
|
57 |
|
58 |
To test this MCP server, you can create a new chat in agent mode of the Cursor using (CTRL +T) and ask for a code analysis report (e.g., "analyze this Python code: print('hello')"). Cursor will ask for permission to run the MCP tool. Approve it.
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
### Sample Prompts
|
61 |
|
62 |
Here are a few ways you can ask Cursor AI to use these tools:
|
|
|
4 |
colorFrom: gray
|
5 |
colorTo: yellow
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 5.33.0
|
8 |
app_file: src/app.py
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
|
|
57 |
|
58 |
To test this MCP server, you can create a new chat in agent mode of the Cursor using (CTRL +T) and ask for a code analysis report (e.g., "analyze this Python code: print('hello')"). Cursor will ask for permission to run the MCP tool. Approve it.
|
59 |
|
60 |
+
### Integration with other clients
|
61 |
+
|
62 |
+
For clients that support SSE (e.g. Cursor, Windsurf, Cline), simply add the following configuration to your MCP config:
|
63 |
+
|
64 |
+
```json
|
65 |
+
{
|
66 |
+
"mcpServers": {
|
67 |
+
"gradio": {
|
68 |
+
"url": "https://agents-mcp-hackathon-code-analysis-mcp.hf.space/gradio_api/mcp/sse"
|
69 |
+
}
|
70 |
+
}
|
71 |
+
}
|
72 |
+
```
|
73 |
+
|
74 |
+
For clients that only support stdio, first install Node.js. Then, you can use the following command:
|
75 |
+
|
76 |
+
```json
|
77 |
+
{
|
78 |
+
"mcpServers": {
|
79 |
+
"gradio": {
|
80 |
+
"command": "npx",
|
81 |
+
"args": [
|
82 |
+
"mcp-remote",
|
83 |
+
"https://agents-mcp-hackathon-code-analysis-mcp.hf.space/gradio_api/mcp/sse",
|
84 |
+
"--transport",
|
85 |
+
"sse-only"
|
86 |
+
]
|
87 |
+
}
|
88 |
+
}
|
89 |
+
}
|
90 |
+
```
|
91 |
+
|
92 |
### Sample Prompts
|
93 |
|
94 |
Here are a few ways you can ask Cursor AI to use these tools:
|
requirements.txt
CHANGED
@@ -1,6 +1,4 @@
|
|
1 |
python-dotenv>=1.1.0
|
2 |
-
gradio==5.32.1
|
3 |
-
gradio[mcp]==5.32.1
|
4 |
mistralai==1.8.1
|
5 |
openai==1.84.0
|
6 |
anthropic==0.52.2
|
|
|
1 |
python-dotenv>=1.1.0
|
|
|
|
|
2 |
mistralai==1.8.1
|
3 |
openai==1.84.0
|
4 |
anthropic==0.52.2
|
src/app.py
CHANGED
@@ -12,21 +12,22 @@ analysis_report_demo = gr.Interface(
|
|
12 |
fn=code_analysis_report,
|
13 |
inputs=gr.Textbox(label="Enter Code Here", lines=20),
|
14 |
outputs=gr.Textbox(label="Analysis Report", lines=20),
|
15 |
-
description="Generate a
|
16 |
)
|
17 |
|
18 |
code_score_demo = gr.Interface(
|
19 |
fn=code_analysis_score,
|
20 |
inputs=gr.Textbox(label="Enter Code Here", lines=20),
|
21 |
outputs=gr.JSON(label="Code Score"),
|
22 |
-
description="Generate a
|
23 |
)
|
24 |
|
25 |
# Create tabbed interface
|
26 |
demo = gr.TabbedInterface(
|
27 |
[analysis_report_demo, code_score_demo],
|
28 |
["Code Analysis Report", "Code Score"],
|
29 |
-
title="Code Analysis Server",
|
|
|
30 |
)
|
31 |
|
32 |
if __name__ == "__main__":
|
|
|
12 |
fn=code_analysis_report,
|
13 |
inputs=gr.Textbox(label="Enter Code Here", lines=20),
|
14 |
outputs=gr.Textbox(label="Analysis Report", lines=20),
|
15 |
+
description="Generate a detailed code analysis report with top fixes. Please read the [documentation](https://huggingface.co/spaces/Agents-MCP-Hackathon/code-analysis-mcp/blob/main/README.md) for more details.",
|
16 |
)
|
17 |
|
18 |
code_score_demo = gr.Interface(
|
19 |
fn=code_analysis_score,
|
20 |
inputs=gr.Textbox(label="Enter Code Here", lines=20),
|
21 |
outputs=gr.JSON(label="Code Score"),
|
22 |
+
description="Generate a vulnerability, style, and quality code score. Please read the [documentation](https://huggingface.co/spaces/Agents-MCP-Hackathon/code-analysis-mcp/blob/main/README.md) for more details.",
|
23 |
)
|
24 |
|
25 |
# Create tabbed interface
|
26 |
demo = gr.TabbedInterface(
|
27 |
[analysis_report_demo, code_score_demo],
|
28 |
["Code Analysis Report", "Code Score"],
|
29 |
+
title="Code Scoring & Analysis MCP Server",
|
30 |
+
theme=gr.themes.Soft(),
|
31 |
)
|
32 |
|
33 |
if __name__ == "__main__":
|