匠人学院 JR Academy
  • Position

    Where am I now, and where should I go?

    How your job is changing, where your experience can take you and what you still need for a target role, worked out from what you have actually done. Free, and the full result needs no sign-up.

    Analyse my career and skills

    Look up a career

    Will AI replace my job?AI impact and transition paths for common careersNew jobs in the AI eraWhat they do, what they need, how to move in

    Focused tools

    AI Engineer interview readiness30 timed questions on what you still need before interviewsCareer personality testDirections that suit how you workReturning to China checkJob prospects in China by school, major and graduation date

    AI coach

    Talk to your AI coachStill unsure after your result? Talk through what is holding you back
  • Core courses

    AI Engineer BootcampEngineering bootcamp from LLM apps to agentsAI Engineer Full-Stack Project Class16 weeks · RAG and full-stack AI projectsVibe Coding Masterclass8 weeks · direct agents to build and ship a productAI Essentials10 hours · use AI for email, reports, data and copyAI Office Automation Course8 weeks · help a whole company adopt AIOne-Person Company (OPC) Bootcamp15 weeks in person · build a one-person company with AIAll courses →

    AI engineering

    Machine Learning & Data Engineering Full-Stack ClassAI Agent & MCP Project BootcampAI Engineer Core TechniquesAI Engineer FoundationsAI Engineer Advanced: RAG to Agents and TuningClaude Code TasterAll AI engineering courses →

    AI at work

    AI Coding for everyoneClaude Code One-Day Masterclass (Non-Technical)Enterprise AI Automation BootcampAI Marketing BootcampAI Risk, Governance and Audit CourseOpenClaw 4-Week Personal AI Assistant BootcampAll AI-at-work courses →

    Career development

    AI Product Manager (BA) Bootcamp + InternshipAustralia IT Interview BootcampAustralia IT Technical Interview BootcampAustralia IT Resume BootcampAustralia Big Tech Job Search BootcampAustralia IT Career Planning BootcampAll career courses →

    Learn free first

    Vibe CodingAI for office workPrompt MasterAI EngineerAI data analysisResource centerInstructorsAll learning paths →
  • Evidence

    What will convince an employer?

    Certifications, projects, team work and competition entries, collected into one portfolio.

    See the portfolio

    Certifications

    Cert Master · all certificationsPrep and mock exams for AWS, Azure, GCP, Claude and moreAWS CLF-C02Entry-level AWS cloud certificationAWS SAA-C03Entry certification for cloud architectsClaude certificationsAnthropic Claude certification seriesAll certifications →

    Projects and team work

    P3 team projectsBuild a project with real teammates in a simulated team workflowP3 project experienceThe parts of a P3 project that go on your resumeDemo DayProject showcaseP3 certificatesProof once a project is completeAll of P3 →

    Competitions and work

    HackathonsBuild something against the clockSubmit your workAdd your project to the showcaseCareerOS portfolioDo tasks in the desktop app; your results become portfolio pieces
    Cert MasterBrowser extension, app and mini programScreenshot a question for analysis and practise anywhereAbout Cert Master
  • Connect

    How do I get myself in front of employers?

    Resume, interviews, referrals and mentors. See how far you are from the target role first, then decide what to fix.

    Start with Jobpin

    Resume and openings

    Graduate careersGraduate preparation across Australia, China, Malaysia, Singapore, the US and UKJobpinAI job search workspace: resume, roles, applicationsAI resumeRewrite your resume against a job descriptionReferralsRoles shared by students and mentorsOpportunitiesInternships, projects and collaborationsOffer boardOffers students have received

    Interviews

    AI Engineer interview guideSeven areas, with worked examplesFDE interview guideFive rounds, from scoping to the customer roundAI mock interviewPractise by text or voice and see the gapsInterview storiesReal interview experiencesSystem Design handbookPrepare for system design interviewsAll interview prep →

    Mentors

    1:1 mentorsBook AI, career and technical mentors by the hourGroup tutoringShare a tutor with a few others and pay less eachCareer coachingResume, interview and direction packages
    Jobpin desktopOne workspace for the whole job searchOrganise real experience and refine resume versions for target roles on macOS or Windows.About Jobpin
BusinessMembershipDownload CareerOS
0
匠人学院 JR Academy

Follow Us

linkedinfacebooktwitterinstagramyoutube

We Accept

/image/layout/pay-paypal.png/image/layout/pay-visa.png/image/layout/pay-master-card.png/image/layout/pay-airwallex.png/image/layout/pay-alipay.png
Airbotix · AI learning & creation for kids Another Life · AI story game
Products46

CareerOS and tools

  • CareerOS
  • Cert Master
  • Jobpin
  • Jobpin web
  • Jobpin report
  • Jobpin desktop download
  • My job search reports
  • Buy report credits
  • Jobpin billing
  • AI Toolbox
  • AI Skill Marketplace

Membership

  • Membership
  • AI membership

Courses

  • Bootcamps
  • Training Camp
  • Kanban learning
  • AI Builder course
  • MCP course
  • NotebookLM workshop
  • Business Analyst course
  • Web Full-Stack Bootcamp
  • DevOps Bootcamp
  • Data Engineering Bootcamp
  • Data Analysis Bootcamp
  • Coding for Beginners
  • Algorithm Bootcamp

Career services

  • Graduate careers
  • Graduate careers in Australia
  • Graduate careers in China
  • Graduate careers in Malaysia
  • Graduate careers in Singapore
  • Graduate careers in the US
  • Graduate careers in the UK
  • 1:1 coaching
  • Career coaching
  • AI Engineer VIP
  • BA & PM Internship
  • Data Science Internship
  • Data Analysis Internship
  • Marketing Internship
  • Resume Review
  • Interview Coaching
  • Job Application Service
  • Job Monitoring
  • LinkedIn Management
  • LinkedIn Networking
Library57

Learning paths

  • All Learning Paths
  • AI Engineer
  • Context Engineering
  • Vibe Coding
  • Prompt Master
  • AI Builder
  • AI Product Manager
  • Python Basics
  • AI Productivity
  • AI Data Analysis
  • AI Finance
  • AI Content Creation
  • AI Image Creation
  • Frontend Development
  • Hermes Agent
  • OpenClaw Local Agent

Interactive labs

  • Prompt Lab
  • Frontend Lab
  • JavaScript Lab
  • Python Lab
  • AWS Lab
  • Azure Lab
  • LLM Lab
  • Git Lab

Reference and guides

  • Resources
  • Wiki
  • Cheat sheets
  • Roadmaps
  • AI roadmaps
  • Videos
  • Ebooks
  • Blog
  • Interview handbook
  • Mock exams
  • Free resources

Cities

  • Sydney
  • Melbourne
  • Brisbane
  • Adelaide
  • Singapore
  • Kuala Lumpur
  • London
  • New York
  • San Francisco
  • Los Angeles
  • Seattle
  • Toronto
  • Vancouver

Immigration

  • Australia Immigration
  • Skilled Visa 189/190/491
  • Employer Sponsored 482/186/494
  • Business Visa 188/888
  • UK Immigration
  • US Immigration
  • Canada Immigration
  • Singapore immigration
  • Malaysia immigration
Business20

For business

  • AI for Business
  • Business portal sign-in
  • Corporate Training
  • Internship Partnership
  • Recruitment Partnership
  • Enterprise (EN)

Metatree AI Lab

  • Metatree AI Lab (Chinese)
  • AI solutions (Chinese)
  • Digital employees (Chinese)
  • Case studies (Chinese)
  • Metatree AI Lab
  • AI services
  • Digital employees
  • Case studies

AI education for kids

  • Airbotix — AI Learning & Creation for Kids
  • AU Family Resource Hub
  • NAPLAN Report Guide
  • My School Data Guide
  • Sydney Private School Fees 2026
  • Kids Coding Programs
About15

Company

  • About Us
  • Our Mentors
  • Become a Mentor
  • Metaverse Classroom
  • JR Careers
  • Another Life — AI Story Game
  • Contact Us

Help and policies

  • FAQs
  • Terms & Conditions
  • Privacy Policy
  • Cancellation & Refund Policy
  • Site map

Friend links

  • CS Browser

Contact

  • hello@jiangren.com.au
  • 0421-672-555

Offices

Level 10b, 144 Edward Street, Brisbane CBD (Headquarter)
Level 2, 171 La Trobe St, Melbourne VIC 3000
45A13, Block B, Oriental Hope Tianxiang Plaza, 500 Tianfu Avenue Middle Section, Wuhou District, Chengdu, Sichuan, China
Business Hub, 155 Waymouth St, Adelaide SA 5000
Disclaimer
footer-disclaimerfooter-disclaimer

JR Academy acknowledges Traditional Owners of Country throughout Australia and recognises the continuing connection to lands, waters and communities. We pay our respect to Aboriginal and Torres Strait Islander cultures; and to Elders past and present. Aboriginal and Torres Strait Islander peoples should be aware that this website may contain images or names of people who have since passed away.

All content on the JR Academy website, including course materials, logos, and information provided, is protected under Australian intellectual property laws. Unauthorized use, sale, distribution, reproduction, or modification is strictly prohibited. Violations may result in legal action. By accessing our website, you agree to respect our intellectual property. JR Academy Pty Ltd reserves all rights, including patents, trademarks, and copyrights. Any infringement will be subject to legal prosecution. View Terms of Service

© 2017-2026 JR Academy Pty Ltd. All rights reserved.

ABN 26621887572

HomeLearnCoursesCerts
  1. Home
  2. Learn
  3. Blog
  4. Cursor AI IDE 进阶指南 — Cursor MCP 集成实战
JR Academy · BlogCareer insights

Cursor AI IDE 进阶指南 — Cursor MCP 集成实战

GitHub MCP / Notion MCP / Postgres MCP 配置详解,Agent Mode 中的真实使用场景,让 Cursor Agent 直接操作你的代码仓库、文档库和数据库

Published2026-12-01
Reading time3 min
Author

Contents

  • MCP 是怎么工作的
  • 配置文件位置
  • GitHub MCP:让 Agent 直接操作仓库
  • 安装配置
  • 实际场景
  • Notion MCP:把文档接进工作流
  • 实际场景
  • Postgres MCP:自然语言查数据库
  • 实际场景
  • 多个 MCP 服务端同时配置
  • 安全注意事项
  • 常见问题排查
  • 下一步扩展

MCP(Model Context Protocol)是 Anthropic 提出的一个开放协议,定义了 AI 如何与外部工具和数据源通信。Cursor 从 0.43 版本起内置 MCP 支持,现在你可以把 GitHub、Notion、Postgres 这些工具直接接进 Agent Mode,让 AI 不只是"建议"——而是真的帮你执行操作。

截至 2026 年初,社区已有超过 5000 个 MCP 服务端,覆盖数据库、文档、监控、支付等几乎所有常见工具。

Cursor MCP 配置教程


MCP 是怎么工作的

每个 MCP 服务端对外暴露一批"工具"(tool),Agent 在对话时可以调用这些工具。比如:

  • Postgres MCP 暴露 query_database 工具
  • GitHub MCP 暴露 create_issue、list_pull_requests、get_file_contents 等工具
  • Notion MCP 暴露 search_pages、create_page、update_block 等工具

Agent 接到你的指令后,会自动判断要调哪些工具,构造请求,拿到结果,继续推理——全程不需要你手动切 tab。

注意:MCP 工具只在 Agent Mode 下可用,普通 Ask / Chat 模式里不触发。


配置文件位置

Cursor 的 MCP 配置写在 JSON 文件里,有两个层级:

配置文件 作用范围
.cursor/mcp.json(项目根目录) 只对当前项目生效,可以提交进 git(注意不要 hardcode 密钥)
~/.cursor/mcp.json(用户主目录) 全局生效,所有项目共用

基本格式:

{
  "mcpServers": {
    "服务名": {
      "command": "运行命令",
      "args": ["参数列表"],
      "env": {
        "环境变量名": "值"
      }
    }
  }
}

密钥不要 hardcode,用 ${env:变量名} 从系统环境变量读取:

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_TOKEN": "${env:GITHUB_TOKEN}"
      }
    }
  }
}

配置完后,打开 Cursor Settings → Tools & MCP,能看到每个服务端的状态指示灯。绿色表示正常,红色说明启动失败——通常是命令不存在或 token 无效。


GitHub MCP:让 Agent 直接操作仓库

安装配置

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_TOKEN": "${env:GITHUB_TOKEN}"
      }
    }
  }
}

GITHUB_TOKEN 用 Personal Access Token(PAT)。权限按需给:

  • 只读代码审查:勾选 repo:read
  • 需要创建 Issue / PR:勾选 repo(读写)
  • 不需要 Actions:不要勾 workflow

在终端里先 export:

export GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

或者加进 ~/.zshrc / ~/.bashrc 让每次启动自动生效。

实际场景

场景 1:调查一个陌生仓库

打开 Cursor,新建 Composer,输入:

用 github MCP 读一下 facebook/react 仓库最近 10 个 open PR,
找出哪些涉及 concurrent rendering,给我一个简短摘要

Agent 会调 list_pull_requests + get_pull_request,直接返回结果,不用你开浏览器。

场景 2:修完 bug 顺手开 Issue

你刚修了一个线上 bug,想把问题记录成 Issue 以便追踪:

在 my-org/my-repo 创建一个 Issue,标题是"Fix: 登录页 token 刷新竞态条件",
描述用中文,把刚才我们对话里找到的根因和修复方案写进去

Agent 调 create_issue,自动填好 body——你不用离开 IDE。

场景 3:Code Review 辅助

读一下 my-org/my-repo 的 PR #142,找出潜在的安全问题

Agent 拉 PR diff,分析代码,直接给你 review 意见。


Notion MCP:把文档接进工作流

Notion 官方在 2025 年发布了 @notionhq/notion-mcp-server,配置方式:

{
  "mcpServers": {
    "notion": {
      "command": "npx",
      "args": ["-y", "@notionhq/notion-mcp-server"],
      "env": {
        "OPENAPI_MCP_HEADERS": "{\"Authorization\": \"Bearer ${env:NOTION_TOKEN}\", \"Notion-Version\": \"2022-06-28\"}"
      }
    }
  }
}

NOTION_TOKEN 从 Notion 开发者页面创建 Integration 拿到(Internal Integration Token)。创建后在 Notion 页面右上角「连接」里授权给这个 Integration,它才能读写那个页面。

如果想用社区版(更轻量):

{
  "mcpServers": {
    "notion": {
      "command": "npx",
      "args": ["-y", "@suekou/mcp-notion-server"],
      "env": {
        "NOTION_API_TOKEN": "${env:NOTION_TOKEN}"
      }
    }
  }
}

实际场景

场景 1:读文档写代码

团队把 API 设计文档放在 Notion:

读 Notion 页面「用户服务 API v2 设计」,
根据里面的接口定义帮我生成 TypeScript 类型声明

Agent 调 retrieve_page,拿到 Notion 内容,直接生成类型文件。

场景 2:Bug 修完更新文档

刚修了用户登录流程的一个 bug,找到 Notion 里「登录服务已知问题」这个页面,
把今天修的问题追加进去(日期 2026-05-10,问题描述:token 刷新竞态,修复方式:加锁)

Agent 调 search(找页面)→ append_block_children(追加内容),文档更新到位。

场景 3:把 Sprint 任务转成代码骨架

读 Notion 数据库「2026 Q2 Sprint」里本周分配给我的任务,
帮我在 src/features/ 下生成对应的文件骨架

Postgres MCP:自然语言查数据库

{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres"],
      "env": {
        "DATABASE_URL": "${env:DATABASE_URL}"
      }
    }
  }
}

DATABASE_URL 格式:postgresql://user:password@host:5432/dbname

生产数据库建一个只读用户专门给 MCP 用,不要用 owner 账号:

-- 创建只读角色
CREATE USER cursor_mcp WITH PASSWORD 'xxxxx';
GRANT CONNECT ON DATABASE myapp TO cursor_mcp;
GRANT USAGE ON SCHEMA public TO cursor_mcp;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO cursor_mcp;
-- 对未来新建的表也生效
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO cursor_mcp;

实际场景

场景 1:调试时查线上数据

你在排查一个用户反馈的订单问题:

在 postgres 里查一下 user_id = 12345 最近 7 天的订单记录,
看看 status 和 payment_status 有没有不一致的情况

Agent 调 query,直接出结果,不用开 Postico / DBeaver / psql。

场景 2:理解陌生数据库

接手老项目,不熟悉 schema:

列出 postgres 里所有表,重点说明 users、orders、payments 这三张表的字段和关联关系

Agent 调 list_tables + describe_table,3 秒给你一份关系图谱。

场景 3:写迁移脚本

users 表目前没有 email_verified 字段,
帮我写一个 migration SQL,加这个字段并把现有所有 is_active=true 的用户设为已验证

Agent 查了表结构再生成 SQL,不会出现字段名写错的低级错误。


多个 MCP 服务端同时配置

实际工作中往往会同时接多个服务端:

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_TOKEN": "${env:GITHUB_TOKEN}"
      }
    },
    "notion": {
      "command": "npx",
      "args": ["-y", "@suekou/mcp-notion-server"],
      "env": {
        "NOTION_API_TOKEN": "${env:NOTION_TOKEN}"
      }
    },
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres"],
      "env": {
        "DATABASE_URL": "${env:DATABASE_URL}"
      }
    }
  }
}

