import gradio as gr from modules.raindrop import get_latest_feed, add_bookmark, search_by_tag, search_bookmarks # Introduction content INTRO_CONTENT = """ # Welcome to Raindrop.io MCP Interface This interface allows you to interact with your Raindrop.io bookmarks through various functions: ## Available Features: 1. **Latest Feed** - Get your most recent bookmarks 2. **Add Bookmark** - Add new bookmarks to your collection 3. **Search by Tag** - Find bookmarks with specific tags 4. **Search Bookmarks** - Search through your bookmarks by keywords ## Setup Requirements: Make sure you have set the `RAINDROP_TOKEN` environment variable with your Raindrop.io API token. ## How to get your API token: 1. Go to https://app.raindrop.io/settings/integrations 2. Create a new integration 3. Copy the generated token 4. Set it as an environment variable: `export RAINDROP_TOKEN="your_token_here"` Enjoy managing your bookmarks! """ raindrop_mcp = gr.TabbedInterface( interface_list=[ gr.Interface( fn=lambda: INTRO_CONTENT, inputs=[], outputs=gr.Markdown(label="Introduction"), title="Introduction", description="Welcome to the Raindrop.io MCP Interface" ), gr.Interface( fn=get_latest_feed, inputs=gr.Number(label="Number of bookmarks", value=10, minimum=1, maximum=50), outputs=gr.Textbox(label="Latest Feed", lines=10), title="Get Latest Feed", description="Fetch the most recent bookmarks from your Raindrop.io collection" ), # gr.Interface( # fn=add_bookmark, # inputs=[ # gr.Textbox(label="URL", placeholder="https://example.com"), # gr.Textbox(label="Title (optional)", placeholder="Bookmark title"), # gr.Textbox(label="Description (optional)", placeholder="Bookmark description"), # gr.Textbox(label="Tags (comma-separated, optional)", placeholder="tag1, tag2, tag3"), # gr.Number(label="Collection ID (optional)", value=0) # ], # outputs=gr.Textbox(label="Result", lines=5), # title="Add Bookmark", # description="Add a new bookmark to your Raindrop.io collection" # ), gr.Interface( fn=search_by_tag, inputs=[ gr.Textbox(label="Tag", placeholder="Enter tag to search for"), gr.Number(label="Collection ID (optional)", value=0), gr.Number(label="Count", value=10, minimum=1, maximum=50), gr.Textbox(label="From Date (YYYY-MM-DD, optional)", placeholder="2024-01-01"), gr.Textbox(label="To Date (YYYY-MM-DD, optional)", placeholder="2024-12-31") ], outputs=gr.Textbox(label="Search Results", lines=10), title="Search by Tag", description="Search for bookmarks with a specific tag" ), gr.Interface( fn=search_bookmarks, inputs=[ gr.Textbox(label="Search Query", placeholder="Enter search terms"), gr.Number(label="Collection ID (optional)", value=0), gr.Number(label="Count", value=10, minimum=1, maximum=50), gr.Textbox(label="From Date (YYYY-MM-DD, optional)", placeholder="2024-01-01"), gr.Textbox(label="To Date (YYYY-MM-DD, optional)", placeholder="2024-12-31") ], outputs=gr.Textbox(label="Search Results", lines=10), title="Search Bookmarks", description="Search for bookmarks by keyword or text content" ) ], tab_names=["Introduction", "Latest Feed", "Search by Tag", "Search Bookmarks"] ) if __name__ == "__main__": raindrop_mcp.launch(mcp_server=True)