wikivectors
Officialby wikivectors
README.md
# wikivectors
Fresh English Wikipedia for AI apps. Ask in plain English and get the right paragraphs, each with its link and revision, updated within the hour. Also short cited answers, whole pages, infobox facts, similar pages and a change feed.
Zero dependencies. Works in Node 18+, Deno, Bun, edge runtimes and browsers (it uses `fetch`). Types included.
Free key (1,000 searches a month): https://wikivectors.com/account · Docs: https://wikivectors.com/docs
```bash
npm install wikivectors
export WIKIVECTORS_KEY=wv_live_...
```
## Search
```js
import { WikiVectors } from "wikivectors";
const wv = new WikiVectors(); // reads WIKIVECTORS_KEY
for (const p of await wv.search("who won the 2026 FIFA World Cup", { limit: 3 })) {
console.log(p.title, p.permalink);
console.log(p.text);
}
```
## Everything else
```js
await wv.answer("who won the 2026 FIFA World Cup"); // short answer + sources, or answered: false
await wv.pages(["Ada Lovelace", "Alan Turing"]); // whole pages
await wv.facts("Ada Lovelace"); // infobox as JSON: born, died, known for...
await wv.identify("Michael Jordan", { hint: "professor, machine learning" });
await wv.similar("Ada Lovelace", { limit: 5 }); // pages most like this one
await wv.titles({ prefix: "2025 in " });
await wv.changes({ pages: ["Ada Lovelace"] }); // recent edits; pass next_after back as after
await wv.watch({ page: "Ada Lovelace", callbackUrl: "https://example.com/hook" });
```
## LangChain.js
```bash
npm install wikivectors @langchain/core
```
```js
import { WikiVectorsRetriever } from "wikivectors/langchain";
const retriever = new WikiVectorsRetriever({ k: 3 }); // reads WIKIVECTORS_KEY
const docs = await retriever.invoke("who was the first woman in space");
// doc.pageContent is the paragraph; doc.metadata has title, section, url, permalink, revision_id, attribution, score
```
Use it in any chain or agent like other retrievers. Each call is one search. `@langchain/core` is only needed for this import; the main client has no dependencies.
## Vercel AI SDK
```bash
npm install wikivectors ai
```
```js
import { generateText, stepCountIs } from "ai";
import { wikipediaTools } from "wikivectors/ai";
const { text } = await generateText({
model, // any AI SDK model
tools: wikipediaTools(), // reads WIKIVECTORS_KEY
stopWhen: stepCountIs(5),
prompt: "Who won the 2025 Tour de France, and by how much?",
});
```
Three tools: `searchWikipedia` (paragraphs with link and revision), `getPages` (pages by title) and `answerQuestion` (a short cited answer). Keep only some with `wikipediaTools({ only: ["searchWikipedia"] })`. Works with `streamText` too. `ai` is only needed for this import.
## MCP server (Claude Desktop, Cursor, Cline, Windsurf)
The package also runs as an MCP server over stdio. It passes each call to the hosted server at `https://wikivectors.com/mcp` with your key, so you get the same 10 tools: `search_wikipedia`, `answer_question`, `get_pages`, `get_page_facts`, `identify`, `find_titles`, `find_similar`, `changes_since`, `watch_page` and `get_key`.
```json
{
"mcpServers": {
"wikivectors": {
"command": "npx",
"args": ["-y", "wikivectors"],
"env": { "WIKIVECTORS_KEY": "wv_live_..." }
}
}
}
```
Claude Code: `claude mcp add wikivectors -e WIKIVECTORS_KEY=wv_live_... -- npx -y wikivectors`
No key yet? Start it without one: `search_wikipedia` and `get_pages` work as free tries (20 an hour, 5 results, same as the try box on wikivectors.com). For the rest, ask your AI to call `get_key` with your email, or get a free key (1,000 searches a month) at https://wikivectors.com/account. Apps that take a URL can skip the command and use `https://wikivectors.com/mcp` directly. More: https://wikivectors.com/docs/mcp
### Try it on Glama
[](https://glama.ai/mcp/servers/wikivectors/wikivectors-js)
The [Glama listing](https://glama.ai/mcp/servers/wikivectors/wikivectors-js) lets you browse the tools, see the quality score and test the server online with the [MCP Inspector](https://glama.ai/mcp/inspector) before you install it.
## Let your app or AI get its own key
No key yet? Ask for one by email. The person gets a code and an Approve button; the key comes back once they click it.
```js
import { WikiVectors, requestKey } from "wikivectors";
const key = await requestKey("ada@example.com", "My App"); // logs the code, waits up to 15 min
const wv = new WikiVectors({ apiKey: key });
```
Errors throw `WikiVectorsError` with `.status`, `.code`, `.detail` and `.requestId`.
## License
The client is MIT. Wikipedia text is CC BY-SA 4.0: show the `attribution` line, or at least the link, wherever you show the text.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues