Skip to content

MCP get_page ignores source_id parameter (query handles it correctly) #1393

@Valentin32

Description

@Valentin32

What happened?
The get_page MCP tool ignores the per-call source_id parameter. MCP clients with a default-source bearer (e.g. hermes-write configured with source_id=default) cannot get_page pages in non-default sources — they get page_not_found, even when the page exists in the DB and the bearer has federated_read access.

The query tool already supports per-call source_id (via --source-id flag, v0.34). get_page should mirror that behavior.

What did you expect?
get_page({slug: "X", source_id: "priv-foo"}) returns the page when source priv-foo is in the bearer's federated_read list, regardless of ctx.sourceId.

Steps to reproduce

  1. Create a page in a non-default source:
    docker exec gbrain-postgres psql -U gbrain -d gbrain -c
    "INSERT INTO pages (slug, source_id, body) VALUES ('test/page', 'priv-test', 'body');"
  2. Use a bearer with source_id=default AND priv-test in federated_read.
  3. Call get_page:
    curl -X POST http://localhost:3131/mcp
    -H "Authorization: Bearer "
    -H "Content-Type: application/json"
    -H "Accept: application/json, text/event-stream"
    -d '{"jsonrpc":"2.0","id":1,"method":"tools/call",
    "params":{"name":"get_page",
    "arguments":{"slug":"test/page","source_id":"priv-test"}}}'
    Returns: {"error":"page_not_found"} — even though the page exists.
  4. query with same source_id works correctly — finds the page

Environment

  • gbrain version: 0.35.0.0
  • OS: macOS
  • Bun version: 1.3.14
  • Database: self-hosted Postgres (Docker, pgvector/pgvector:pg16)

gbrain doctor --json output

{
    "schema_version": 2,
    "status": "ok",
    "health_score": 95,
    "checks": [
      {"name": "connection", "status": "ok", "message": "Connected, 2210 pages"},
      {"name": "pgvector", "status": "ok", "message": "Extension installed"},
      {"name": "rls", "status": "ok", "message": "RLS enabled on 42/42 public tables"},
      {"name": "schema_version", "status": "ok", "message": "Version 66 (latest: 66)"},
      {"name": "embedding_provider", "status": "ok", "message": "ollama:nomic-embed-text"},
      {"name": "search_mode", "status": "ok", "message": "Mode: tokenmax"},
      {"name": "reranker_health", "status": "ok", "message": "zeroentropyai:zerank-2 reachable"}
    ],
    "note": "Output truncated — only fields relevant to MCP get_page bug. Full doctor output available on request."
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions