当前位置: 首页 > news >正文

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

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.

 

相关文章:

  • 【eNSP实战】配置DHCP中继为非直连网段分配IP地址
  • AMI BIOS适配声卡
  • 数字孪生像魔镜,映照出无限可能的未来
  • leetcode0030 串联所有单词的子串-hard
  • WPF Prism事件聚合器EventAggregator
  • SQL与NoSQL的区别
  • Langchian构建代理
  • Django系列教程(12)——连接MySQL和PostgreSQL数据库
  • Devops CI/CD
  • 洛谷 P1962:斐波那契数列 ← 矩阵快速幂
  • JavaScript介绍-变量、常量、数据类型、类型转换
  • 车载以太网测试-13【网络层-IGMP协议】
  • 计算机网络——NAT
  • 深入解析大语言模型的 Function Call 实现—— 以 Qwen2.5为例
  • C# NX二次开发:在多个体的模型中如何实现拉伸操作布尔减
  • Java入职篇(5)—— IDEA快捷键
  • 使用 Docker 部署前端项目全攻略
  • DevOps实践:持续集成与持续部署完全指南
  • 图解AUTOSAR_CP_BSW_General
  • 什么是 HTML?
  • 年轻人能为“老有意思”做点什么
  • 美国证实加拿大及墨西哥汽车零部件免关税
  • 网警查处编造传播“登顶泰山最高可得3万奖金”网络谣言者
  • 铁路迎来节前出行高峰,今日全国铁路预计发送旅客1870万人次
  • 国家卫健委有关负责人就白皮书发布答记者问
  • 外媒称菲方允许菲官员窜台,国台办:应停止在台湾问题上玩火