/nlweb-protocol:nlweb-mcp-serverfrom nlweb-protocol
Exposes NLWeb as an MCP server with JSON-RPC 2.0 endpoint, providing ask/list_sites/who tools for AI agent integration. Use when connecting NLWeb to ChatGPT, Claude, Gemini, or building MCP clients.
Ships in nlweb-protocol. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Fetch live spec:
/mcp route alongside /ask).AskAgent/python/webserver/mcp_wrapper.py in the live repo for the exact JSON-RPC method list and tool schemas — these change between releases.NLWeb is already an MCP server out of the box — same code, second binding. The /mcp route in webserver/routes/mcp.py accepts JSON-RPC 2.0 requests and re-uses the same NLWebHandler pipeline as /ask. No separate process, no extra config.
| Route | Method | Purpose |
|---|---|---|
/mcp | POST, GET | Main JSON-RPC endpoint |
/mcp/{path} | POST, GET | Path-scoped variant |
/mcp/health | GET | Liveness check |
NLWeb advertises a dated MCP revision (e.g. 2026-07-28) and the server name nlweb-mcp-server. Never hard-code a revision string — the one your build ships is whatever the installed NLWeb release advertises, and the one your client should send is whatever the spec currently defines.
Resolve it at implementation time:
mcp_wrapper.py for the revision it advertises.The transport has changed shape across revisions. The 2026-07-28 core is stateless: the initialize / notifications/initialized handshake and the Mcp-Session-Id header were removed from Streamable HTTP. Code written against a handshake-era revision will not match a stateless server, and vice versa — so confirm which model applies before writing client code.
tools/list and tools/call are stable across revisions and are the two you will actually use. Whether a handshake precedes them is revision-dependent:
| Method | Direction | Notes |
|---|---|---|
tools/list | client → server | Returns the tool definitions |
tools/call | client → server | Invoke a tool |
notifications/cancelled | client → server | Cancel an in-flight tool call |
initialize | client → server | Handshake — removed in the stateless core; present only on handshake-era revisions |
initialized | client → server | Notification paired with initialize; same caveat |
Confirm the method list against the running server's tools/list response and the revision you resolved above.
(prompts/list and prompts/get appear in some docs but are not in mcp_wrapper.py at the time of writing — verify.)
Three tools are advertised via tools/list:
ask — the primary NL query{
"name": "ask",
"description": "Ask a natural-language question grounded in the site's Schema.org content.",
"inputSchema": {
"type": "object",
"properties": {
"query": { "type": "string" },
"site": { "type": "array", "items": { "type": "string" } },
"generate_mode": { "type": "string", "enum": ["list", "summarize", "generate"] }
},
"required": ["query"]
}
}
Note that the MCP ask tool takes site as an array (where the REST /ask takes a single string). Map accordingly in clients.
list_sites — enumeration{ "name": "list_sites", "description": "List all sites the agent can query.", "inputSchema": { "type": "object", "properties": {} } }
who — federated discovery (conditional)Only present when who_endpoint_enabled: true in config_nlweb.yaml. Takes {query}, returns the best NLWeb site(s) for that query — used for federated search across sites.
JSON-RPC 2.0 itself is request/response — no streaming. NLWeb's /mcp is NOT SSE by default. SSE only activates when the inner ask tool is called with streaming: true in its args. Most MCP clients don't expect that, so for cross-agent compatibility leave streaming off in MCP and turn it on only for clients you control.
JSON-RPC 2.0 errors:
{
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -32603,
"message": "Internal error",
"data": { "errors": [...] }
}
}
Common codes: -32700 parse error, -32600 invalid request, -32601 method not found, -32602 invalid params, -32603 internal error.
NLWeb actually ships two MCP integrations:
| Wrapper | Path | Purpose |
|---|---|---|
webserver/mcp_wrapper.py | /mcp on the aiohttp server (port 8000) | The canonical Python MCP server |
openai-apps-sdk-integration/nlweb_server_node/ | Separate Node.js/TypeScript process | Adds a React widget for ChatGPT Apps SDK — registers a nlweb-list tool and serves ui://widget/nlweb-list.html |
There's also an A2A wrapper (webserver/a2a_wrapper.py, route a2a.py) for Google's Agent-to-Agent protocol, and an AppSDK adapter on port 8100 (appsdk_adapter_server.py) that translates NLWeb's message list to OpenAI Apps SDK envelopes for existing clients.
You don't typically write an MCP server for NLWeb — it's already there. What you might do:
tools/list matches your needs by hitting it from your agent client.mcp_wrapper.py::handle_tools_list carefully (you'll re-merge on upgrade).webserver/middleware/) — MCP has no built-in auth; bring your own (bearer token, OAuth proxy, etc.).who for offline / single-site deployments by setting who_endpoint_enabled: false.# Sketch — verify against latest MCP client SDK
import httpx, json
async def mcp_call(url, method, params=None):
payload = {"jsonrpc": "2.0", "id": 1, "method": method, "params": params or {}}
async with httpx.AsyncClient() as c:
r = await c.post(url, json=payload, timeout=60)
return r.json()
# Handshake — ONLY on handshake-era revisions. The stateless core (2026-07-28+)
# removed `initialize` entirely; skip this call there and go straight to tools/list.
# MCP_REVISION must come from the live spec, not from memory. See "MCP Protocol Revision".
await mcp_call("http://localhost:8000/mcp", "initialize", {"protocolVersion": MCP_REVISION})
# Discover tools
tools = await mcp_call("http://localhost:8000/mcp", "tools/list")
# Ask
result = await mcp_call("http://localhost:8000/mcp", "tools/call", {
"name": "ask",
"arguments": {"query": "what's new this week?", "site": ["news"], "generate_mode": "summarize"}
})
Add an entry in ~/.claude.json mcpServers:
{
"mcpServers": {
"my-nlweb-site": {
"url": "http://localhost:8000/mcp",
"transport": "http"
}
}
}
(Verify the exact Claude Code MCP config schema in current docs — it changes.)
ChatGPT Apps SDK requires the separate Node.js MCP server in openai-apps-sdk-integration/nlweb_server_node/. It bundles a React widget that renders the nlweb-list tool's results. Follow docs/nlweb-chatgpt-integration.md for the exact registration steps — ChatGPT's MCP app store rules change.
Gemini's tool-calling supports MCP via the Vertex AI Agent SDK. Point it at http://your-nlweb-host:8000/mcp and call tools/list → tools/call.
tools/list on every upgrade.site arg differs between /ask (string) and /mcp::ask (array). Don't confuse them./mcp is not SSE by default. Don't wire your client expecting EventSource./mcp.Always re-fetch mcp_wrapper.py and the chatgpt-integration doc before generating final code.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
13 skills in this plugin
/nlweb-ask-endpointImplement and consume the NLWeb /ask REST endpoint — request shape (GET/POST, query-string and v0.55 structured body), SSE streaming response, modes (list/summarize/generate), in-stream "message_type" headers, error envelopes, and client-side parsing. Use when building an NLWeb server route, calling /ask from a custom agent, or debugging /ask responses./nlweb-auth-multitenancyConfigure NLWeb authentication and multi-tenant deployments — OAuth providers (GitHub, Google, Microsoft, Facebook), session storage, the `sites:` allowlist in `config_nlweb.yaml`, conversation persistence per authenticated user, and per-tenant data isolation. Use when adding login to an NLWeb instance, hosting multiple customers on one deployment, or persisting conversation history./nlweb-chatgpt-appsdkIntegrate NLWeb with ChatGPT's Apps SDK — the Node.js MCP server in `openai-apps-sdk-integration/`, the `nlweb-list` tool, the React widget at `ui://widget/nlweb-list.html`, and the port-8100 AppSDK adapter that translates NLWeb's message list to OpenAI Apps SDK envelopes. Use when publishing an NLWeb site as a ChatGPT app or wiring NLWeb results into an Apps SDK widget./nlweb-data-loadingIngest site content into NLWeb's vector store using `db_load.py` — supports RSS/Atom feeds, Schema.org JSON-LD, sitemap-driven URL lists, and CSV. Covers chunking, embedding computation, site partitioning, batch sizing, delete-and-reload, and per-backend write_endpoint targeting. Use when bootstrapping a site's index, refreshing content, or migrating between retrieval backends./nlweb-deploymentDeploy NLWeb to production — Azure App Service (`deploy_azure_webapp.sh` + AI Search + Azure OpenAI), Snowflake Container Services, Cloudflare Worker + AutoRAG, Docker, and self-hosted. Covers env-var conventions, `mode: production` lockdown, scaling, TLS, OAuth, and CI for data reloads. Use when going from local dev to a hosted, internet-facing NLWeb instance./nlweb-dev-patternsNLWeb development patterns — the mixed-mode programming philosophy, FastTrack vs Analysis parallel paths, config file precedence and the `mode: development` override trap, in-stream NLWS headers vs HTTP headers, embedding/ingest determinism, debugging the LLM-call chain, neural scorer selection (NLWebScorer ModernBERT+GAM), and the A2A / AgentFinder / DataFinder / ModelRouter subsystems. Use when designing the internal architecture of an NLWeb deployment or solving cross-cutting concerns.npx claudepluginhub orcaqubits/agentic-commerce-skills-plugins --plugin nlweb-protocolOther plugins' skills for the same job