One simply siphons the excess thoughts from one's mind, pours them into the basin, and examines them at one's leisure. It becomes easier to spot patterns and links, you understand, when they are in this form.
This is a TypeScript-based MCP server that implements a RAG-based knowledge management system. It demonstrates core MCP concepts by providing:
memory://
URIsask_pensieve
- Query your stored knowledge
Install dependencies:
npm install
Build the server:
npm run build
For development with auto-rebuild:
npm run watch
Store your knowledge as markdown files in the root directory:
skills-javascript.md
)To use with Claude Desktop, add the server config:
On MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"The Pensieve": {
"command": "/path/to/The Pensieve/build/index.js"
}
}
}
Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the MCP Inspector:
npm run inspector
The Inspector will provide a URL to access debugging tools in your browser.
async function handleQuestion(question: string) { // 1. Analyze question const analysis = await server.request(SamplingCreateMessageRequestSchema, { messages: [{ role: "user", content: { type: "text", text: question } }], systemPrompt: "You are the Pensieve. Analyze questions to determine what knowledge to retrieve.", includeContext: "none" });
// 2. Use existing RAG query (from our working code) const results = await ragPipeline.semanticSearch(analysis.content.text);
// 3. Compose response
const response = await server.request(SamplingCreateMessageRequestSchema, {
messages: [{
role: "user",
content: {
type: "text",
text: Answer using this knowledge: ${results.map(r => r.payload.full_text).join('\n')}
}
}],
systemPrompt: "You are the Pensieve. Provide clear answers based on stored knowledge.",
includeContext: "none"
});
return response.content.text; }
const documentGuide = `To prepare documents for the Pensieve:
{ uri: "memory://knowledge/skills-javascript.md", mimeType: "text/markdown", // Since we're using markdown files name: "JavaScript Skills", description: "Knowledge about JavaScript development" }
{
"mcpServers": {
"The Pensieve": {
"env": {},
"args": [
"build/index.js"
],
"command": "node"
}
}
}
Seamless access to top MCP servers powering the future of AI integration.