Pine Labs MCP Troubleshoot
Diagnose and resolve issues with the Pine Labs MCP server running locally.
When to Use
- Server won't start or crashes immediately
- MCP client shows "server disconnected" or "failed to connect"
- Authentication errors (401, invalid credentials, token failures)
- Tools don't appear in the MCP client
- API calls return unexpected errors
- Tests fail after setup
- Docker container exits or won't build
Diagnostic Procedure
Follow this sequence — each step narrows the problem category.
Step 1: Verify Python Environment
# Check Python version (need 3.10+)
python3 --version
# Check virtual environment is active
which python
# Should point to .venv/bin/python, NOT system Python
# If not active:
source .venv/bin/activate
# Check dependencies installed
pip list | grep -E "fastmcp|httpx|pydantic"
# All three must be present
Common fix: pip install -r requirements.txt
Step 2: Verify Server Starts
# Start with debug logging
python -m cli.pinelabs_mcp_server.main stdio \
--client-id <ID> --client-secret <SECRET> \
--env uat --log-level DEBUG --log-file /tmp/mcp-debug.log
Check the log file for errors:
cat /tmp/mcp-debug.log
Common errors:
| Error | Cause | Fix |
|---|---|---|
ModuleNotFoundError: cli |
Wrong working directory | cd to project root |
ModuleNotFoundError: fastmcp |
Dependencies not installed | pip install -r requirements.txt |
ImportError |
Python version too old | Upgrade to 3.10+ |
Address already in use |
Port conflict (HTTP mode) | Use different --port or kill existing process |
Step 3: Verify Credentials
# Test authentication directly
python -c "
import asyncio
from pkg.pinelabs.client import PineLabsClient
async def test():
client = PineLabsClient(
client_id='<ID>',
client_secret='<SECRET>',
base_url='https://pluraluat.v2.pinepg.in/api',
token_url='https://pluraluat.v2.pinepg.in/api/auth/v1/token',
)
token = await client._get_token()
print(f'Token obtained: {token[:20]}...')
await client.close()
asyncio.run(test())
"
Common errors:
| Error | Cause | Fix |
|---|---|---|
401 Unauthorized |
Wrong client ID or secret | Verify credentials with Pine Labs dashboard |
ConnectionError |
Network/firewall blocking | Check internet, VPN, proxy settings |
TimeoutError |
API unreachable | Check PINELABS_BASE_URL matches environment |
SSL certificate error |
Corporate proxy/MITM | Set SSL_CERT_FILE env var or check proxy config |
Step 4: Verify MCP Client Config
VS Code
- Open Command Palette →
MCP: List Servers - Check if "pinelabs" appears
- If not, verify
.vscode/mcp.jsonexists and has correct syntax - Check Output panel → "MCP" channel for errors
- Verify
pythoncommand resolves to the correct interpreter (venv)
Fix for wrong Python path: Use absolute path in config:
"command": "/path/to/project/.venv/bin/python"
Claude Desktop
- Check config at
~/Library/Application Support/Claude/claude_desktop_config.json - Verify JSON is valid (no trailing commas)
- Restart Claude Desktop after config changes
- Check Console.app for
claudeprocess errors (macOS)
Cursor
- Check
.cursor/mcp.jsonin project root - Verify JSON syntax
- Restart Cursor after changes
- Check Developer Console (Help → Toggle Developer Tools)
Step 5: Verify Tools Are Registered
# Run tests to confirm tool registration works
make test
If only some tools are missing, check:
--toolsetsflag — may be limiting which toolsets load--read-onlyflag — hides write tools- Check
pkg/pinelabs/tools.pyfor registration order
Step 6: Check Docker Issues
# Verify image builds
docker build -t pinelabs-mcp-server .
# Run with debug logging
docker run --rm \
-e PINELABS_CLIENT_ID=<ID> \
-e PINELABS_CLIENT_SECRET=<SECRET> \
-e PINELABS_ENV=uat \
-e LOG_LEVEL=DEBUG \
pinelabs-mcp-server
# Check for permission issues (non-root user)
docker run --rm --entrypoint sh pinelabs-mcp-server -c "whoami && ls -la /app"
Common Docker issues:
| Issue | Cause | Fix |
|---|---|---|
| Build fails at pip install | Network in build context | Use --network host or configure proxy |
| Container exits immediately | Missing env vars | Pass all required env vars via -e or .env |
| Permission denied | Non-root user can't access files | Check file ownership in Dockerfile |
| Can't connect from host | stdio transport needs special handling | Use docker compose from examples/ |
Error Pattern Reference
API Errors (from tool responses)
| Response Code | Meaning | Action |
|---|---|---|
VALIDATION_ERROR |
Invalid input to tool | Check parameter format (IDs, amounts) |
NOT_FOUND |
Resource doesn't exist | Verify ID, check environment (uat vs prod data) |
UNAUTHORIZED |
Token expired or invalid | Restart server to refresh token cache |
RATE_LIMITED |
Too many requests | Wait and retry; reduce request frequency |
INTERNAL_ERROR |
Unexpected server-side error | Check logs, report if persistent |
Environment Mismatches
| Symptom | Likely cause |
|---|---|
| Resources exist in dashboard but API returns 404 | Wrong --env (uat vs prod) |
| Auth works but no data | Credentials are for different environment |
| Amounts look wrong | Pine Labs uses paisa (100 paisa = ₹1) |
Quick Fixes Checklist
- Python 3.10+ and venv activated?
-
pip install -r requirements.txtdone? - Running from project root directory?
- Credentials correct for the target environment?
- Network access to
pluraluat.v2.pinepg.inorapi.pluralpay.in? - MCP client config has valid JSON?
- MCP client restarted after config change?
-
make testpasses? - Log file shows successful token acquisition?
Source: plural-pinelabs/pinelabs-online-mcp — distributed by TomeVault.