Elena' s AI Blog

Cursor AI with MCP tools

29 Apr 2026 (updated: 29 Apr 2026) / 10 minutes to read

Elena Daehnhardt


Generated by ChatGPT-5. Prompt: AI-assisted coding workspace inspired by Cursor — November 2025.


TL;DR:
  • MCP turns Cursor into a tool-using assistant by exposing external capabilities through controlled server endpoints, reducing context switching and improving implementation speed.

Previous: Part 8 — Gemini CLI versus Claude CLI

Next: Part 12 — Python coding with chatGPT

Introduction

If you have been using Cursor AI for a while, you might have noticed that the assistant is great at reading and writing code, but it can only work with what you give it. It cannot peek into your database, check your API documentation, or inspect live logs on its own. MCP (Model Context Protocol) servers solve exactly this problem — they act as a bridge connecting Cursor’s AI assistant to external systems and data sources.

In this post, I walk through what MCP servers are, how to configure them in Cursor, and how to write a simple one from scratch in Python.

Why MCP Matters

Without MCP, a typical debugging session looks roughly like this:

  1. Check the code in your editor.
  2. Read the logs in a terminal.
  3. Query the database in a separate client.
  4. Look up the API schema in a browser tab.
  5. Jump back to the editor to make changes.

All that context switching is tiring and slow. MCP brings that external information directly into the AI assistant, so you can stay in one place and ask questions that span all of those sources at once.

More precisely, instead of manually explaining your project’s structure to the AI on every session, you register MCP servers that give it live, up-to-date access to your tools. The AI then decides which server to call based on what you ask.

How It Works

An MCP server exposes a set of tools — named functions the language model can invoke automatically when your prompt calls for them. Under the hood, communication uses JSON-RPC 2.0, and Cursor supports several transport mechanisms:

  • stdio — the server runs as a local subprocess; Cursor talks to it via standard input/output. Simple to set up, great for development.
  • Streamable HTTP — the server listens on an HTTP endpoint and supports multiple concurrent connections. Better suited for remote or shared servers.
  • SSE (Server-Sent Events) — an older HTTP-based transport that is now deprecated in the MCP specification. Prefer Streamable HTTP for new integrations.

You configure an MCP server by adding a JSON block to a mcp.json file — either globally in ~/.cursor/mcp.json (available across all your projects) or locally in .cursor/mcp.json inside a specific project directory. The configuration tells Cursor the server’s name, how to start or reach it, and any environment variables it needs (such as API keys).

For security, the protocol keeps a human in the loop: Cursor shows a visual indicator whenever a tool is about to be called, and may ask you to confirm before executing sensitive operations. MCP servers run with whatever credentials you give them, so treat each one as a trusted integration and be careful about what permissions you grant.

Examples of Usage and Setup

Here are three practical examples of MCP servers you can plug into Cursor today.

1. Apidog MCP Server for API Documentation

This server gives the AI real-time access to your API documentation, which is useful for generating typed clients, writing validation logic, or adding field-level comments based on your actual schema.

To install:

  1. Generate an API access token and locate your Project ID inside Apidog.
  2. Add the following to your Cursor mcp.json. The example below is for Windows; on macOS/Linux replace "cmd", "/c" with "npx" directly:
{
  "mcpServers": {
    "API specification": {
      "command": "cmd",
      "args": [
        "/c",
        "npx",
        "-y",
        "apidog-mcp-server@latest",
        "--project-id=<project-id>"
      ],
      "env": {
        "APIDOG_ACCESS_TOKEN": "<access-token>"
      }
    }
  }
}

After saving and restarting Cursor, you can use prompts like:

  • “Generate TypeScript interfaces for all data models in our API documentation.”
  • “Create a Python client for the authentication endpoints according to our API documentation.”
  • “Add comments for each field in the Product class based on the API documentation.”

2. Stripe MCP Server for Payment Processing

The Stripe MCP server exposes tools that wrap the Stripe API — things like listing invoices, creating payment links, or triggering refunds — so you can build and test payment features using natural language.

