Skip to content

Bug Report: Jina MCP Server Search Functions Return "Unauthorized" Despite Valid API Key #1222

@deleon626

Description

@deleon626

Issue Description

The Jina MCP server fails authentication for search functions (search_web, search_images, expand_query, etc.) while URL reading functions work correctly. Direct API calls to both search and reader endpoints work perfectly with the same API key, indicating this is an MCP server implementation issue rather than an API key or service problem.

Environment Information

  • Claude Code Version: Latest
  • MCP Server: jina-mcp-server via https://mcp.jina.ai/sse
  • Transport: SSE (Server-Sent Events)
  • API Key: Valid and topped-up
  • Region: Asia/Jakarta (ID)

Configuration

claude mcp add --transport sse jina https://mcp.jina.ai/sse -s user --header "Authorization : Bearer jina_1ca8f3ecfd7c495dafba3c146a086519Dmj32NI96__TFVhcKr5oaVWt2I55"

Test Results

✅ Working Functions

  • read_url() - Successfully retrieves and converts web content to markdown
  • primer() - Returns location/context data correctly
  • show_api_key() - Returns configured API key
  • MCP Server shows "✓ Connected" status

❌ Failing Functions

  • search_web() - Returns "Unauthorized" error
  • search_images() - Returns "Unauthorized" error
  • search_arxiv() - Returns "Unauthorized" error
  • expand_query() - Returns "Authentication failed. Please set your API key in the Jina AI MCP settings"
  • parallel_search_web() - Returns "Unauthorized"

Direct API Testing (All Working)

# Search API - WORKS
curl -H "Authorization: Bearer jina_1ca8f3ecfd7c495dafba3c146a086519Dmj32NI96__TFVhcKr5oaVWt2I55" "https://s.jina.ai/http://example.com"
# Returns: Full search results with titles, URLs, descriptions

# Reader API - WORKS
curl -H "Authorization: Bearer jina_1ca8f3ecfd7c495dafba3c146a086519Dmj32NI96__TFVhcKr5oaVWt2I55" "https://r.jina.ai/http://example.com"
# Returns: Full content extraction

Error Messages

MCP Function Errors:

Error: Search failed for query "artificial intelligence": Unauthorized
Authentication failed. Please set your API key in the Jina AI MCP settings. You can get a free API key by visiting https://jina.ai and signing up for an account.

Debugging Steps Performed

  1. ✅ API Key Validation: Direct curl calls work perfectly with both search and reader endpoints
  2. ✅ Service Status: Jina AI status page shows all systems operational
  3. ✅ Configuration: Multiple configuration methods tested (SSE, stdio, environment variables, direct headers)
  4. ✅ Transport Methods: Tested both SSE and stdio transport types
  5. ✅ Header Formats: Tried various header formatting approaches
  6. ✅ API Credits: Confirmed API account is topped up and active
  7. ✅ Regional Testing: Tested from multiple network locations

Expected Behavior

All Jina MCP functions should work consistently with a valid API key, just as direct API calls do.

Actual Behavior

URL reading functions work perfectly, but search functions fail with authentication errors despite using the same valid API key.

Impact

  • High: Search functionality is completely unusable through MCP
  • Users cannot access Jina's search capabilities through Claude Code
  • Forces workaround with alternative MCP servers or direct API calls

Additional Context

Pattern Observation:

This appears to be a service-specific authentication issue where:

  • Reader API (r.jina.ai) → Works through MCP and direct calls
  • Search API (s.jina.ai) → Only works through direct calls, fails through MCP

Community Evidence:

Multiple similar issues reported in community forums suggesting this is a known MCP server authentication handling problem.

Possible Root Causes:

  1. MCP server incorrectly formats authentication headers for search requests
  2. Search API endpoints have different authentication requirements not properly handled by MCP
  3. MCP server implementation bug specific to search function authentication
  4. Rate limiting or token validation differences between reader and search APIs

Reproduction Steps

  1. Configure Jina MCP server with valid API key:
claude mcp add --transport sse jina https://mcp.jina.ai/sse -s user --header "Authorization : Bearer YOUR_API_KEY"
  1. Test URL reading (works):
mcp__jina-mcp-server__read_url("https://example.com")
  1. Test search function (fails):
mcp__jina-mcp-server__search_web("test query", 3)
  1. Verify direct API calls work:
curl -H "Authorization: Bearer YOUR_API_KEY" "https://s.jina.ai/http://example.com"

Requested Resolution

  1. Fix MCP server authentication for search functions to match direct API behavior
  2. Proper error handling to distinguish between API key issues vs MCP implementation issues
  3. Documentation updates if there are different authentication requirements for search vs reading
  4. Configuration validation tools to help users troubleshoot similar issues

Workaround Available

Use direct API calls or alternative MCP search servers while this issue is resolved.

Priority

High - Core functionality completely broken for search capabilities


Environment Details:

  • OS: macOS Darwin 24.6.0
  • Client: claude-code/2.0.20
  • Network: PT. Eka Mas Republik (CGK, Indonesia)
  • Timezone: Asia/Jakarta

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions