feat(memory): expose knowledge graph as MCP Resource#3323
feat(memory): expose knowledge graph as MCP Resource#3323RaidLZ wants to merge 1 commit intomodelcontextprotocol:mainfrom
Conversation
|
@claude review |
|
Claude finished @cliffhall's task in 1m 47s —— View job PR Review: feat(memory): expose knowledge graph as MCP Resource
SummaryGood concept — adding a Resource to the memory server directly supports the CONTRIBUTING.md goal of showcasing underutilized MCP protocol features. The handler implementation is correct: Issues1. Resource name violates project naming convention (must fix)
server.registerResource(
"knowledge_graph", // ❌ snake_case
The name should be 2. No tests (should fix)The PR adds no tests. The everything server has a // example sketch
it('should register knowledge-graph resource with correct URI', () => {
const mockServer = { registerResource: vi.fn() };
// trigger registration ...
expect(mockServer.registerResource).toHaveBeenCalledWith(
'knowledge-graph',
'memory://knowledge-graph',
expect.objectContaining({ mimeType: 'application/json' }),
expect.any(Function)
);
});3. Comment block exceeds project style limit (minor)
// Expose the knowledge graph as a readable MCP Resource.
// This demonstrates the Resources protocol feature, enabling clients
// to discover and read the graph without calling a tool.
Observations (not blockers)
VerdictRequest changes on items 1 (naming) and 2 (tests). Item 3 is a minor style fix. The core implementation is solid. |
Register the knowledge graph as a readable MCP Resource at memory://knowledge-graph, enabling clients to discover and read the graph via the Resources protocol without invoking a tool. Mutation tools (create_entities, create_relations, add_observations, delete_entities, delete_observations, delete_relations) now emit notifications/resources/updated so subscribed clients see live graph changes. Resource registration is extracted into the exported registerKnowledgeGraphResource() function so it can be unit-tested in isolation, mirroring the everything server's registration pattern. New tests assert registerResource is called with the correct kebab-case name, URI, mime type, and that the handler returns the graph as JSON in the contents array. Addresses PR modelcontextprotocol#3323 review feedback: - kebab-case resource name per CLAUDE.md style guide - single-line comment per CLAUDE.md style guide - title metadata for client discoverability - resource update notifications after mutations - test coverage matching everything/registrations.test.ts pattern - README documents the new Resource
cb66bcc to
40b2581
Compare
Register the knowledge graph as a readable MCP Resource at
memory://knowledge-graph, enabling clients to discover and read
the graph via the Resources protocol.
This demonstrates the underutilized Resources feature of MCP in a
reference server, as encouraged by CONTRIBUTING.md.