GitHub Copilot本地服务器

一个基于FastMCP的HTTP MCP服务器,使本地GitHub Copilot实例能够连接并与之交互,实现代码补全和相关功能。

  • by agostini01
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 agostini01/python-mcp-server-template

使用说明

MCP Python模板

使用FastMCP实现HTTP MCP服务器,使本地GitHub Copilot实例能够连接并与服务器交互,以完成代码和相关功能。

.vscode/mcp.json 注册URL以查询MCP服务器。服务器可以在文件中重新启动。

src/mcp_python/main.py 实现MCP工具和服务器逻辑。

这是一个Python项目,使用 python:3.10-slim 作为基础图像和 pixi 用于包管理。

支持的MCP工具

  • fetch_gitignore_template_content:获取a .gitignore 基于提供的语言或框架的模板。使用 https://docs.gitignore.io/ api来检索模板内容。

启动MCP服务器

设置环境后,在终端中运行以下命令启动MCP服务器:

cd src/mcp_python
python main.py

样本交互

创建新 test.gitignore 文件。在副驾驶聊天窗口中使用代理模式类型:

Update this git ignore file with contents with Node information derived from tools

GitHub回复副本:

Ran fetch_gitignore_template_content - my-mcp-server...


Made changes.

I’ve updated the .ts.gitignore file with Node.js-specific ignore rules to handle common files and directories. Let me know if you need further adjustments!

发展

这个项目提供了一个使用Docker的vscode开发容器设置。

依赖关系管理

使用添加依赖项 pixi add <package> 命令或 pixi pypi add <package> 对于Python包。这 pyproject.toml 文件将自动更新。