Connect and automate

MCP Integration (Model Context Protocol)

Connect your NCB workspace to AI coding assistants like Cursor and Claude.

AI-assisted developers5 min read

MCP Integration: Connecting AI Coding Assistants

The Model Context Protocol (MCP) is an open standard that enables AI assistants to securely connect to external data sources.

By integrating NoCodeBackend via MCP, you give AI coding assistants (like Cursor, Windsurf, or the Claude Desktop app) direct, secure access to your database schema, live API documentation, and the ability to execute SQL queries directly from your chat interface.

This exhaustive guide covers the configuration of MCP tokens, the connection methods, security implications, and practical examples of how this integration supercharges your development workflow.


1. Detailed Overview

Traditionally, when building a frontend app with an AI assistant like Cursor, you have to constantly copy and paste context. You copy your database schema, paste it into chat, ask the AI to write a fetch function, switch to your Swagger docs, copy the endpoint URL, paste it back, and so on.

The NoCodeBackend MCP integration eliminates this context switching.

What does the AI get access to?

When you connect an MCP token, the AI assistant gains access to specific "Tools" hosted on our MCP server:

  • get_schema: Reads the exact SQL structure of your tables (columns, MySQL data types, relationships).
  • get_swagger: Reads the live REST API endpoints, expected JSON payloads, and parameter definitions.
  • execute_sql: Allows the AI to run read-only MySQL queries against your live database to understand the shape of your actual data.

The AI cannot drop tables, delete databases, or modify your billing settings. The connection is scoped strictly to development-assistance tools.


2. Step-by-Step Guide: Connecting to Cursor

Cursor is a popular AI code editor that natively supports MCP. Let's connect your NoCodeBackend workspace to Cursor.

Step 2.1: Generating the Token

  1. Log into your NoCodeBackend dashboard.
  2. Navigate to Developer Settings > MCP in the sidebar.
  3. Click the Create Token button.
  4. Give the token a descriptive name (e.g., "Cursor Work Laptop").
  5. The system will display a long, cryptographic string (e.g., ncb_mcp_xxxxxxxxxxxx).
  6. CRITICAL: Copy this token immediately and store it securely. Once you close the modal, the token is hashed in our database, and you will never be able to view the raw string again.

Step 2.2: Configuring Cursor (HTTP/SSE Method)

The HTTP/SSE (Server-Sent Events) method is the recommended approach because it requires zero local installation. The MCP server runs on NoCodeBackend's infrastructure, and Cursor connects to it over the internet.

  1. Open Cursor.
  2. Navigate to Cursor Settings (Cmd + Shift + J on Mac) > Features > MCP.
  3. Click + Add New MCP Server.
  4. Set the Type to sse.
  5. Name it NoCodeBackend.
  6. Set the URL to: https://mcp.nocodebackend.com/sse?token=YOUR_COPIED_TOKEN
  7. Click Save. The status indicator should turn green, indicating a successful connection.

3. Configuration & Parameters: Local Stdio Connection

If you prefer not to use the hosted SSE server (e.g., you are experiencing corporate firewall restrictions that block outbound SSE connections), you can run the NoCodeBackend MCP server locally using the stdio method.

Stdio Setup

  1. Ensure you have Node.js (v18+) installed on your local machine.
  2. In Cursor's MCP Settings, add a new server.
  3. Set the Type to command.
  4. Name it NoCodeBackend Local.
  5. Set the Command to: npx @nocodebackend/mcp-server
  6. Click Save.

Configuring the Token for Stdio: Because the command runs locally, it needs access to your MCP token to authenticate with our API. You must provide this via an environment variable. In your terminal profile (e.g., ~/.zshrc or ~/.bash_profile), export the token:

export NCB_MCP_TOKEN="your_copied_token"

Restart Cursor to ensure it picks up the environment variable before launching the npx command.


4. Best Practices & Edge Cases

AI Prompting with MCP

Once connected, you no longer need to explain your backend to the AI. Try these prompts in your Cursor chat:

  • "Write a React component that fetches data from my NoCodeBackend database. Use the MCP schema tool to figure out what columns I have in the products table."
  • "Look at my API documentation using MCP. Write a TypeScript interface for the POST /orders payload."
  • "Run a MySQL query to see what the data inside the users table looks like, then write a parsing function to format the timestamps."

Security Considerations

  • Token Exfiltration: An MCP token grants read access to your database schema and live data via SQL queries. Treat it like a production API key. Do not commit it to your git repository.
  • Revocation: If you suspect a token has been compromised (e.g., a contractor leaves your company), navigate to Developer Settings > MCP, find the specific token by name, and click Revoke. Any AI assistant using that token will be immediately disconnected.

5. Troubleshooting

Common Errors

Error: Connection Failed: Unauthorized (401)

  • Cause: The token you appended to the SSE URL is incorrect, malformed, or has been revoked.
  • Resolution: Generate a brand new token from the dashboard and update the URL in your AI assistant settings. Ensure there are no spaces or trailing characters in the URL string.

Error: Command Failed: npx command not found (Stdio only)

  • Cause: Your AI assistant's execution environment cannot locate Node.js in its PATH.
  • Resolution: Use the absolute path to npx in the command configuration (e.g., /usr/local/bin/npx @nocodebackend/mcp-server), or switch to the recommended HTTP/SSE connection method which requires no local dependencies.

Error: AI says "I don't have access to your database"

  • Cause: The connection is green, but the AI context engine hasn't realized the tools are available.
  • Resolution: Explicitly instruct the AI in your prompt: "Please use the get_schema tool provided by the NoCodeBackend MCP server to check my database."
MCP Integration (Model Context Protocol) | Help Center