Mac下安装Zed以及Zed对MCP(模型上下文协议)的支持

embedded/2025/3/17 4:54:18/

Zed是当前新流行的一种编辑器,支持MCP(模型上下文协议)

Mac下安装Zed比较简单,直接有安装包,在这里:

brew install --cask zed

Mac Monterey下是可以安装上的,亲测有效。

配置

使用Ctrl+Shift+P调出AI,然后设置使用的模型

可以使用deepseek,但是没有找到使用自建服务器的设置方法,有些遗憾。

附加学习

关于Zed里面的MCP部分,手册:Model Context Protocol - Zed 

也就是有个Postgres数据库的MCP Server的扩展,代码在:https://github.com/zed-extensions/postgres-context-server

配置和使用,见后面

Zed Postgres Context Server

This extension provides a Model Context Server for Postgres, for use with the Zed AI assistant.

It adds a /pg-schema slash command to the Assistant Panel.

Configuration

To use the extension, you will need to point the context server at a Postgres database by setting the database_url in your Zed settings.json:

{"context_servers": {"postgres-context-server": {"settings": {"database_url": "postgresql://myuser:mypassword@localhost:5432/mydatabase"}}}
}

Usage

  • /pg-schema <table-name>: Retrieve the schema for the table with the given name.
  • /pg-schema all-tables: Retrieve the schemas for all tables in the database.

 

设置参考这里:Context Server Extensions - Zed 

 

Model Context Protocol

Zed uses the Model Context Protocol to interact with context servers:

The Model Context Protocol (MCP) is an open protocol that enables seamless integration between LLM applications and external data sources and tools. Whether you're building an AI-powered IDE, enhancing a chat interface, or creating custom AI workflows, MCP provides a standardized way to connect LLMs with the context they need.

Check out the Anthropic news post and the Zed blog post for an introduction to MCP.

Try it out

Want to try it for yourself?

The following context servers are available today as Zed extensions:

  • Postgres Context Server

Bring your own context server

If there's an existing context server you'd like to bring to Zed, check out the context server extension docs for how to make it available as an extension.

If you are interested in building your own context server, check out the Model Context Protocol docs to get started.

Context Servers

Extensions may provide context servers for use in the Assistant.

Example extension

To see a working example of an extension that provides context servers, check out the postgres-context-server extension.

This extension can be installed as a dev extension if you want to try it out for yourself.

Defining context servers

A given extension may provide one or more context servers. Each context server must be registered in the extension.toml:

 

[context_servers.my-context-server]

Then, in the Rust code for your extension, implement the context_server_command method on your extension:

 
 

impl zed::Extension for MyExtension { fn context_server_command( &mut self, context_server_id: &ContextServerId, project: &zed::Project, ) -> Result<zed::Command> { Ok(zed::Command { command: get_path_to_context_server_executable()?, args: get_args_for_context_server()?, env: get_env_for_context_server()?, }) } }

This method should return the command to start up a context server, along with any arguments or environment variables necessary for it to function.

If you need to download the context server from an external source—like GitHub Releases or npm—you can also do this here.

 


http://www.ppmy.cn/embedded/173249.html

相关文章

游戏引擎学习第157天

今天的计划 目标是完整制作一款游戏&#xff0c;从头到尾的开发过程完全展示。过程中没有使用任何游戏引擎或库&#xff0c;目的是展示一个全面的游戏开发过程&#xff0c;包括每一个细节&#xff0c;从最基础的像素开始&#xff0c;直到最终的视觉效果。在整个过程中&#xf…

深入理解 Reactor Netty 线程配置及启动命令设置

一、引言 在使用 Spring Boot 开发基于 Reactor Netty 的应用程序时&#xff0c;合理配置 Reactor Netty 的线程参数对于优化应用性能至关重要。本文将详细介绍 reactor.netty.ioSelectCount 和 reactor.netty.ioWorkerCount 这两个关键参数的作用、不同设置值的影响&#xff0…

基于stm32的视觉物流机器人

标题:基于stm32的视觉物流机器人 内容:1.摘要 本文围绕基于STM32的视觉物流机器人展开研究。背景是随着物流行业的快速发展&#xff0c;对物流自动化和智能化的需求日益增长&#xff0c;传统物流方式效率低且成本高。目的是设计一款基于STM32的视觉物流机器人&#xff0c;以提…

prompt工程起步

1.手工提示词 有关CLIP和ActionClip的手工特征,也是一个进步。通过给标签填入不同的修饰语当中&#xff0c;组成一段话来,来增强语义理解 def text_prompt(data):text_aug [f"a photo of action {{}}", f"a picture of action {{}}", f"Human acti…

QT:非模态使用WA_DeleteOnClose避免内存泄漏

connect(ui->actionnewFile,&QAction::triggered,this,[](){QDialog*dlg new QDialog(this);//dlg.exec();dlg->show();dlg->setAttribute(Qt::WA_DeleteOnClose);qDebug()<<"打开对话框";}); 1. QDialog* dlg new QDialog(this); - 创建了…

java手机号、邮箱、日期正则表达式

Java正则核心API Java中用 java.util.regex 包的两个类&#xff1a; Pattern&#xff1a;编译正则表达式Matcher&#xff1a;执行匹配操作 1. 验证手机号 String regex "1[3-9]\\d{9}"; boolean isValid "18812345678".matches(regex); // true2. 提取…

【BP神经网络】实战

1.参考Python实战&#xff1a;BP神经网络_bp神经网络实战python-CSDN博客 2.实践 &#xff08;1&#xff09;运行环境 anocanda Powershell Prompt&#xff08;anocanda3&#xff09; &#xff08;2&#xff09;创建虚拟环境&#xff0c;解决安装包的版本问题 *打开终端&a…

【小沐学Web3D】three.js 加载三维模型(React)

文章目录 1、简介1.1 three.js1.2 react.js 2、three.js React结语 1、简介 1.1 three.js Three.js 是一款 webGL&#xff08;3D绘图标准&#xff09;引擎&#xff0c;可以运行于所有支持 webGL 的浏览器。Three.js 封装了 webGL 底层的 API &#xff0c;为我们提供了高级的…