What Is the Default Service Address for the MCP Endpoint in Xiaohongshu MCP?

The default service address is http://localhost:18060/mcp, binding to port 18060 on all interfaces with the MCP handler mounted under the /mcp path.

The xpzouying/xiaohongshu-mcp repository implements a Model Context Protocol (MCP) server that exposes HTTP endpoints for Xiaohongshu (Little Red Book) integration. Understanding the default service address for the MCP endpoint is essential for connecting client applications and testing the server locally.

Default Service Address Configuration

The MCP server uses a two-part addressing scheme: a default port defined in the entry point and a fixed path route registered in the HTTP handler.

Port Configuration in main.go

In main.go, the server defines a -port flag that defaults to :18060 when no value is provided:

// main.go lines 15-20
port := flag.String("port", ":18060", "Server port")
flag.Parse()

// Server listens on all interfaces at port 18060

This means the server binds to all available network interfaces (0.0.0.0) at port 18060, making it accessible via localhost, 127.0.0.1, or the machine's external IP address.

Route Registration in routes.go

The MCP HTTP handler is mounted under the /mcp path in the Gin router defined in routes.go:

// routes.go lines 26-37
mcpHandler := NewMCPHandler(service)

// Register MCP endpoints
router.GET("/mcp", mcpHandler.Handle)
router.GET("/mcp/*path", mcpHandler.Handle)
router.POST("/mcp", mcpHandler.Handle)
router.POST("/mcp/*path", mcpHandler.Handle)

This configuration routes all HTTP GET and POST requests to /mcp and /mcp/*path to the MCP handler, establishing the complete endpoint URL structure.

How to Connect to the Default MCP Endpoint

Once the server is running with default settings, you can interact with the MCP endpoint using standard HTTP clients.

Testing with cURL

Verify the endpoint is accessible by sending a POST request to the default service address:


# Check MCP endpoint availability

curl -X POST http://localhost:18060/mcp \
  -H "Content-Type: application/json" \
  -d '{"tool":"check_login_status"}'

Browser Access

For simple GET requests or debugging, navigate directly to:


http://localhost:18060/mcp

Note that the MCP protocol primarily uses POST requests for tool invocations, so browser access may be limited to verification purposes.

Customizing the Service Address

While the default service address for the MCP endpoint is http://localhost:18060/mcp, you can override the port using command-line flags.

Changing the Port

Start the server with a custom port by providing the -port flag:


# Run on port 8080 instead of 18060

./xiaohongshu-mcp -port :8080

The MCP endpoint would then be accessible at http://localhost:8080/mcp.

Environment-Specific Addresses

When deploying to production or Docker containers, bind to the appropriate interface:


# Bind to specific interface (example)

./xiaohongshu-mcp -port 192.168.1.100:18060

Summary

  • The default service address for the MCP endpoint is http://localhost:18060/mcp.
  • The server binds to port 18060 on all interfaces by default, defined in main.go lines 15-20.
  • The MCP handler is mounted under the /mcp path in routes.go lines 26-37.
  • You can override the default port using the -port command-line flag when starting the server.

Frequently Asked Questions

What is the default port for the Xiaohongshu MCP server?

The default port is 18060. If you start the server without specifying the -port flag, it will bind to :18060 (all interfaces, port 18060) as defined in main.go.

Can I run the MCP server on a different port?

Yes. You can specify a custom port using the -port flag when launching the server. For example, run ./xiaohongshu-mcp -port :8080 to serve the MCP endpoint at http://localhost:8080/mcp.

What path should I use to access the MCP endpoint?

The MCP endpoint is accessible under the /mcp path. The complete default URL is http://localhost:18060/mcp. The router in routes.go handles both GET and POST requests to this path and /mcp/*path.

Is the MCP endpoint accessible from remote machines by default?

Yes. Because the default binding is :18060 (all interfaces), the server accepts connections from any network interface. If you need to restrict access to localhost only, you would need to modify the source code or use firewall rules to block external access to port 18060.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →