
mcp node template
用于创建 MCP 服务器的 Node.js 和 TypeScript 模板项目。
Repository Info
About This Server
用于创建 MCP 服务器的 Node.js 和 TypeScript 模板项目。
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
MCP Node Template
A template project for creating Model Context Protocol (MCP) servers using Node.js and TypeScript.
Features
This template includes all three core MCP capabilities:
- Resources: Exposing data and content from your server to LLMs
- Tools: Enabling LLMs to perform actions through your server
- Prompts: Creating reusable prompt templates and workflows
Project Structure
mcp-node-template/
├── src/
│ ├── index.ts # Entry point
│ ├── resources/ # Resource definitions and handlers
│ │ └── index.ts
│ ├── tools/ # Tool definitions and handlers
│ │ └── index.ts
│ ├── prompts/ # Prompt definitions and handlers
│ │ └── index.ts
│ └── config.ts # Server configuration
Getting Started
- Clone this repository
- Install dependencies:
npm install - Build and run the server:
npm run dev
How to Use
Connect to Claude for Desktop
To use this server with Claude for Desktop, add the following to your claude_desktop_config.json file:
{
"mcpServers": {
"my-server": {
"command": "node",
"args": ["/absolute/path/to/this/project/build/index.js"]
}
}
}
Test with MCP Inspector
You can test this server using the MCP Inspector:
npx @modelcontextprotocol/inspector node build/index.js
Extending the Template
Adding New Resources
Add your resource definitions in src/resources/index.ts:
// Example of adding a custom resource
server.setRequestHandler(ListResourcesRequestSchema, async () => {
return {
resources: [
...existingResources,
{
uri: "custom://resource",
name: "My Custom Resource",
description: "Description of my resource"
}
]
};
});
Adding New Tools
Add your tool definitions in src/tools/index.ts:
// Example of adding a custom tool
server.tool(
"custom-tool",
"Description of my custom tool",
{
param1: z.string().describe("Parameter description"),
param2: z.number().describe("Parameter description")
},
async ({ param1, param2 }) => {
// Tool implementation
return {
content: [
{
type: "text",
text: `Processed: ${param1}, ${param2}`
}
]
};
}
);
Adding New Prompts
Add your prompt definitions in src/prompts/index.ts:
// Example of adding a custom prompt
PROMPTS["custom-prompt"] = {
name: "custom-prompt",
description: "Description of my custom prompt",
arguments: [
{
name: "arg1",
description: "Argument description",
required: true
}
]
};
License
MIT
Quick Start
Clone the repository
git clone https://github.com/wstcpyt/mcp-node-templateInstall dependencies
cd mcp-node-template
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.