Integrating with Cursor via Streamable HTTP
License: Apache-2.0 | Version: 1.5.1 | Go: 1.26+ | Dependencies: Zero external runtime dependencies
Cursor supports MCP servers via Streamable HTTP transport. AegisGate MCP provides a full Streamable HTTP implementation with SSE streaming support and Mcp-Session-Id session management (MCP protocol 2025-06-18).
Prerequisites
| Requirement | Notes |
|---|---|
| AegisGate MCP binary | Built from source or downloaded from releases |
| Cursor | Version 0.42+ (MCP support) |
| Port 8081 | Available on localhost (or change with --addr) |
Step 1: Start AegisGate MCP in HTTP Mode
./mcp-server --transport http --demo --addr :8081
The server now accepts MCP requests at http://localhost:8081/mcp.
With Authentication
./mcp-server --transport http --demo --addr :8081 --token my-secret-bearer
With TLS
./mcp-server --transport http --demo --addr :8081 \
--tls --tls-cert server.pem --tls-key server.key
Step 2: Configure Cursor
Open Cursor Settings → MCP Servers → Add New MCP Server:
| Field | Value |
|---|---|
| Name | aegisgate-mcp |
| Type | url |
| URL | http://localhost:8081/mcp |
Or edit Cursor’s MCP configuration file:
{
"mcpServers": {
"aegisgate-mcp": {
"url": "http://localhost:8081/mcp"
}
}
}
With Authentication
{
"mcpServers": {
"aegisgate-mcp": {
"url": "http://localhost:8081/mcp",
"headers": {
"Authorization": "Bearer my-secret-bearer"
}
}
}
}
Step 3: Verify the Connection
- Restart Cursor
- Open a new chat
- The three demo tools (
ping,system_info,echo) should appear as available MCP tools - Try: “Use the ping tool from aegisgate-mcp”
How Session Management Works
AegisGate MCP implements the Mcp-Session-Id header (MCP 2025-06-18 spec):
- Initialize: Cursor sends
initialize→ server responds withMcp-Session-Id: <256-bit ID>header - Subsequent requests: Cursor includes
Mcp-Session-Id: <ID>in all following requests - Session expiry: Sessions expire after 30 minutes of inactivity
- Session termination: Cursor sends
DELETE /mcpwith the session ID to terminate
This happens automatically — Cursor handles session IDs without manual configuration.
SSE Streaming
AegisGate MCP supports SSE responses. If Cursor sends Accept: text/event-stream, the server responds with:
Content-Type: text/event-stream
Cache-Control: no-cache
Connection: keep-alive
data: {"jsonrpc":"2.0","result":{...},"id":1}
If Cursor doesn’t request SSE, the server falls back to standard application/json responses. Both modes are fully supported.
Docker Deployment
docker pull ghcr.io/aegisgatesecurity/aegisgate-mcp:1.5.1
docker run -d --name aegisgate-mcp -p 8081:8081 \
ghcr.io/aegisgatesecurity/aegisgate-mcp:1.5.1 \
--transport http --demo --addr :8081
Then point Cursor at http://localhost:8081/mcp.
Troubleshooting
Connection refused
- Verify the server is running:
curl http://localhost:8081/mcp -X POST -d '{}' -H "Content-Type: application/json" - Check the port:
lsof -i :8081 - Try a different port:
--addr :9091
404 Not Found
- Ensure you’re hitting
/mcpnot the root:http://localhost:8081/mcp - Verify the server is in HTTP mode (not TCP or stdio)
Authentication failed (-32001)
- The
--tokenvalue must match theAuthorization: Bearerheader exactly - Check for trailing whitespace in the token
Session expired (404)
- Sessions expire after 30 minutes of inactivity
- Cursor will automatically re-initialize a new session