On this page

Connect an MCP client

Connect and choose the grant

Copy the connection URL from Access and keys into your MCP client. The local quickstart uses http://localhost:13000/mcp. Agents can list accessible Spaces, search their documents and open source passages.

  • OAuth. Sign in in the browser, choose the Spaces and grants, and approve the request. Use read access for retrieval. The client sends the access token as Authorization: Bearer …. Review and revoke authorizations in Access and keys.

  • API key. Create a For an agent (MCP) key, select at least one Space, set an expiry and save the full key in the client’s secret configuration. The client sends it as X-API-Key.

Use one credential per request. To check a static key, set CONTEXTBASE_BASE_URL to your installation and CONTEXTBASE_API_KEY to the MCP key. Call:

curl --fail-with-body "$CONTEXTBASE_BASE_URL/mcp" \
  -H "X-API-Key: $CONTEXTBASE_API_KEY" \
  -H 'Content-Type: application/json' \
  --data '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

Look for the tools in result.tools.

Search and open evidence

  1. Call list_knowledge_bases for IDs, names and grants.

  2. Call search_knowledge_base with query and optional top_k. Supply a name or ID as knowledge_base if the advertised schema requires it. Read the excerpts in rank order.

  3. Pass the canonical chunk_id to fetch_source for the full passage. Keep the excerpt if an attached index has no canonical chunk.

  4. For a written answer and sources, call answer_from_knowledge_base. It needs a generator and can use model quota.

Implement a host

Send JSON-RPC messages by POST to /mcp. Call initialize and send the negotiated revision in MCP-Protocol-Version. Authenticate each call. Each request gets one complete response. The server issues no session ID.

For OAuth discovery, use /.well-known/oauth-authorization-server and /.well-known/oauth-protected-resource. The authorization code flow with PKCE uses /oauth/authorize and /oauth/token. Fetch a fresh tool list after a grant changes. Removing Space access can revoke the connection and require approval again.

Protocol negotiation · Search controller

ContextBase0.1.0

Search the documentation