Commit
·
6105447
1
Parent(s):
4cb4b8e
Add MCP server scaffold
Browse filesSigned-off-by: Aivin V. Solatorio <avsolatorio@gmail.com>
- .python-version +1 -0
- app.py +27 -4
- hello.py +6 -0
- pyproject.toml +9 -0
- requirements.txt +1 -0
- uv.lock +0 -0
.python-version
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
3.10
|
app.py
CHANGED
@@ -1,7 +1,30 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
def greet(name):
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
|
|
|
|
3 |
|
4 |
+
def letter_counter(word, letter):
|
5 |
+
"""
|
6 |
+
Count the number of occurrences of a letter in a word or text.
|
7 |
+
|
8 |
+
Args:
|
9 |
+
word (str): The input text to search through
|
10 |
+
letter (str): The letter to search for
|
11 |
+
|
12 |
+
Returns:
|
13 |
+
str: A message indicating how many times the letter appears
|
14 |
+
"""
|
15 |
+
word = word.lower()
|
16 |
+
letter = letter.lower()
|
17 |
+
count = word.count(letter)
|
18 |
+
return count
|
19 |
+
|
20 |
+
|
21 |
+
demo = gr.Interface(
|
22 |
+
fn=letter_counter,
|
23 |
+
inputs=["textbox", "textbox"],
|
24 |
+
outputs="number",
|
25 |
+
title="Letter Counter",
|
26 |
+
description="Enter text and a letter to count how many times the letter appears in the text.",
|
27 |
+
)
|
28 |
+
|
29 |
+
if __name__ == "__main__":
|
30 |
+
demo.launch(mcp_server=True)
|
hello.py
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
def main():
|
2 |
+
print("Hello from test-data-mcp-server!")
|
3 |
+
|
4 |
+
|
5 |
+
if __name__ == "__main__":
|
6 |
+
main()
|
pyproject.toml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[project]
|
2 |
+
name = "test-data-mcp-server"
|
3 |
+
version = "0.1.0"
|
4 |
+
description = "Add your description here"
|
5 |
+
readme = "README.md"
|
6 |
+
requires-python = ">=3.10"
|
7 |
+
dependencies = [
|
8 |
+
"gradio[mcp]>=5.29.1",
|
9 |
+
]
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
gradio[mcp]
|
uv.lock
ADDED
The diff for this file is too large to render.
See raw diff
|
|