You can install it with a one-click deep-link from Stripe’s docs, or manually add it to mcp.json. For the remote (Streamable HTTP) variant:

{
  "mcpServers": {
    "stripe": {
      "url": "https://mcp.stripe.com"
    }
  }
}

Once configured, Cursor’s agent automatically discovers the available tools — such as list_invoices or create_payment_link — and calls them when your prompt warrants it.

3. Figma Dev Mode MCP Server for Design-to-Code Workflows

This server connects Cursor to Figma’s Dev Mode, giving the AI access to design tokens, component specs, and layout data. It is particularly handy for generating code that faithfully matches your designs.

To install:

  1. In the Figma desktop app, enable “Dev Mode MCP Server” under Preferences.
  2. Add the server to your global mcp.json. Because it runs locally, it uses the stdio transport:
{
  "mcpServers": {
    "figma-dev-mode": {
      "command": "npx",
      "args": ["-y", "figma-dev-mode-mcp-server"]
    }
  }
}

With the server running, you can ask Cursor to generate code from a selected Figma frame, extract design variables and component names, or use Code Connect to tie design components to your existing implementation.

Key Benefits

  • Real-time context. The AI works with live data from your APIs, databases, and design files — not a stale snapshot you pasted into the chat.
  • Less context switching. Your entire workflow stays inside the IDE. No more jumping between browser tabs and terminals to gather information.
  • Automated multi-step workflows. The agent can chain tool calls — for example, query the database, cross-reference the API docs, and propose a fix — all from a single prompt.
  • Controlled access. The mcp.json configuration and the human-in-the-loop confirmation step let you decide exactly which tools the AI can reach and when.

A Simple MCP Server in Python

Want to write your own? The official MCP Python SDK makes it straightforward. Below is a minimal database query tool built with FastMCP, the high-level interface from the SDK.

First, install the SDK:

pip install "mcp[cli]"

Then create the server:

# tools/db_query_server.py
import sqlite3
from mcp.server.fastmcp import FastMCP

mcp = FastMCP("Database Query Server")

@mcp.tool()
def query_database(query: str) -> dict:
    """Execute a read-only SQL query against app.db and return the results."""
    conn = sqlite3.connect("app.db")
    cursor = conn.cursor()
    try:
        cursor.execute(query)
        columns = [desc[0] for desc in cursor.description]
        rows = cursor.fetchall()
        return {
            "status": "success",
            "data": [dict(zip(columns, row)) for row in rows],
        }
    except Exception as e:
        return {"status": "error", "message": str(e)}
    finally:
        conn.close()

if __name__ == "__main__":
    mcp.run()  # defaults to stdio transport

Register it in your project’s .cursor/mcp.json:

{
  "mcpServers": {
    "database-query": {
      "command": "python",
      "args": ["tools/db_query_server.py"]
    }
  }
}

Now you can ask:

Use the database-query tool to show me all users created today, then check if there were authentication errors for these users

Cursor invokes the tool, gets the results back as structured JSON, and weaves them into its response. It works surprisingly well once you try it!

One important note: for stdio-based servers, never write to stdout outside of the MCP protocol itself — doing so corrupts the JSON-RPC message stream. Use sys.stderr or a logging library for any debug output.

Did you like this post? Please let me know if you have any comments or suggestions about your experience with AI-powered development tools. I am always happy to learn from your experiences, too!

References

  1. Cursor AI Documentation — Model Context Protocol
  2. Model Context Protocol
  3. MCP Python SDK
  4. Amazon Kiro AI
  5. Guide: How to Handle Big Projects With Cursor
desktop bg dark

About Elena

Elena, a PhD in Computer Science, simplifies AI concepts and helps you use machine learning.

Citation
Elena Daehnhardt. (2026) 'Cursor AI with MCP tools', daehnhardt.com, 29 April 2026. Available at: https://daehnhardt.com/blog/2026/04/29/cursor-ai-creating-a-mcp-server/
All Posts