mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-01 17:39:39 +02:00
saving
This commit is contained in:
parent
e8c7a4f6e0
commit
ffd97375a8
160 changed files with 6704 additions and 1895 deletions
|
|
@ -5,20 +5,22 @@
|
|||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"build": "bunx --bun tsc",
|
||||
"dev": "tsc --watch",
|
||||
"clean": "rm -rf dist",
|
||||
"test": "vitest run --passWithNoTests"
|
||||
"test": "bunx --bun vitest run --passWithNoTests"
|
||||
},
|
||||
"dependencies": {
|
||||
"@trustgraph/base": "workspace:*",
|
||||
"@trustgraph/client": "workspace:*",
|
||||
"effect": "4.0.0-beta.65",
|
||||
"@modelcontextprotocol/sdk": "^1.8.0",
|
||||
"zod": "^3.23.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/vitest": "4.0.0-beta.65",
|
||||
"@types/node": "^22.0.0",
|
||||
"typescript": "^5.8.0",
|
||||
"vitest": "^3.1.0"
|
||||
"vitest": "^4.1.6"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,10 @@ export function createMcpServer(config: {
|
|||
const flow = socket.flow(flowId);
|
||||
const response = await flow.graphRag(
|
||||
query,
|
||||
{ entityLimit: entity_limit, tripleLimit: triple_limit },
|
||||
{
|
||||
...(entity_limit !== undefined ? { entityLimit: entity_limit } : {}),
|
||||
...(triple_limit !== undefined ? { tripleLimit: triple_limit } : {}),
|
||||
},
|
||||
collection,
|
||||
);
|
||||
return { content: [{ type: "text" as const, text: response }] };
|
||||
|
|
@ -141,9 +144,9 @@ export function createMcpServer(config: {
|
|||
},
|
||||
async ({ s, p, o, limit, collection }) => {
|
||||
const flow = socket.flow(flowId);
|
||||
const sTerm: Term | undefined = s ? { t: "i", i: s } : undefined;
|
||||
const pTerm: Term | undefined = p ? { t: "i", i: p } : undefined;
|
||||
const oTerm: Term | undefined = o ? { t: "i", i: o } : undefined;
|
||||
const sTerm: Term | undefined = s !== undefined && s.length > 0 ? { t: "i", i: s } : undefined;
|
||||
const pTerm: Term | undefined = p !== undefined && p.length > 0 ? { t: "i", i: p } : undefined;
|
||||
const oTerm: Term | undefined = o !== undefined && o.length > 0 ? { t: "i", i: o } : undefined;
|
||||
const triples = await flow.triplesQuery(sTerm, pTerm, oTerm, limit, collection);
|
||||
return { content: [{ type: "text" as const, text: JSON.stringify(triples, null, 2) }] };
|
||||
},
|
||||
|
|
@ -417,8 +420,10 @@ export async function run(): Promise<void> {
|
|||
const { server, socket } = createMcpServer({
|
||||
gatewayUrl: process.env.GATEWAY_URL ?? "ws://localhost:8088/api/v1/socket",
|
||||
user: process.env.USER_ID ?? "mcp",
|
||||
token: process.env.GATEWAY_SECRET,
|
||||
flowId: process.env.FLOW_ID ?? "default",
|
||||
...(process.env.GATEWAY_SECRET !== undefined
|
||||
? { token: process.env.GATEWAY_SECRET }
|
||||
: {}),
|
||||
});
|
||||
|
||||
const transport = new StdioServerTransport();
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
"compilerOptions": {
|
||||
"outDir": "dist",
|
||||
"rootDir": "src",
|
||||
"types": ["node"],
|
||||
"composite": true
|
||||
},
|
||||
"include": ["src"],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue