Content
# ShowDoc MCP Plugin
A ShowDoc MCP (Model Context Protocol) plugin for Cursor IDE, allowing you to access and operate ShowDoc documents directly within Cursor.
## Features
- 📋 **Project API List**: View all API interfaces for a specified project (backend API, server-side API, backend interface, server-side interface)
- 🔍 **Document Search**: Search ShowDoc documents by keyword (supports searching backend API, server-side API, backend interface, server-side interface)
- 📖 **API Details**: Get detailed information about a specified API (including request parameters, response format, etc.)
## Installation
### Using npx
In the `.cursor/mcp.json` file of your Cursor project, add the following MCP configuration:
```json
{
"mcpServers": {
"showdoc": {
"command": "npx",
"args": [
"-y",
"mcp-showdoc",
"--host", "https://your-showdoc-domain.com",
"--login_secret_key", "your_login_secret_key",
"--project_name", "your_project_name"
]
}
}
}
```
## Configuration Instructions
### Required Parameters
- `--host`: ShowDoc server address (including protocol, e.g., `https://www.showdoc.com.cn`)
- `--login_secret_key`: ShowDoc login secret key (obtainable in ShowDoc user settings)
- `--project_name`: Project name. This will lock the project, and subsequent API calls can only access resources of this project.
### Optional Parameters
- `--username`: ShowDoc username (defaults to `mcp-showdoc` user, with read permission for this user)
- `--debug`: Enable debug mode, output detailed logs
**Configuration Example**:
```json
{
"mcpServers": {
"showdoc": {
"command": "npx",
"args": [
"-y",
"mcp-showdoc",
"--host", "https://your-showdoc-domain.com",
"--login_secret_key", "your_login_secret_key",
"--project_name", "Project Name"
]
}
}
}
```
## Usage
### Using in Cursor
After configuration, restart Cursor, and you can:
1. **Search Documents**:
- "Search for user registration API in ShowDoc"
- "Search for API documents containing keywords"
2. **View Project API List**:
- "List backend interfaces of the project"
- "Display all server-side APIs"
- "Save all API interfaces and interface names of the project to api.md file"
3. **View API Details**:
- "Display login details of server-side interface"
- "View details of login API"
4. **Generate Model**:
- "Generate API interface model class for XXX"
### Command-line Debugging
The project provides a command-line debugging tool to directly call ShowDoc API:
#### 1. Get Project Information
```bash
node dist/index.js debug --action info \
--host https://your-showdoc-domain.com \
--login_secret_key your_key \
--username your_username \
--project_name xxxx
```
#### 2. Get Page Content
```bash
node dist/index.js debug --action api-detail \
--host https://your-showdoc-domain.com \
--login_secret_key your_key \
--username your_username \
--project_name xxxx \
--page 268
```
#### 3. Search Documents
```bash
node dist/index.js debug --action search \
--host https://your-showdoc-domain.com \
--login_secret_key your_key \
--username your_username \
--project_name xxxx \
--keyword "user registration"
```
#### View Help Information
```bash
node dist/index.js --help
node dist/index.js debug --help
```
## MCP Capabilities
### Resources
MCP Resources allow Cursor to access ShowDoc projects and pages:
- **List Resources**: Automatically list all available ShowDoc projects and pages
- URI format: `showdoc://item/{item_id}/page/{page_id}`
- Resource list cached for 5 minutes to improve performance
- **Read Resources**: Read specific page content according to URI
- Return Markdown format page content
- Automatically include page title and content
## System Requirements
- **Node.js**: >= 20
- **Cursor IDE**: Latest version
## Frequently Asked Questions
### Q: How to know if MCP is working normally?
A: Try asking "List my ShowDoc projects" in Cursor. If you can see the project list, it means the configuration is successful. You can also check the MCP logs in Cursor.
### Q: What if login fails?
A: Check the following:
1. Is the `--host` parameter correct (including protocol)?
2. Is the `--login_secret_key` correct (view in ShowDoc user settings)?
4. Is the network connection normal?
5. Enable `--debug` to view detailed error information
### Q: How to update the plugin?
A:
- If using npx: `npx -y mcp-showdoc` will automatically use the latest version
## License
ISC
## Related Links
- [ShowDoc Official Documentation](https://www.showdoc.com.cn/)
- [MCP Protocol Documentation](https://modelcontextprotocol.io/)
- [Cursor IDE](https://cursor.sh/)