nbiish commited on
Commit
554ba9b
·
unverified ·
1 Parent(s): 0391012

feat: implement native Gradio MCP server support

Browse files
Files changed (4) hide show
  1. README.md +26 -0
  2. app.py +1 -27
  3. pyproject.toml +1 -2
  4. requirements.txt +1 -2
README.md CHANGED
@@ -51,3 +51,29 @@ Ghost Dance protocol
51
  ## Copyright
52
 
53
  Copyright © 2025 ᓂᐲᔥ ᐙᐸᓂᒥᑮ-ᑭᓇᐙᐸᑭᓯ (Nbiish Waabanimikii-Kinawaabakizi), also known legally as JUSTIN PAUL KENWABIKISE, professionally documented as Nbiish-Justin Paul Kenwabikise, Anishinaabek Dodem (Anishinaabe Clan): Animikii (Thunder), a descendant of Chief ᑭᓇᐙᐸᑭᓯ (Kinwaabakizi) of the Beaver Island Band, and an enrolled member of the sovereign Grand Traverse Band of Ottawa and Chippewa Indians. This work embodies Traditional Knowledge and Traditional Cultural Expressions. All rights reserved.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  ## Copyright
52
 
53
  Copyright © 2025 ᓂᐲᔥ ᐙᐸᓂᒥᑮ-ᑭᓇᐙᐸᑭᓯ (Nbiish Waabanimikii-Kinawaabakizi), also known legally as JUSTIN PAUL KENWABIKISE, professionally documented as Nbiish-Justin Paul Kenwabikise, Anishinaabek Dodem (Anishinaabe Clan): Animikii (Thunder), a descendant of Chief ᑭᓇᐙᐸᑭᓯ (Kinwaabakizi) of the Beaver Island Band, and an enrolled member of the sovereign Grand Traverse Band of Ottawa and Chippewa Indians. This work embodies Traditional Knowledge and Traditional Cultural Expressions. All rights reserved.
54
+
55
+ ## MCP Server (AI Integration)
56
+
57
+ GhostDance supports the Model Context Protocol (MCP). This allows AI tools like Cursor, Claude Desktop, or Cline to use the Ghost Dance calculation directly as a tool.
58
+
59
+ ### How to use in Cursor:
60
+
61
+ 1. **Install Dependencies**: Ensure you have `gradio[mcp]` installed:
62
+ ```bash
63
+ pip install "gradio[mcp]"
64
+ ```
65
+ 2. **Run the App**: Start the GhostDance application:
66
+ ```bash
67
+ python app.py
68
+ ```
69
+ The app will start the web UI and the MCP server. Look for the MCP SSE URL in the console (usually `http://127.0.0.1:7860/gradio_api/mcp/sse`).
70
+
71
+ 3. **Configure Cursor**:
72
+ * Open Cursor Settings.
73
+ * Navigate to **Features** -> **MCP**.
74
+ * Click **+ Add New MCP Server**.
75
+ * **Name**: `GhostDance`
76
+ * **Type**: `sse`
77
+ * **URL**: `http://127.0.0.1:7860/gradio_api/mcp/sse`
78
+
79
+ Once configured, you can ask Cursor to "Calculate Ghost Dance stride for a weight of 180 lbs" and it will use the tool automatically.
app.py CHANGED
@@ -1,9 +1,4 @@
1
  import gradio as gr
2
- from fastmcp import FastMCP
3
- import sys
4
-
5
- # Create MCP server
6
- mcp = FastMCP("GhostDance")
7
 
8
  # Constants from the patent
9
  # Updated to match the patent more precisely: 50.909573606
@@ -36,23 +31,6 @@ def calculate_step(weight: float, unit: str):
36
  f"{half_feet:.3f} feet"
37
  )
38
 
39
- # Register MCP tool
40
- @mcp.tool()
41
- def ghost_dance_calculation(weight: float, unit: str = "pounds") -> str:
42
- """
43
- Calculate the required step length for the Ghost Dance.
44
-
45
- Args:
46
- weight: Weight of the person.
47
- unit: Unit of weight ('pounds' or 'kilograms').
48
- """
49
- full_m, full_f, half_m, half_f = calculate_step(weight, unit)
50
- return (
51
- f"To perform the Ghost Dance at your weight ({weight} {unit}):\n"
52
- f"- Full Step (1.0s): {full_m} ({full_f})\n"
53
- f"- Half Step (0.5s): {half_m} ({half_f})"
54
- )
55
-
56
  # Gradio UI
57
  with gr.Blocks(title="Ghost Dance - A continued prophecy") as demo:
58
  gr.HTML("<h1 style='text-align: center;'>Ghost Dance - A continued prophecy</h1>")
@@ -105,8 +83,4 @@ with gr.Blocks(title="Ghost Dance - A continued prophecy") as demo:
105
  """)
106
 
107
  if __name__ == "__main__":
108
- # Check for mcp argument
109
- if len(sys.argv) > 1 and sys.argv[1] == "mcp":
110
- mcp.run()
111
- else:
112
- demo.launch()
 
1
  import gradio as gr
 
 
 
 
 
2
 
3
  # Constants from the patent
4
  # Updated to match the patent more precisely: 50.909573606
 
31
  f"{half_feet:.3f} feet"
32
  )
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  # Gradio UI
35
  with gr.Blocks(title="Ghost Dance - A continued prophecy") as demo:
36
  gr.HTML("<h1 style='text-align: center;'>Ghost Dance - A continued prophecy</h1>")
 
83
  """)
84
 
85
  if __name__ == "__main__":
86
+ demo.launch(mcp_server=True)
 
 
 
 
pyproject.toml CHANGED
@@ -6,7 +6,6 @@ readme = "README.md"
6
  requires-python = ">=3.13"
7
  dependencies = [
8
  "docling>=2.66.0",
9
- "fastmcp>=2.14.2",
10
- "gradio>=6.2.0",
11
  "streamlit>=1.40.2",
12
  ]
 
6
  requires-python = ">=3.13"
7
  dependencies = [
8
  "docling>=2.66.0",
9
+ "gradio[mcp]>=6.2.0",
 
10
  "streamlit>=1.40.2",
11
  ]
requirements.txt CHANGED
@@ -1,4 +1,3 @@
1
- fastmcp>=2.14.2
2
- gradio>=6.2.0
3
  streamlit>=1.40.2
4
 
 
1
+ gradio[mcp]>=6.2.0
 
2
  streamlit>=1.40.2
3