[Cursor-Guide]Working with Documentation

Author:Cursor
Platform:本地文件
Date:2025-05-31

Learn how to effectively leverage documentation in Cursor through prompting, external sources, and internal context. Improve API understanding and stay updated with current best practices.

documentationCursorAPIbest practicesknowledge cutoffpromptingexternal sourcesinternal context

[Cursor-Guide]Working with Documentation

原始链接: 原始链接

How to leverage documentation effectively in Cursor through prompting, external sources, and internal context

Why documentation matters

Documentation provides current, accurate context. Without it, models use outdated or incomplete training data. Documentation helps models understand things like:

  • Current APIs and parameters
  • Best practices
  • Organization conventions
  • Domain terminology

And much more. Read on to learn how to use documentation right in Cursor without having to context switch.

Model knowledge cutoff

Large language models are trained on data up to a specific point in time, called a “knowledge cutoff.” This means:

  • Recent library updates might not be reflected
  • New frameworks or tools may be unknown
  • API changes after the cutoff date are missed
  • Best practices may have evolved since training

For example, if a model’s knowledge cutoff is early 2024, it won’t know about features released in late 2024, even for popular frameworks.

Which tool should I use?

Use this decision tree to help decide which tool to use

workwithdocumentation-1

Mental model

ToolMental Model
@DocsLike browsing and reading official documentation
@WebLike searching for solutions on the internet
MCPLike accessing your internal documentation

Public documentation

External documentation covers publicly available information that models might have limited or outdated knowledge about. Cursor provides two primary ways to access this information.

Using @Docs

@Docs connects Cursor to official documentation from popular tools and frameworks. Use it when you need current, authoritative information about:

  • API references : Function signatures, parameters, return types
  • Getting started guides : Setup, configuration, basic usage
  • Best practices : Recommended patterns from the source
  • Framework-specific debugging : Official troubleshooting guides

workwithdocumentation-2

Using @Web

@Web searches the live internet for current information, blog posts, and community discussions. Use it when you need:

  • Recent tutorials : Community-generated content and examples
  • Comparisons : Articles comparing different approaches
  • Recent updates : Very recent updates or announcements
  • Multiple perspectives : Different approaches to problems

workwithdocumentation-3

Internal documentation

Internal documentation includes information specific to your organization that AI models have never encountered during training. This might be:

  • Internal APIs : Custom services and microservices
  • Company standards : Coding conventions, architecture patterns
  • Proprietary systems : Custom tools, databases, workflows
  • Domain knowledge : Business logic, compliance requirements

Accessing internal docs with MCP

Model Context Protocol (MCP) provides a standardized way to bring your private documentation and systems into Cursor. MCP acts as a thin layer between Cursor and your internal resources.

Why MCP matters:

  • Models can’t guess your internal conventions
  • API documentation for custom services isn’t publicly available
  • Business logic and domain knowledge is unique to your organization
  • Compliance and security requirements vary by company

Common MCP integrations

IntegrationAccessExamples
ConfluenceCompany Confluence spacesArchitecture documentation, API specifications for internal services, coding standards and guidelines, process documentation
Google DriveShared documents and foldersSpecification documents, meeting notes and decision records, design documents and requirements, team knowledge bases
NotionWorkspace databases and pagesProject documentation, team wikis, knowledge bases, product requirements, technical specifications
CustomInternal systems and databasesProprietary APIs, legacy documentation systems, custom knowledge bases, specialized tools and workflows

Custom solutions

For unique needs, you can build custom MCP servers that:

  • Scrape internal websites or portals
  • Connect to proprietary databases
  • Access custom documentation systems
  • Pull from internal wikis or knowledge bases

If you build a custom MCP server, you can also expose tools for Cursor to update the documentation

Example custom MCP server for scraping internal docs:

import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";

import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";

import { z } from "zod";

import TurndownService from "turndown";

// Create an MCP server for scraping internal docs

const server = new McpServer({

  name: "internal-docs",

  version: "1.0.0"

});

const turndownService = new TurndownService();

// Add tool to scrape internal documentation

server.tool("get_doc",

  { url: z.string() },

  async ({ url }) => {

    try {

      const response = await fetch(url);

      const html = await response.text();

      // Convert HTML to markdown

      const markdown = turndownService.turndown(html);

      return {

        content: [{ type: "text", text: markdown }]

      };

    } catch (error) {

      return {

        content: [{ type: "text", text: `Error scraping ${url}: ${error.message}` }]

      };

    }

  }

);

// Start receiving messages on stdin and sending messages on stdout

const transport = new StdioServerTransport();

await server.connect(transport);

Keeping docs up to date

Documentation becomes stale quickly. Cursor can help you maintain current, useful documentation by generating and updating it based on your actual code and development conversations.

From existing code

Use Cursor to create documentation directly from your codebase:

  • API Documentation
Generate API documentation for this Express router, including all endpoints, parameters, and response formats

workwithdocumentation-4

  • JSDoc Comments
Add comprehensive JSDoc comments to this class, documenting all methods and their parameters

workwithdocumentation-5

  • README Creation
Create a README for this project that includes setup instructions, usage examples, and API overview

workwithdocumentation-6

From chat sessions

Your conversations with Cursor contain valuable intent that can be turned into documentation.

  • Problem Solving
Summarize our conversation about setting up authentication into a step-by-step guide for the team wiki

workwithdocumentation-7

  • Architecture
Create documentation explaining why we chose this database design, including the trade-offs we discussed

workwithdocumentation-8

  • Debugging
Write a troubleshooting guide based on this bug we just fixed, including symptoms and resolution steps

workwithdocumentation-9

Takeaways

  • Documentation as context makes Cursor more accurate and current
  • Use @Docs for official documentation and @Web for community knowledge
  • MCP bridges the gap between Cursor and your internal systems
  • Generate documentation from code and conversations to keep knowledge current
  • Combine external and internal documentation sources for comprehensive understanding

Article Series Index