Skip to main content
Glama

Evernote MCP Server

by Ak-9647
use_mcp_demo.py12.1 kB
#!/usr/bin/env python3 """ Live MCP Demo - Actually Using the Evernote MCP Server This script demonstrates the MCP server in action by creating real content in Evernote. """ import os import asyncio import json from datetime import datetime from evernote_mcp_server import ( configure_evernote, list_notebooks, search_notes, create_note, test_connection ) # Your Evernote developer token EVERNOTE_TOKEN = os.environ.get("EVERNOTE_DEVELOPER_TOKEN", "YOUR_TOKEN_HERE") async def live_mcp_demo(): """Live demonstration of the MCP server creating content in Evernote""" print("🚀 Live MCP Demo - Creating Content in Evernote") print("=" * 60) # Step 1: Configure the MCP server print("\n1️⃣ Configuring MCP Server with your token...") config_result = await configure_evernote(EVERNOTE_TOKEN, use_sandbox=False) if not config_result.get("success"): print(f"❌ Configuration failed: {config_result.get('error')}") return print(f"✅ Configuration successful!") print(f" Environment: {config_result.get('environment')}") print(f" User: {config_result.get('user', {}).get('username', 'Unknown')}") # Step 2: Test the connection print("\n2️⃣ Testing connection to Evernote API...") connection_test = await test_connection() if connection_test.get("success"): print("✅ Connection successful!") user_info = connection_test.get("user", {}) print(f" Connected as: {user_info.get('username', 'Unknown')}") print(f" User ID: {user_info.get('id', 'Unknown')}") else: print(f"❌ Connection failed: {connection_test.get('error')}") return # Step 3: List notebooks print("\n3️⃣ Retrieving your notebooks...") notebooks_result = await list_notebooks() if notebooks_result.get("success"): notebooks = notebooks_result.get("notebooks", []) print(f"✅ Found {len(notebooks)} notebooks:") for i, notebook in enumerate(notebooks[:5], 1): print(f" {i}. {notebook['name']} (GUID: {notebook['guid'][:8]}...)") # Get the first notebook for our demo note target_notebook = notebooks[0] if notebooks else None if target_notebook: print(f"\n📁 Will create note in: {target_notebook['name']}") else: print(f"❌ Failed to list notebooks: {notebooks_result.get('error')}") target_notebook = None # Step 4: Search existing notes print("\n4️⃣ Searching for existing notes...") search_result = await search_notes("MCP Demo", max_results=3) if search_result.get("success"): existing_notes = search_result.get("notes", []) print(f"✅ Found {len(existing_notes)} existing notes with 'MCP Demo':") for note in existing_notes: print(f" - {note['title']} (Created: {note['created']})") else: print(f"⚠️ Search completed with issues: {search_result.get('error')}") # Step 5: Create a new note with rich content print("\n5️⃣ Creating a new note in Evernote...") # Generate unique title with timestamp timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S") note_title = f"MCP Demo Note - {timestamp}" # Create rich HTML content note_content = f""" <h1>🚀 MCP Server Demo Note</h1> <p>This note was created by the <strong>Evernote MCP Server</strong> running in Cursor!</p> <h2>📋 Demo Details</h2> <ul> <li><strong>Created:</strong> {timestamp}</li> <li><strong>Server:</strong> Evernote MCP Server v1.0.0</li> <li><strong>Environment:</strong> Production</li> <li><strong>Token:</strong> {EVERNOTE_TOKEN[:10]}...</li> </ul> <h2>✨ What This Demonstrates</h2> <ol> <li>MCP server can connect to Evernote API</li> <li>Authentication with developer token works</li> <li>Note creation with rich HTML content</li> <li>Tagging and organization</li> <li>Real-time interaction from code</li> </ol> <h2>🔧 Technical Stack</h2> <ul> <li><strong>Protocol:</strong> Model Context Protocol (MCP)</li> <li><strong>API:</strong> Evernote EDAM API</li> <li><strong>Language:</strong> Python</li> <li><strong>Framework:</strong> FastMCP</li> </ul> <h2>🎯 Next Steps</h2> <p>This MCP server can now be used with:</p> <ul> <li>Claude Desktop for natural language interaction</li> <li>Direct Python integration</li> <li>Custom applications and workflows</li> </ul> <hr> <p><em>Generated by MCP Demo Script - {timestamp}</em></p> """ # Create the note create_result = await create_note( title=note_title, content=note_content, notebook_guid=target_notebook['guid'] if target_notebook else None, tags=["mcp", "demo", "evernote", "api", "cursor", "working"] ) if create_result.get("success"): note_info = create_result.get("note", {}) print("✅ Note created successfully!") print(f" Title: {note_info.get('title')}") print(f" GUID: {note_info.get('guid')}") print(f" Created: {note_info.get('created')}") print(f" Notebook: {note_info.get('notebookGuid')}") # Show the note URL (if available) if note_info.get('guid'): print(f"\n🔗 Note should be visible in your Evernote account!") else: print(f"❌ Note creation failed: {create_result.get('error')}") return # Step 6: Verify the note was created print("\n6️⃣ Verifying note creation...") verify_search = await search_notes("MCP Demo", max_results=5) if verify_search.get("success"): updated_notes = verify_search.get("notes", []) print(f"✅ Verification successful! Found {len(updated_notes)} notes with 'MCP Demo'") # Show the newest note (should be our created one) if updated_notes: newest_note = max(updated_notes, key=lambda x: x['created']) print(f" Newest: {newest_note['title']}") print(f" Created: {newest_note['created']}") print("\n🎉 Demo Complete!") print("=" * 60) print("✅ MCP Server successfully:") print(" - Connected to Evernote API") print(" - Listed your notebooks") print(" - Searched existing notes") print(" - Created a new note with rich content") print(" - Verified the creation") print("\n🚀 Your Evernote MCP server is fully functional!") async def interactive_demo(): """Interactive demonstration where user can choose what to create""" print("\n🎮 Interactive MCP Demo") print("=" * 40) print("What would you like to create in Evernote?") print("1. Meeting Notes") print("2. Project Ideas") print("3. Daily Journal Entry") print("4. Code Snippets") print("5. Custom Note") choice = input("\nEnter your choice (1-5): ").strip() templates = { "1": { "title": f"Meeting Notes - {datetime.now().strftime('%Y-%m-%d')}", "content": """ <h1>📅 Meeting Notes</h1> <p><strong>Date:</strong> {}</p> <p><strong>Attendees:</strong> [Add attendees]</p> <h2>📋 Agenda</h2> <ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ul> <h2>💬 Discussion Points</h2> <p>[Add discussion notes here]</p> <h2>✅ Action Items</h2> <ul> <li>[ ] Task 1</li> <li>[ ] Task 2</li> <li>[ ] Task 3</li> </ul> """.format(datetime.now().strftime('%Y-%m-%d')), "tags": ["meeting", "notes", "work"] }, "2": { "title": f"Project Ideas - {datetime.now().strftime('%Y-%m-%d')}", "content": """ <h1>💡 Project Ideas</h1> <p><strong>Date:</strong> {}</p> <h2>🚀 New Ideas</h2> <ul> <li><strong>Idea 1:</strong> Description here</li> <li><strong>Idea 2:</strong> Description here</li> <li><strong>Idea 3:</strong> Description here</li> </ul> <h2>📊 Priority Matrix</h2> <p><strong>High Priority:</strong></p> <ul> <li>Project A</li> </ul> <p><strong>Medium Priority:</strong></p> <ul> <li>Project B</li> </ul> <h2>🔍 Research Needed</h2> <p>[Add research items here]</p> """.format(datetime.now().strftime('%Y-%m-%d')), "tags": ["ideas", "projects", "planning"] }, "3": { "title": f"Daily Journal - {datetime.now().strftime('%Y-%m-%d')}", "content": """ <h1>📖 Daily Journal Entry</h1> <p><strong>Date:</strong> {}</p> <h2>🌅 Morning Thoughts</h2> <p>[What are you thinking about this morning?]</p> <h2>🎯 Today's Goals</h2> <ul> <li>Goal 1</li> <li>Goal 2</li> <li>Goal 3</li> </ul> <h2>💭 Reflections</h2> <p>[End of day reflections]</p> <h2>📝 Notes</h2> <p>[Any additional notes]</p> """.format(datetime.now().strftime('%Y-%m-%d')), "tags": ["journal", "daily", "personal"] }, "4": { "title": f"Code Snippets - {datetime.now().strftime('%Y-%m-%d')}", "content": """ <h1>💻 Code Snippets</h1> <p><strong>Date:</strong> {}</p> <h2>🐍 Python</h2> <pre><code> def hello_world(): print("Hello from MCP!") return "Success" </code></pre> <h2>🌐 JavaScript</h2> <pre><code> function greet() {{ console.log("Hello from MCP!"); return "Success"; }} </code></pre> <h2>📝 Notes</h2> <p>Add your code snippets and notes here...</p> """.format(datetime.now().strftime('%Y-%m-%d')), "tags": ["code", "snippets", "programming"] }, "5": { "title": input("Enter note title: "), "content": f"<h1>Custom Note</h1><p>Created: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}</p><p>" + input("Enter note content: ") + "</p>", "tags": ["custom", "mcp"] } } if choice in templates: template = templates[choice] print(f"\n📝 Creating: {template['title']}") result = await create_note( title=template['title'], content=template['content'], tags=template['tags'] ) if result.get("success"): print("✅ Note created successfully!") print(f" Title: {result['note']['title']}") print(f" GUID: {result['note']['guid']}") else: print(f"❌ Failed to create note: {result.get('error')}") else: print("❌ Invalid choice") if __name__ == "__main__": print("🎬 Starting Live MCP Demonstration") # First run the main demo asyncio.run(live_mcp_demo()) # Then offer interactive demo print("\n" + "="*60) choice = input("\nWould you like to try the interactive demo? (y/N): ") if choice.lower() == 'y': asyncio.run(interactive_demo()) print("\n🎯 Demo session complete!") print("Check your Evernote account to see the created notes! 📝")

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Ak-9647/Evernote-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server