Big Picture 11: MCP, RAG and claude.ai Features
This document covers how Claude connects to tools and data: the MCP messages behind Big Picture 6's MCP servers, the RAG pipeline behind the context's RAG box, and how claude.ai features are built from the same parts.
What MCP clients and servers actually say
MCP messages use the JSON-RPC 2.0 format. The client is Claude Code or Desktop, the server is GitHub, a database and so on.
- 1.initialize, then result, then notifications/initialized (handshake)
- 2.tools/list, then the tools (name, description, inputSchema)
- 3.Tools appear in Claude as mcp__github__create_issue
- 4.tools/call with arguments, then result
- 5.Client turns it into a tool_result for Claude (Big Picture 6 to 2)
- MCP Client: Claude Code / Desktop.
- MCP Server: GitHub, DB...
- initialize: the client sends {protocolVersion, capabilities, clientInfo}.
- result: the server replies with its capabilities (tools, resources, prompts) and serverInfo.
- notifications/initialized: the handshake is complete.
- tools/list: the client asks the server for its tools.
- tools: the server returns [{name: "create_issue", description, inputSchema}, ...].
- In Claude's tools: the name gets a prefix, mcp__github__create_issue. If there are many tools, they load on demand through tool search.
- tools/call: the client sends {name: "create_issue", arguments: {title, body}}. Claude wrote the tool_use at Big Picture 5.
- result: the server returns {content: [{type: "text", text: "Issue #42 created"}], isError: false}.
- tool_result to Claude: the client turns the result into a tool_result and hands it back (Big Picture 6 to 2), the same agent loop.
- notifications/tools/list_changed: the server tells the client new tools have arrived.
- resources/read, prompts/get: the client fetches data with {uri} and templates with {name}.
- sampling/createMessage, elicitation/create: the server asks the client for something in return.
- stdio (local server): the client starts it as a child process. Messages go over stdin / stdout, one JSON per line. Write logs only to stderr, because anything else on stdout breaks the protocol. Credentials come from env, not OAuth.
- Streamable HTTP (remote server): HTTP POST, a JSON or SSE answer, and a session ID header. The old separate SSE transport is deprecated.
- OAuth 2.1 (HTTP only): a call without a token gets 401, then Protected Resource Metadata discovers the auth server, you log in through the browser with PKCE and the resource parameter, and the Bearer token goes on every request. The server checks the token audience and never passes someone else's token along.
- 3 primitives, who controls each: Tools are run by the model, Resources are put in context by the app, Prompts are chosen by the user (slash commands).
RAG, answers from your own documents
RAG has two parts: indexing done once, and retrieval on every question.
- 1.Indexing (once): Documents, Clean + Chunk, Contextual chunk, Embeddings + BM25, Vector DB
- 2.Query time: User question, Query embed, Hybrid retrieve (top ~20), Rerank (best ~5)
- 3.Prompt: chunks in <doc> tags first, question last
- 4.Claude answers with citations
- Indexing 1 Documents: PDF, wiki, tickets, SharePoint, DB rows.
- Indexing 2 Clean + Chunk: pieces of 300 to 800 tokens with a little overlap, keeping headings and metadata attached.
- Indexing 3 Contextual chunk: Claude (Haiku) writes 1 to 2 lines of context in front of each chunk, such as "This is from the refund section of the Q2 report". This is Contextual Retrieval.
- Indexing 4 Embeddings + BM25: an embedding model (such as Voyage) makes a vector, alongside a keyword (BM25) index.
- Indexing 5 Vector DB: pgvector, Azure AI Search, Pinecone... with metadata (source, date, access).
- Query 1 User question: for example "How many days does a refund take?".
- Query 2 Query embed: a vector of the question (optionally, Claude rewrites the query first).
- Query 3 Hybrid retrieve: vector similarity plus BM25 gives the top ~20, with a permission filter.
- Query 4 Rerank: a reranker picks the best ~5 chunks.
- Query 5 Prompt: chunks inside <doc> tags (on top), the rule "answer only from the docs", and the question at the end.
- Query 6 Claude: the answer with citations. If it is not there, it says so ("not in the docs").
- RAG vs long context: if the knowledge is small (a few hundred thousand tokens), put it in context and use caching. If it is large, changes daily or access differs per user, use RAG.
- Agentic search: give Claude a search tool and let it write its own queries and search again after seeing results. This is how grep and glob work in Claude Code.
- Measuring quality: for retrieval, is the right chunk in the top K? For the answer, is it faithful and complete? Keep a separate eval set for each.
How claude.ai features work inside
App features are not magic. Each one is the same combination of model, context and tools.
- 1.Projects: docs + instructions in every chat's context (RAG when large)
- 2.Artifacts: Claude writes code, rendered in a sandboxed window
- 3.Memory: facts from past chats added to context
- 4.Web search / Research: web_search tool loop, or plan then many searches
- 5.Connectors: remote MCP servers over OAuth, then the Big Picture 6 loop
- 6.Files: upload into context, create in the code execution sandbox
- Projects: uploaded docs and custom instructions go into the context of every chat. If the knowledge gets large, the app automatically uses retrieval (RAG) and puts only the relevant parts in.
- Artifacts: Claude writes code, HTML or React and the app renders it in a separate sandboxed window. An edit means Claude writes a new version. You can publish and share it, and some artifacts can even call Claude from inside.
- Memory: the app remembers important points from past chats and adds them to the context when relevant. The user can view, edit and turn it off, and nothing is saved in an incognito chat.
- Web search / Research: web search is the web_search tool in a loop: search, read, answer with citations. Research is a long agentic loop: plan, many searches (connectors too), then a report.
- Connectors: really remote MCP servers (Drive, Gmail, GitHub, Notion...). You log in with OAuth, Claude gets the tools, and the Big Picture 6 loop runs.
- Files / file creation: an uploaded PDF or image goes into the context, as in Big Picture 2. To create a file, Claude runs Python in the code execution sandbox to make a docx, xlsx, pptx or pdf.