Content
In the previous article "Quickly Develop an MCP Service to Enhance Your AI Agent," we discussed how to develop an MCP service to enhance the capabilities of an AI Agent. However, I noticed a lack of a user-friendly MCP scaffolding tool in the community, with many existing tools either incomplete or no longer maintained.
To address this issue, I developed a simple and easy-to-use MCP CLI tool: `gen-mcp`, which helps developers quickly create MCP service projects, especially friendly for TypeScript users.
## Why Do You Need This Tool?
When developing MCP services, developers often face the following issues:
1. Complicated project structure setup
2. Additional work required to configure the TypeScript environment
3. Different implementation methods for various transport protocols (such as SSE and Stdio)
4. Lack of references for best practices
`gen-mcp` was created to solve these problems.
## Tool Features
- Supports two mainstream transport methods: SSE and Stdio
- Provides complete TypeScript support
- Includes a built-in note-taking application example, demonstrating the use of resources, tools, and prompts
- Simple and intuitive command-line interaction
## Quick Start
### Installation
```bash
# Global installation
npm install -g gen-mcp
# Or use npx directly
npx gen-mcp
```
<img width="496" alt="image" src="https://github.com/user-attachments/assets/84cb088e-8b7c-410d-baae-aa1bd5cb265d" />
### Create a Project
After installation, simply run the following command:
```bash
gen-mcp
# Or
mcp
# Or
npx gen-mcp
```
Follow the interactive prompts:
1. Choose a template (Stdio or SSE transport)
2. Specify the installation path
3. Enter the package name
Then, the tool will automatically create the project for you and provide guidance for the next steps.
## Template Introduction
### MCP Server - Stdio Transport
This template is suitable for developing MCP services integrated with command-line tools, such as integration with Claude CLI.
Main features:
- Communicates via standard input/output streams
- Suitable for developing command-line tools
- Can be quickly globally installed for testing using `npm link`
### MCP Server - SSE Transport
This template is suitable for developing MCP services integrated with web applications, such as integration with the web version of Claude.
Main features:
- Communicates using Server-Sent Events
- Built-in Express server
- Supports CORS for easy frontend integration
- Provides automatic restart in development mode
### Debugging and Configuration
Debugging and configuration are two key aspects when developing MCP services. Our templates provide comprehensive support:
#### Debugging Features
1. **MCP Inspector Integration**: Each template can start debugging with the following command:
```bash
npm run inspector
```
The Inspector provides an intuitive interface to view resources, tool calls, and prompt executions in real-time.
2. **Development Mode Monitoring**: The SSE template includes a development mode that listens for file changes and automatically restarts the service:
```bash
npm run dev
```
#### Configuring MCP Services
Adding your developed MCP service is very simple:
1. **Cursor Integration**:
- When using in Cursor, you can add a custom MCP service through the "Connections" panel on the right sidebar
- Location: `~/.cursor/mcp.json`
- Enter the service name and URL (for SSE template)
- For Stdio template, you can configure the command path
2. **Claude Integration**:
- Same as above
- Location: `~/Library/Application Support/Claude/claude_desktop_config.json`
Cli mode:
```
{
"mcpServers": {
"server-name": {
"command": "npx",
"args": ["-y", "mcp-server"],
"env": {
"API_KEY": "value"
}
}
}
}
```
SSE mode:
```
{
"mcpServers": {
"server-name": {
"url": "http://localhost:3000/sse",
"env": {
"API_KEY": "value"
}
}
}
}
```
## Example Application: Note System
Both templates include a simple note system example, showcasing the three core functionalities of MCP:
1. **Resources**: Access notes via the `note:///{id}` URI
2. **Tools**: The `create_note` tool is used to create new notes
3. **Prompts**: The `summarize_notes` tool is used to generate a summary of all notes
This example not only demonstrates the basic usage of MCP but also provides a reference architecture for your own projects.
## Note
If you encounter errors, it may be due to version management tools like nvm causing Node to be unrecognized. You can run `which node` and then modify the shebang in `index.js`.
Connection Info
You Might Also Like
markitdown
MarkItDown-MCP is a lightweight server for converting URIs to Markdown.
servers
Model Context Protocol Servers
Time
A Model Context Protocol server for time and timezone conversions.
Filesystem
Node.js MCP Server for filesystem operations with dynamic access control.
Sequential Thinking
A structured MCP server for dynamic problem-solving and reflective thinking.
git
A Model Context Protocol server for Git automation and interaction.