这份配置放在 ~/.cursor/mcp.json(全局),所有项目共用,只在特定项目需要覆盖时才写 .cursor/mcp.json。


安全注意事项

最小权限原则:每个 MCP 服务端的凭证只给它真正需要的权限。GitHub token 只需要 read 就不要给 write。

工具审批模式:在 Cursor Settings → Agent 里可以开启"Ask before tool use"——每次 Agent 准备调用 MCP 工具时会先弹框让你确认,防止误操作。生产环境推荐打开。

不要提交密钥:.cursor/mcp.json 里用 ${env:VAR_NAME} 引用环境变量,密钥通过 .env.local 或系统环境变量注入,.env.local 加进 .gitignore。


常见问题排查

MCP 服务端显示红色 / 离线

99% 是 npx 找不到包或者 node 版本不对。先手动跑一下:

npx -y @modelcontextprotocol/server-github

看报什么错。常见原因:npm registry 超时(换源),node < 18(升级)。

Agent 说"我没有那个工具"

确认你在 Agent Mode(不是 Ask 模式)。然后看 Cursor Settings → Tools & MCP 里那个服务端是不是绿色在线。

Postgres 连接超时

检查 DATABASE_URL 里的 host 是否可从本机直接连(生产 RDS 一般要配 VPN 或 bastion)。本地开发用 localhost 就行。


下一步扩展

接完这三个之后,工程师们常见的进阶配置:

  • Playwright MCP:让 Agent 直接操控浏览器,做 E2E 测试、爬数据、自动填表单
  • Slack MCP:在 Cursor 里直接查频道消息、发通知
  • Stripe MCP:Agent 查订阅状态、退款记录,不用开 Dashboard
  • File System MCP:Agent 在本机指定目录里读写文件,适合批量处理脚本

MCP 目录站 cursor.directory 能搜到大部分社区维护的服务端,按需安装。

Author
Share or copy the link

Related learning resources

  • Vibe Coding tool comparison
  • AI Engineer learning path
← Previous articleCursor AI IDE 进阶指南 — 常见问题、定价与选型建议Next article →Cursor AI IDE 进阶指南 — .cursor/rules/*.mdc 深度解析

Related articles

USYD 医疗初创盘点、网络平台注意义务法案、全身 MRI 广告研究

2026-12-02

UQ 皮肤癌在线硕士开办 20 周年、中澳绿色钢铁对话、HIV 预防提醒

2026-12-02

UNSW iFire 2.3 火场模拟系统、AI 卵巢癌预后研究、艺术家与 AI 版权调查

2026-12-02

ANS-C01 退役倒计时 29 天 · AIB-C01 Beta $50 新认证上线 · MLA-C02 Beta 报名开放

2026-12-02

Amazon开放首个自研大模型Ergo,代理作弊率实测差距悬殊,Anthropic格密码结果暂无现实威胁

2026-12-02

GitHub Copilot 实战指南 — Copilot AI Code Review:30 秒让 AI 帮你审 PR,三档深度随需切换

2026-12-01
View all articles →

Done reading? Next steps

Not sure what to learn next? Tell us where you are

Tell us what you do now and where you want to go. See your gaps in skills, evidence, experience, expression and positioning, and what to work on first. No sign-in needed.

Compare with my situation
  • SkillAI Engineer Bootcamp13 weeks, 12 Theory + 13 Practice live classes. You build one Agent system across Context, RAG, Tools, Memory and production Evals. Built for Applied AI and Agent Engineer roles.See the program →
  • PositioningLearning roadmaps by roleFrontend, backend, data, AI and more, laid out stage by stage in the order to learn them.All roadmaps →
  • ExpressionTry an AI mock interviewPick a role and run a mock interview to practise explaining your experience and projects.Practise now →

Not sure what to do next?

Take this page's topic with you and see where your gaps are.

Compare with my situation
JR Academy
AI learning for the global Chinese community
BootcampsFree resourcesLearn AICareer coaching
精选推荐
AI Career Impact Map
Assess career exposure and explore transition paths and learning options
Popular tool
AI & Data Bootcamps
Build your skills through structured courses and hands-on projects
Popular courses
1:1 Career Coaching
Work with an experienced mentor on your resume and interview preparation
Career coaching
Custom Corporate Training
AI training tailored to your team
Business services
Popular tags
Vibe CodingAI codingCursorClaudeJob searchPromptFrontend developmentBackend development
Subscribe to updates

Receive AI learning resources, technical tutorials and career advice by email.

We respect your privacy and do not send spam.