Skip to content

Commit 6556e33

Browse files
authored
Merge branch 'main' into add-tasks-support
2 parents 9d863fb + 55a3056 commit 6556e33

8 files changed

Lines changed: 756 additions & 194 deletions

File tree

package-lock.json

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/everything/server/roots.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const roots: Map<string | undefined, Root[]> = new Map<
3030
*/
3131
export const syncRoots = async (server: McpServer, sessionId?: string) => {
3232
const clientCapabilities = server.server.getClientCapabilities() || {};
33-
const clientSupportsRoots: boolean = clientCapabilities.roots !== undefined;
33+
const clientSupportsRoots: boolean = clientCapabilities?.roots !== undefined;
3434

3535
// Fetch the roots list for this client
3636
if (clientSupportsRoots) {
@@ -48,7 +48,7 @@ export const syncRoots = async (server: McpServer, sessionId?: string) => {
4848
{
4949
level: "info",
5050
logger: "everything-server",
51-
data: `Roots updated: ${response.roots.length} root(s) received from client`,
51+
data: `Roots updated: ${response?.roots?.length} root(s) received from client`,
5252
},
5353
sessionId
5454
);

src/filesystem/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
},
2727
"dependencies": {
2828
"@modelcontextprotocol/sdk": "^1.25.2",
29-
"diff": "^5.1.0",
29+
"diff": "^8.0.3",
3030
"glob": "^10.5.0",
3131
"minimatch": "^10.0.1",
3232
"zod-to-json-schema": "^3.23.5"

src/memory/__tests__/knowledge-graph.test.ts

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,5 +390,94 @@ describe('KnowledgeGraphManager', () => {
390390
expect(JSON.parse(lines[0])).toHaveProperty('type', 'entity');
391391
expect(JSON.parse(lines[1])).toHaveProperty('type', 'relation');
392392
});
393+
394+
it('should strip type field from entities when loading from file', async () => {
395+
// Create entities and relations (these get saved with type field)
396+
await manager.createEntities([
397+
{ name: 'Alice', entityType: 'person', observations: ['test observation'] },
398+
{ name: 'Bob', entityType: 'person', observations: [] },
399+
]);
400+
await manager.createRelations([
401+
{ from: 'Alice', to: 'Bob', relationType: 'knows' },
402+
]);
403+
404+
// Verify file contains type field (order may vary)
405+
const fileContent = await fs.readFile(testFilePath, 'utf-8');
406+
const fileLines = fileContent.split('\n').filter(line => line.trim());
407+
const fileItems = fileLines.map(line => JSON.parse(line));
408+
const fileEntity = fileItems.find(item => item.type === 'entity');
409+
const fileRelation = fileItems.find(item => item.type === 'relation');
410+
expect(fileEntity).toBeDefined();
411+
expect(fileEntity).toHaveProperty('type', 'entity');
412+
expect(fileRelation).toBeDefined();
413+
expect(fileRelation).toHaveProperty('type', 'relation');
414+
415+
// Create new manager instance to force reload from file
416+
const manager2 = new KnowledgeGraphManager(testFilePath);
417+
const graph = await manager2.readGraph();
418+
419+
// Verify loaded entities don't have type field
420+
expect(graph.entities).toHaveLength(2);
421+
graph.entities.forEach(entity => {
422+
expect(entity).not.toHaveProperty('type');
423+
expect(entity).toHaveProperty('name');
424+
expect(entity).toHaveProperty('entityType');
425+
expect(entity).toHaveProperty('observations');
426+
});
427+
428+
// Verify loaded relations don't have type field
429+
expect(graph.relations).toHaveLength(1);
430+
graph.relations.forEach(relation => {
431+
expect(relation).not.toHaveProperty('type');
432+
expect(relation).toHaveProperty('from');
433+
expect(relation).toHaveProperty('to');
434+
expect(relation).toHaveProperty('relationType');
435+
});
436+
});
437+
438+
it('should strip type field from searchNodes results', async () => {
439+
await manager.createEntities([
440+
{ name: 'Alice', entityType: 'person', observations: ['works at Acme'] },
441+
]);
442+
await manager.createRelations([
443+
{ from: 'Alice', to: 'Alice', relationType: 'self' },
444+
]);
445+
446+
// Create new manager instance to force reload from file
447+
const manager2 = new KnowledgeGraphManager(testFilePath);
448+
const result = await manager2.searchNodes('Alice');
449+
450+
// Verify search results don't have type field
451+
expect(result.entities).toHaveLength(1);
452+
expect(result.entities[0]).not.toHaveProperty('type');
453+
expect(result.entities[0].name).toBe('Alice');
454+
455+
expect(result.relations).toHaveLength(1);
456+
expect(result.relations[0]).not.toHaveProperty('type');
457+
expect(result.relations[0].from).toBe('Alice');
458+
});
459+
460+
it('should strip type field from openNodes results', async () => {
461+
await manager.createEntities([
462+
{ name: 'Alice', entityType: 'person', observations: [] },
463+
{ name: 'Bob', entityType: 'person', observations: [] },
464+
]);
465+
await manager.createRelations([
466+
{ from: 'Alice', to: 'Bob', relationType: 'knows' },
467+
]);
468+
469+
// Create new manager instance to force reload from file
470+
const manager2 = new KnowledgeGraphManager(testFilePath);
471+
const result = await manager2.openNodes(['Alice', 'Bob']);
472+
473+
// Verify open results don't have type field
474+
expect(result.entities).toHaveLength(2);
475+
result.entities.forEach(entity => {
476+
expect(entity).not.toHaveProperty('type');
477+
});
478+
479+
expect(result.relations).toHaveLength(1);
480+
expect(result.relations[0]).not.toHaveProperty('type');
481+
});
393482
});
394483
});

src/memory/index.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,20 @@ export class KnowledgeGraphManager {
7474
const lines = data.split("\n").filter(line => line.trim() !== "");
7575
return lines.reduce((graph: KnowledgeGraph, line) => {
7676
const item = JSON.parse(line);
77-
if (item.type === "entity") graph.entities.push(item as Entity);
78-
if (item.type === "relation") graph.relations.push(item as Relation);
77+
if (item.type === "entity") {
78+
graph.entities.push({
79+
name: item.name,
80+
entityType: item.entityType,
81+
observations: item.observations
82+
});
83+
}
84+
if (item.type === "relation") {
85+
graph.relations.push({
86+
from: item.from,
87+
to: item.to,
88+
relationType: item.relationType
89+
});
90+
}
7991
return graph;
8092
}, { entities: [], relations: [] });
8193
} catch (error) {

src/time/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ classifiers = [
1717
"Programming Language :: Python :: 3.10",
1818
]
1919
dependencies = [
20-
"mcp>=1.0.0",
20+
"mcp>=1.23.0",
2121
"pydantic>=2.0.0",
2222
"tzdata>=2024.2",
23-
"tzlocal>=5.3.1"
23+
"tzlocal>=5.3.1",
2424
]
2525

2626
[project.scripts]

src/time/src/mcp_server_time/server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from mcp.server import Server
1010
from mcp.server.stdio import stdio_server
11-
from mcp.types import Tool, TextContent, ImageContent, EmbeddedResource
11+
from mcp.types import Tool, TextContent, ImageContent, EmbeddedResource, ErrorData, INVALID_PARAMS
1212
from mcp.shared.exceptions import McpError
1313

1414
from pydantic import BaseModel
@@ -54,7 +54,7 @@ def get_zoneinfo(timezone_name: str) -> ZoneInfo:
5454
try:
5555
return ZoneInfo(timezone_name)
5656
except Exception as e:
57-
raise McpError(f"Invalid timezone: {str(e)}")
57+
raise McpError(ErrorData(code=INVALID_PARAMS, message=f"Invalid timezone: {str(e)}"))
5858

5959

6060
class TimeServer:

0 commit comments

Comments
 (0)