Some checks failed
CI / test (map[image:macos-latest name:macos], 1, 4) (push) Has been cancelled
CI / test (map[image:macos-latest name:macos], 2, 4) (push) Has been cancelled
CI / test (map[image:macos-latest name:macos], 3, 4) (push) Has been cancelled
CI / test (map[image:macos-latest name:macos], 4, 4) (push) Has been cancelled
CI / test (map[image:windows-latest name:windows], 1, 4) (push) Has been cancelled
CI / test (map[image:windows-latest name:windows], 2, 4) (push) Has been cancelled
CI / test (map[image:windows-latest name:windows], 3, 4) (push) Has been cancelled
CI / test (map[image:windows-latest name:windows], 4, 4) (push) Has been cancelled
CI / merge-reports (push) Has been cancelled
- Added a new integration script to manage custom features related to smart context. - Implemented handlers for smart context operations (get, update, clear, stats) in ipc. - Created a SmartContextStore class to manage context snippets and summaries. - Developed hooks for React to interact with smart context (useSmartContext, useUpdateSmartContext, useClearSmartContext, useSmartContextStats). - Included backup and restore functionality in the integration script. - Validated integration by checking for custom modifications and file existence.
45 lines
1.1 KiB
JavaScript
45 lines
1.1 KiB
JavaScript
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
import { z } from "zod";
|
|
|
|
const server = new McpServer({
|
|
name: "fake-stdio-mcp",
|
|
version: "0.1.0",
|
|
});
|
|
|
|
server.registerTool(
|
|
"calculator_add",
|
|
{
|
|
title: "Calculator Add",
|
|
description: "Add two numbers and return the sum",
|
|
inputSchema: { a: z.number(), b: z.number() },
|
|
},
|
|
async ({ a, b }) => {
|
|
const sum = a + b;
|
|
return {
|
|
content: [{ type: "text", text: String(sum) }],
|
|
};
|
|
},
|
|
);
|
|
|
|
server.registerTool(
|
|
"print_envs",
|
|
{
|
|
title: "Print Envs",
|
|
description: "Print the environment variables received by the server",
|
|
inputSchema: {},
|
|
},
|
|
async () => {
|
|
const envObject = Object.fromEntries(
|
|
Object.entries(process.env).map(([key, value]) => [key, value ?? ""]),
|
|
);
|
|
const pretty = JSON.stringify(envObject, null, 2);
|
|
return {
|
|
content: [{ type: "text", text: pretty }],
|
|
};
|
|
},
|
|
);
|
|
|
|
const transport = new StdioServerTransport();
|
|
await server.connect(transport);
|