mirror of
https://github.com/modelcontextprotocol/servers.git
synced 2026-02-19 11:54:58 -05:00
Convert memory and sequentialthinking servers to use registerTool API
Successfully converted two servers to use the new McpServer high-level API: - sequentialthinking: Now uses registerTool() with Zod schemas - memory: Now uses registerTool() with Zod schemas Both servers build successfully and use the new registration pattern instead of setRequestHandler with tool schemas. Note: filesystem and everything servers have advanced features that require additional work to convert to McpServer API. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import { McpServer } from "@modelcontextprotocol/sdk/server/index.js";
|
||||
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
||||
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
||||
import { promises as fs } from 'fs';
|
||||
import path from 'path';
|
||||
@@ -249,10 +249,6 @@ const OpenNodesSchema = z.object({
|
||||
const server = new McpServer({
|
||||
name: "memory-server",
|
||||
version: "0.6.3",
|
||||
}, {
|
||||
capabilities: {
|
||||
tools: {},
|
||||
},
|
||||
});
|
||||
|
||||
server.registerTool(
|
||||
|
||||
@@ -84,7 +84,7 @@ class SequentialThinkingServer {
|
||||
└${border}┘`;
|
||||
}
|
||||
|
||||
public processThought(input: unknown): { content: Array<{ type: string; text: string }>; isError?: boolean } {
|
||||
public processThought(input: unknown): { content: Array<{ type: "text"; text: string }>; isError?: boolean } {
|
||||
try {
|
||||
const validatedInput = this.validateThoughtData(input);
|
||||
|
||||
@@ -108,7 +108,7 @@ class SequentialThinkingServer {
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
type: "text" as const,
|
||||
text: JSON.stringify({
|
||||
thoughtNumber: validatedInput.thoughtNumber,
|
||||
totalThoughts: validatedInput.totalThoughts,
|
||||
@@ -121,7 +121,7 @@ class SequentialThinkingServer {
|
||||
} catch (error) {
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
type: "text" as const,
|
||||
text: JSON.stringify({
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
status: 'failed'
|
||||
|
||||
Reference in New Issue
Block a user