Zotero MCP Connector

from typing import Any, List, Optional, Dict import logging import asyncio from mcp.server.models import InitializationOptions import mcp.types as types from mcp.server import NotificationOptions, Server import mcp.server.stdio from tools import get_tools_list from handlers import handle_tool_call # Configure logging logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger(__name__) server = Server("things") @server.list_tools() async def handle_list_tools() -> list[types.Tool]: """List available tools for Things integration.""" return get_tools_list() @server.call_tool() async def handle_call_tool( name: str, arguments: dict | None ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: """Handle tool execution requests.""" return await handle_tool_call(name, arguments) async def main(): # Run the server using stdin/stdout streams async with mcp.server.stdio.stdio_server() as (read_stream, write_stream): await server.run( read_stream, write_stream, InitializationOptions( server_name="things", server_version="0.1.0", capabilities=server.get_capabilities( notification_options=NotificationOptions(), experimental_capabilities={}, ), ), ) if __name__ == "__main__": asyncio.run(main())