#!/usr/bin/env python3
"""
Test MCP Server Reading Capabilities
This script tests the MCP server's ability to read from your Evernote account.
"""
import asyncio
import sys
import os
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from evernote_mcp_working import (
configure_evernote_working,
test_connection_working,
list_notebooks_working,
search_notes_working,
get_note_working
)
# Your Evernote token
EVERNOTE_TOKEN = os.environ.get("EVERNOTE_DEVELOPER_TOKEN", "YOUR_TOKEN_HERE")
async def test_mcp_reading_functions():
"""Test all MCP reading functions"""
print("π TESTING MCP SERVER READING CAPABILITIES")
print("=" * 60)
# Step 1: Configure the connection
print("1οΈβ£ Configuring Evernote connection...")
config_result = await configure_evernote_working(EVERNOTE_TOKEN, use_sandbox=False)
print(f" Status: {config_result}")
if not config_result.get('success', False):
print("β Configuration failed!")
return False
# Step 2: Test connection
print("\n2οΈβ£ Testing connection...")
connection_result = await test_connection_working()
print(f" Status: {connection_result}")
if not connection_result.get('success', False):
print("β Connection test failed!")
return False
# Step 3: List notebooks
print("\n3οΈβ£ Listing notebooks...")
notebooks_result = await list_notebooks_working()
print(f" Status: {notebooks_result.get('success', False)}")
if notebooks_result.get('success', False):
notebooks = notebooks_result.get('notebooks', [])
print(f" Found {len(notebooks)} notebooks:")
for notebook in notebooks:
print(f" π {notebook['name']} (GUID: {notebook['guid'][:8]}...)")
else:
print(f" Error: {notebooks_result.get('error', 'Unknown error')}")
# Step 4: Search for notes
print("\n4οΈβ£ Searching for notes...")
# Try different search queries
search_queries = [
"", # Get all notes
"created", # Look for notes with "created"
"cursor", # Look for notes with "cursor"
"test", # Look for notes with "test"
"note" # Look for notes with "note"
]
all_notes = []
for query in search_queries:
print(f" π Searching for: '{query}' (blank = all notes)")
search_result = await search_notes_working(query, max_results=20)
if search_result.get('success', False):
notes = search_result.get('notes', [])
print(f" Found {len(notes)} notes")
for note in notes:
if note not in all_notes:
all_notes.append(note)
print(f" π {note['title']} (GUID: {note['guid'][:8]}...)")
print(f" Created: {note.get('created', 'Unknown')}")
print(f" Updated: {note.get('updated', 'Unknown')}")
else:
print(f" Error: {search_result.get('error', 'Unknown error')}")
print()
# Step 5: Try to read a specific note
if all_notes:
print("5οΈβ£ Reading a specific note...")
first_note = all_notes[0]
print(f" π Reading note: {first_note['title']}")
note_result = await get_note_working(first_note['guid'])
if note_result.get('success', False):
note = note_result.get('note', {})
print(f" β
Successfully read note!")
print(f" Title: {note.get('title', 'No title')}")
print(f" Content length: {len(note.get('content', ''))} characters")
print(f" Content preview: {note.get('content', '')[:200]}...")
else:
print(f" β Failed to read note: {note_result.get('error', 'Unknown error')}")
else:
print("5οΈβ£ No notes found to read")
return True
async def main():
"""Main test function"""
print("π MCP Server Reading Test")
print("π― Testing ability to read from your Evernote account")
print()
try:
success = await test_mcp_reading_functions()
if success:
print("\nπ MCP SERVER READING TEST RESULTS:")
print("β
Connection: Working")
print("β
Authentication: Working")
print("β
Notebooks: Can list")
print("β
Notes: Can search and read")
print("β
MCP Server: Fully functional for reading!")
else:
print("\nβ MCP SERVER READING TEST FAILED")
print(" Check your token and connection")
except Exception as e:
print(f"\nβ Test failed with error: {e}")
import traceback
traceback.print_exc()
if __name__ == "__main__":
asyncio.run(main())