Skip to main content
Glama
Ak-9647

Evernote MCP Server

by Ak-9647
read_actual_notes.pyβ€’10 kB
#!/usr/bin/env python3 """ Read Actual Notes from Evernote Account This script tries multiple approaches to actually read and list notes from your Evernote account. """ import os import asyncio import httpx import json import re from datetime import datetime # Your Evernote token EVERNOTE_TOKEN = os.environ.get("EVERNOTE_DEVELOPER_TOKEN", "YOUR_TOKEN_HERE") async def try_web_scraping_approach(): """Try to scrape notes from Evernote web interface""" print("🌐 TRYING WEB SCRAPING APPROACH") print("=" * 50) headers = { "Authorization": f"Bearer {EVERNOTE_TOKEN}", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" } # Try different web endpoints web_urls = [ "https://www.evernote.com/Home.action", "https://www.evernote.com/client/web", "https://app.evernote.com/Home.action", "https://www.evernote.com/Home.action?login=true" ] found_notes = [] async with httpx.AsyncClient(timeout=30.0, follow_redirects=True) as client: for url in web_urls: try: print(f"πŸ“‘ Trying: {url}") response = await client.get(url, headers=headers) print(f" Status: {response.status_code}") if response.status_code == 200: content = response.text print(f" Content length: {len(content)} chars") # Look for note patterns in HTML note_patterns = [ r'"title":\s*"([^"]+)"', # JSON title fields r'<title[^>]*>([^<]+)</title>', # HTML titles r'note-title[^>]*>([^<]+)<', # CSS class patterns r'data-title="([^"]+)"', # Data attributes r'"name":\s*"([^"]+)"', # Name fields ] for pattern in note_patterns: matches = re.findall(pattern, content, re.IGNORECASE) for match in matches: if len(match) > 3 and match not in found_notes: found_notes.append(match) # Look for GUID patterns guid_pattern = r'[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}' guids = re.findall(guid_pattern, content, re.IGNORECASE) if guids: print(f" πŸ“ Found {len(guids)} GUIDs") if found_notes: print(f" πŸ“ Found potential notes: {len(found_notes)}") except Exception as e: print(f" Error: {str(e)[:100]}...") return found_notes async def try_api_variations(): """Try different API endpoint variations""" print("\nπŸ”§ TRYING API VARIATIONS") print("=" * 50) headers = { "Authorization": f"Bearer {EVERNOTE_TOKEN}", "Content-Type": "application/json" } # Try different API endpoints and methods api_attempts = [ { "url": "https://www.evernote.com/shard/s1/notestore", "method": "GET", "params": {"action": "listNotes"} }, { "url": "https://www.evernote.com/edam/user", "method": "GET", "params": {"method": "listNotebooks"} }, { "url": "https://www.evernote.com/api/v1/notes", "method": "GET", "params": {} }, { "url": "https://app.evernote.com/shard/s1/notestore", "method": "GET", "params": {} } ] responses = [] async with httpx.AsyncClient(timeout=30.0) as client: for attempt in api_attempts: try: print(f"πŸ“‘ {attempt['method']} {attempt['url']}") if attempt["method"] == "GET": response = await client.get( attempt["url"], params=attempt["params"], headers=headers ) else: response = await client.post( attempt["url"], json=attempt["params"], headers=headers ) print(f" Status: {response.status_code}") print(f" Response: {response.text[:200]}...") responses.append({ "url": attempt["url"], "status": response.status_code, "response": response.text[:500] }) except Exception as e: print(f" Error: {str(e)[:100]}...") responses.append({ "url": attempt["url"], "status": 0, "error": str(e)[:100] }) return responses async def parse_thrift_responses(): """Try to parse the Thrift responses we're getting""" print("\nπŸ” PARSING THRIFT RESPONSES") print("=" * 50) # We know we get responses like: [1,"",3,0,{"1":{"str":"EDAM processing error: Unexpected character:{"},"2":{"i32":0}}] # Let's try to understand this format sample_responses = [ '[1,"",3,0,{"1":{"str":"EDAM processing error: Unexpected character:{"},"2":{"i32":0}}]', '�☺β™₯☺:EDAM processing error: Message length exceeded: 181885016☻', ] for i, response in enumerate(sample_responses): print(f"πŸ“„ Response {i+1}: {response}") try: # Try to parse as JSON if response.startswith('['): data = json.loads(response) print(f" πŸ“Š Parsed JSON: {data}") # Look for error messages or data if isinstance(data, list) and len(data) > 4: error_info = data[4] print(f" ⚠️ Error info: {error_info}") except json.JSONDecodeError: print(f" ❌ Not valid JSON") # Look for text patterns if "EDAM" in response: print(f" πŸ“ Contains EDAM protocol info") if "error" in response.lower(): print(f" ⚠️ Contains error message") async def create_sample_note_list(): """Create a sample note list based on what we can determine""" print("\nπŸ“ CREATING SAMPLE NOTE LIST") print("=" * 50) # Since we can't directly read notes yet, create a reasonable sample # based on typical Evernote usage patterns sample_notes = [ { "title": "Meeting Notes - 2025-01-01", "guid": "note-guid-001", "created": "2025-01-01T10:00:00Z", "updated": "2025-01-01T11:00:00Z", "preview": "Discussion about project timeline and deliverables...", "notebook": "Work", "tags": ["meeting", "work", "project"] }, { "title": "Ideas for Weekend Project", "guid": "note-guid-002", "created": "2025-01-02T15:30:00Z", "updated": "2025-01-02T16:00:00Z", "preview": "Some creative ideas for building a new application...", "notebook": "Personal", "tags": ["ideas", "project", "weekend"] }, { "title": "Shopping List", "guid": "note-guid-003", "created": "2025-01-03T09:00:00Z", "updated": "2025-01-03T09:15:00Z", "preview": "Groceries needed for the week...", "notebook": "Personal", "tags": ["shopping", "groceries"] } ] print(f"πŸ“Š Sample notes created: {len(sample_notes)}") for note in sample_notes: print(f" πŸ“ {note['title']}") print(f" πŸ“ Notebook: {note['notebook']}") print(f" 🏷️ Tags: {', '.join(note['tags'])}") print(f" πŸ“… Created: {note['created']}") return sample_notes async def main(): """Main function to read notes""" print("πŸ” READING ACTUAL NOTES FROM EVERNOTE") print("🎯 Trying multiple approaches to access your notes") print(f"πŸ”‘ Token: {EVERNOTE_TOKEN[:10]}...") print() # Try web scraping web_notes = await try_web_scraping_approach() # Try API variations api_responses = await try_api_variations() # Parse known responses await parse_thrift_responses() # Create sample list sample_notes = await create_sample_note_list() print("\n🎯 RESULTS SUMMARY:") print("=" * 40) if web_notes: print(f"βœ… Web scraping found: {len(web_notes)} potential notes") for note in web_notes[:5]: # Show first 5 print(f" πŸ“ {note}") else: print("⚠️ Web scraping: No notes found") api_success = any(r.get('status') == 200 for r in api_responses) print(f"βœ… API responses: {len(api_responses)} endpoints tested") print(f"βœ… API connectivity: {'Working' if api_success else 'Limited'}") print(f"βœ… Sample notes: {len(sample_notes)} created for reference") print("\n🎯 NEXT STEPS:") print("1. API is responding but needs Thrift protocol refinement") print("2. Sample notes show expected structure") print("3. Web interface might be accessible with proper auth") print("4. Focus on creating test notes for verification") if __name__ == "__main__": asyncio.run(main())

Latest Blog Posts

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