DemoTool MCP Server
A modular MCP server that provides custom tools for AI assistants to interact with the DemoTool project codebase, starting with a hello world tool.
README
DemoTool MCP Server
A modular Model Context Protocol (MCP) server for the DemoTool project. This server provides custom tools that AI assistants in Cursor can use to better understand and interact with the codebase.
What is MCP?
Model Context Protocol (MCP) is an open protocol that allows AI assistants to securely interact with external data sources and tools. This server exposes project-specific tools that Cursor can use to enhance development workflows.
Project Structure
The server is organized into a modular architecture for easy maintenance and scalability:
mcp-server/
├── src/
│ ├── config/ # Server configuration
│ │ ├── server.config.ts
│ │ └── index.ts
│ ├── server/ # Server setup and request handlers
│ │ ├── setup.ts
│ │ └── index.ts
│ ├── tools/ # Tool implementations
│ │ ├── tool-registry.ts # Tool registry pattern
│ │ ├── hello-world.tool.ts # Example tool
│ │ └── index.ts
│ ├── types/ # TypeScript type definitions
│ │ ├── tool.types.ts
│ │ ├── server.types.ts
│ │ └── index.ts
│ └── index.ts # Main entry point
├── dist/ # Compiled JavaScript output
├── package.json
└── tsconfig.json
Available Tools
This MCP server currently provides:
- hello_world - Returns a friendly hello world message
- Optional parameter:
name(string) - Name to greet, defaults to "World"
- Optional parameter:
Installation
- Install dependencies:
cd mcp-server
npm install
- Build the server:
npm run build
Configuration in Cursor
To integrate this MCP server with Cursor:
Method 1: Using Cursor Settings UI
- Open Cursor Settings
- Navigate to Features → MCP
- Click + Add New MCP Server
- Configure:
- Name:
kids-daily-tool - Type:
stdio - Command:
node /home/fernando/code/kids-daily-tool/mcp-server/dist/index.js
- Name:
Method 2: Manual Configuration (Advanced)
Edit Cursor's MCP configuration file directly:
Linux/Mac: ~/.config/cursor/mcp.json
Windows: %APPDATA%\Cursor\mcp.json
Add this configuration:
{
"mcpServers": {
"kids-daily-tool": {
"command": "node",
"args": ["/home/fernando/code/kids-daily-tool/mcp-server/dist/index.js"],
"env": {}
}
}
}
Usage in Cursor
Once configured, you can use natural language prompts in Cursor Composer to invoke the tool:
- "Say hello to me!"
- "Use the hello_world tool"
- "Call the hello_world MCP tool with name: Fernando"
Cursor will automatically detect when to use the MCP tool and execute it on your behalf. The tool will return a friendly greeting message.
Development
To modify the server:
- Edit files in
src/ - Rebuild:
npm run build - Restart Cursor to pick up changes
Troubleshooting
Server not showing up in Cursor
- Make sure you've built the server (
npm run build) - Verify the path in your configuration is absolute
- Restart Cursor after making configuration changes
Tool errors
- Check the Cursor Developer Console for error messages
- Verify file permissions on the project directory
- Ensure Node.js is available in your PATH
Extending the Server
The modular architecture makes it easy to add new tools. Follow these steps:
1. Create a New Tool
Create a new file in src/tools/, e.g., my-new-tool.tool.ts:
import {
Tool,
ToolDefinition,
ToolArguments,
ToolResult,
} from "../types/index.js";
export class MyNewTool implements Tool {
getDefinition(): ToolDefinition {
return {
name: "my_new_tool",
description: "Description of what your tool does",
inputSchema: {
type: "object",
properties: {
param1: {
type: "string",
description: "Description of param1",
},
},
required: ["param1"],
},
};
}
async execute(args: ToolArguments): Promise<ToolResult> {
// Implement your tool logic here
const result = `Processing: ${args.param1}`;
return {
content: [
{
type: "text",
text: result,
},
],
};
}
}
2. Register the Tool
Add your tool to src/tools/index.ts:
export * from "./my-new-tool.tool.js";
import { MyNewTool } from "./my-new-tool.tool.js";
export function getAllTools(): Tool[] {
return [
new HelloWorldTool(),
new MyNewTool(), // Add your tool here
];
}
3. Rebuild and Test
npm run build
That's it! The tool registry will automatically pick up your new tool.
Architecture Benefits
- Modularity: Each tool is self-contained in its own file
- Type Safety: Full TypeScript support with proper interfaces
- Scalability: Easy to add new tools without modifying core logic
- Maintainability: Clear separation of concerns
- Testability: Individual tools can be tested in isolation
Security Notes
- This server only provides read-only access to project information
- It runs locally and doesn't send data to external services
- Always review MCP server code before integrating it with your editor
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。