Skip to main content
Glama

Zotero MCP

""" Command-line interface for Zotero MCP server. """ import argparse import sys from zotero_mcp.server import mcp def main(): """Main entry point for the CLI.""" parser = argparse.ArgumentParser( description="Zotero Model Context Protocol server" ) # Create subparsers for different commands subparsers = parser.add_subparsers(dest="command", help="Command to run") # Server command (default behavior) server_parser = subparsers.add_parser("serve", help="Run the MCP server") server_parser.add_argument( "--transport", choices=["stdio", "streamable-http", "sse"], default="stdio", help="Transport to use (default: stdio)", ) server_parser.add_argument( "--host", default="localhost", help="Host to bind to for SSE transport (default: localhost)", ) server_parser.add_argument( "--port", type=int, default=8000, help="Port to bind to for SSE transport (default: 8000)", ) # Setup command setup_parser = subparsers.add_parser("setup", help="Configure zotero-mcp for Claude Desktop") setup_parser.add_argument("--no-local", action="store_true", help="Configure for Zotero Web API instead of local API") setup_parser.add_argument("--api-key", help="Zotero API key (only needed with --no-local)") setup_parser.add_argument("--library-id", help="Zotero library ID (only needed with --no-local)") setup_parser.add_argument("--library-type", choices=["user", "group"], default="user", help="Zotero library type (only needed with --no-local)") setup_parser.add_argument("--config-path", help="Path to Claude Desktop config file") # Version command version_parser = subparsers.add_parser("version", help="Print version information") args = parser.parse_args() # If no command is provided, default to 'serve' if not args.command: args.command = "serve" # Also set default transport since we're defaulting to serve args.transport = "stdio" if args.command == "version": from zotero_mcp._version import __version__ print(f"Zotero MCP v{__version__}") sys.exit(0) elif args.command == "setup": from zotero_mcp.setup_helper import main as setup_main sys.exit(setup_main(args)) elif args.command == "serve": # Get transport with a default value if not specified transport = getattr(args, "transport", "stdio") if transport == "stdio": mcp.run(transport="stdio") elif transport == "streamable-http": host = getattr(args, "host", "localhost") port = getattr(args, "port", 8000) mcp.run(transport="streamable-http", host=host, port=port) elif transport == "sse": host = getattr(args, "host", "localhost") port = getattr(args, "port", 8000) import warnings warnings.warn("The SSE transport is deprecated and may be removed in a future version. New applications should use Streamable HTTP transport instead.", UserWarning) mcp.run(transport="sse", host=host, port=port) if __name__ == "__main__": main()

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/54yyyu/zotero-mcp'

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