Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -609,45 +609,149 @@ with gr.Blocks(title="🚦 Router MCP", css="""
|
|
| 609 |
<p>Your Gateway to Optimal MCP Servers in Seconds</p>
|
| 610 |
''')
|
| 611 |
|
| 612 |
-
with gr.
|
| 613 |
-
with gr.
|
| 614 |
-
gr.Markdown("### Search MCP servers using natural language query")
|
| 615 |
-
query_input = gr.Textbox(
|
| 616 |
-
label="Describe the MCP Server you're looking for",
|
| 617 |
-
placeholder="e.g., 'I need an MCP Server that can generate images'"
|
| 618 |
-
)
|
| 619 |
-
|
| 620 |
-
gr.Markdown("### Select sources to search")
|
| 621 |
-
hf_checkbox = gr.Checkbox(label="Hugging Face Spaces", value=True)
|
| 622 |
-
smithery_checkbox = gr.Checkbox(label="Smithery", value=False)
|
| 623 |
-
registry_checkbox = gr.Checkbox(label="Registry (Coming Soon)", value=False, interactive=False)
|
| 624 |
-
|
| 625 |
-
result_limit = gr.Number(
|
| 626 |
-
label="Maximum number of results for each source",
|
| 627 |
-
value=3,
|
| 628 |
-
minimum=1,
|
| 629 |
-
maximum=20,
|
| 630 |
-
step=1
|
| 631 |
-
)
|
| 632 |
-
|
| 633 |
-
gr.Markdown("### Select your OS")
|
| 634 |
-
client_radio = gr.Radio(
|
| 635 |
-
choices=["Mac/Linux", "Windows", "WSL"],
|
| 636 |
-
label="Choose your operating system to get the appropriate command format",
|
| 637 |
-
value="Mac/Linux", # Default back to Mac/Linux
|
| 638 |
-
interactive=True,
|
| 639 |
-
elem_id="client_radio"
|
| 640 |
-
)
|
| 641 |
-
|
| 642 |
with gr.Row():
|
| 643 |
-
|
| 644 |
-
|
| 645 |
-
|
| 646 |
-
|
| 647 |
-
|
| 648 |
-
|
| 649 |
-
|
| 650 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
| 615 |
+
with gr.Column():
|
| 616 |
+
gr.Markdown("""
|
| 617 |
+
Router MCP is a powerful tool that helps you discover and connect to MCP servers.
|
| 618 |
+
Whether you're looking for specific functionality or exploring new possibilities,
|
| 619 |
+
Router MCP makes it easy to find the perfect server for your needs.
|
| 620 |
+
|
| 621 |
+
### How to Use Router MCP
|
| 622 |
+
|
| 623 |
+
1. **Enter Your Query**
|
| 624 |
+
- Type a natural language description of the MCP Server you're looking for
|
| 625 |
+
- Be as specific or general as you need
|
| 626 |
+
|
| 627 |
+
2. **Select Search Sources**
|
| 628 |
+
- Choose where to search for MCP Servers
|
| 629 |
+
- Currently supports Hugging Face Spaces and Smithery
|
| 630 |
+
- Note: Anthropic's Registry is under development and not yet available
|
| 631 |
+
|
| 632 |
+
3. **Choose Your OS**
|
| 633 |
+
- Select your operating system (Mac/Linux, Windows, or WSL)
|
| 634 |
+
- This ensures you get the correct configuration format for your system
|
| 635 |
+
|
| 636 |
+
4. **Choose Search Type**
|
| 637 |
+
- **Keyword Search**: Use when you have specific terms or names in mind
|
| 638 |
+
- **Semantic Search**: Use when you want to find servers based on meaning and intent
|
| 639 |
+
- Both methods will return ready-to-use MCP configurations
|
| 640 |
+
|
| 641 |
+
### Understanding Search Results
|
| 642 |
+
|
| 643 |
+
The search results will show MCP Servers from different sources, each with their own format:
|
| 644 |
+
|
| 645 |
+
#### Hugging Face Spaces Results
|
| 646 |
+
- **id**: The Space's unique identifier
|
| 647 |
+
- **likes**: Number of likes the Space has received
|
| 648 |
+
- **trending_score**: The Space's popularity score
|
| 649 |
+
- **source**: Always "huggingface"
|
| 650 |
+
- **configuration**: Ready-to-use MCP configuration for SSE connection
|
| 651 |
+
|
| 652 |
+
#### Smithery Results
|
| 653 |
+
- **id**: The server's qualified name (e.g., "author/server-name")
|
| 654 |
+
- **name**: Display name of the server
|
| 655 |
+
- **description**: Detailed description of the server's capabilities
|
| 656 |
+
- **likes**: Number of times the server has been used
|
| 657 |
+
- **source**: Always "smithery"
|
| 658 |
+
- **configuration**: OS-specific MCP configuration (requires your Smithery key)
|
| 659 |
+
|
| 660 |
+
> Note: For Smithery servers, you'll need to replace "YOUR_SMITHERY_KEY" in the configuration with your actual Smithery API key.
|
| 661 |
+
""")
|
| 662 |
+
with gr.Column():
|
| 663 |
+
gr.Markdown("""
|
| 664 |
+
### Features
|
| 665 |
+
|
| 666 |
+
- **Multi-Source Search**: Search across Hugging Face Spaces and Smithery
|
| 667 |
+
- **Smart Search**: Choose between keyword and semantic search
|
| 668 |
+
- **OS-Specific Configs**: Get configurations tailored to your operating system
|
| 669 |
+
- **Ready-to-Use**: Direct integration with MCP-compatible clients
|
| 670 |
+
""")
|
| 671 |
+
|
| 672 |
+
with gr.Tab("Try Router MCP"):
|
| 673 |
+
with gr.Row():
|
| 674 |
+
with gr.Column():
|
| 675 |
+
gr.Markdown("### Search MCP servers using natural language query")
|
| 676 |
+
query_input = gr.Textbox(
|
| 677 |
+
label="Describe the MCP Server you're looking for",
|
| 678 |
+
placeholder="e.g., 'I need an MCP Server that can generate images'"
|
| 679 |
+
)
|
| 680 |
+
|
| 681 |
+
gr.Markdown("### Select sources to search")
|
| 682 |
+
hf_checkbox = gr.Checkbox(label="Hugging Face Spaces", value=True)
|
| 683 |
+
smithery_checkbox = gr.Checkbox(label="Smithery", value=False)
|
| 684 |
+
registry_checkbox = gr.Checkbox(label="Registry (Coming Soon)", value=False, interactive=False)
|
| 685 |
+
|
| 686 |
+
result_limit = gr.Number(
|
| 687 |
+
label="Maximum number of results for each source",
|
| 688 |
+
value=3,
|
| 689 |
+
minimum=1,
|
| 690 |
+
maximum=20,
|
| 691 |
+
step=1
|
| 692 |
+
)
|
| 693 |
+
|
| 694 |
+
gr.Markdown("### Select your OS")
|
| 695 |
+
client_radio = gr.Radio(
|
| 696 |
+
choices=["Mac/Linux", "Windows", "WSL"],
|
| 697 |
+
label="Choose your operating system to get the appropriate command format",
|
| 698 |
+
value="Mac/Linux",
|
| 699 |
+
interactive=True,
|
| 700 |
+
elem_id="client_radio"
|
| 701 |
+
)
|
| 702 |
+
|
| 703 |
+
with gr.Row():
|
| 704 |
+
keyword_search_button = gr.Button("Keyword Search")
|
| 705 |
+
semantic_search_button = gr.Button("Semantic Search")
|
| 706 |
+
|
| 707 |
+
with gr.Column():
|
| 708 |
+
results_output = gr.JSON(
|
| 709 |
+
label="Search Results",
|
| 710 |
+
elem_id="results_output"
|
| 711 |
+
)
|
| 712 |
+
|
| 713 |
+
with gr.Tab("How to Integrate"):
|
| 714 |
+
gr.Markdown("""
|
| 715 |
+
### Integration Guide
|
| 716 |
+
|
| 717 |
+
To integrate Router MCP with your preferred client, follow these instructions:
|
| 718 |
+
|
| 719 |
+
#### For SSE-Supported Clients
|
| 720 |
+
For clients that support SSE (e.g., Cursor, Windsurf, Cline), add this configuration to your MCP config:
|
| 721 |
+
|
| 722 |
+
```json
|
| 723 |
+
{
|
| 724 |
+
"mcpServers": {
|
| 725 |
+
"gradio": {
|
| 726 |
+
"url": "https://agents-mcp-hackathon-router-mcp.hf.space/gradio_api/mcp/sse"
|
| 727 |
+
}
|
| 728 |
+
}
|
| 729 |
+
}
|
| 730 |
+
```
|
| 731 |
+
|
| 732 |
+
#### For stdio-Only Clients
|
| 733 |
+
For clients that only support stdio (e.g., Claude Desktop):
|
| 734 |
+
1. First, install Node.js
|
| 735 |
+
2. Add this configuration to your MCP config:
|
| 736 |
+
|
| 737 |
+
```json
|
| 738 |
+
{
|
| 739 |
+
"mcpServers": {
|
| 740 |
+
"gradio": {
|
| 741 |
+
"command": "npx",
|
| 742 |
+
"args": [
|
| 743 |
+
"mcp-remote",
|
| 744 |
+
"https://agents-mcp-hackathon-router-mcp.hf.space/gradio_api/mcp/sse",
|
| 745 |
+
"--transport",
|
| 746 |
+
"sse-only"
|
| 747 |
+
]
|
| 748 |
+
}
|
| 749 |
+
}
|
| 750 |
+
}
|
| 751 |
+
```
|
| 752 |
+
|
| 753 |
+
For more information about MCP, check out the [Gradio documentation](https://gradio.app/docs/mcp).
|
| 754 |
+
""")
|
| 755 |
|
| 756 |
# Set up event handlers
|
| 757 |
def get_sources():
|