Token导航 LogoToken导航TokenDH.com
Llama GitHub MCP logo
开发工具stdio官方级别未说明来源级核验

Llama GitHub MCP

MCP Server

一个集成Llama模型和GitHub仓库文件列表功能的FastAPI服务器,用于增强AI应用的信息获取能力。

工具数

3

提示词数

0

GitHub Stars

0

资源数

0
本地LLM上下文管理PythonAPI集成GitHub工具

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

EXPESRaza

提供方

EXPESRaza

最后核验

2026/5/17 20:23

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

pip install -r requirements.txt

详细介绍

Llama与GitHub集成的模型上下文协议服务器

此存储库包含一个模型上下文协议(MCP)服务器实现,该实现与本地运行的Llama模型集成,并提供GitHub存储库文件列表功能。MCP服务器利用来自本地LLM和GitHub存储库的相关信息增强AI应用程序。

概述

该项目由两个主要部分组成:

  1. MCP服务器 -基于FastAPI的服务器:

- 实现模型上下文协议 - 将查询转发到本地呼叫模型 - 列出GitHub存储库中的文件

  1. Python客户端 -演示如何与MCP服务器交互的示例客户端应用程序

先决条件

  • Python 3.7或更高版本
  • 运行调用模型服务器(例如,Ollama)athttp://localhost:11434/
  • 用于访问GitHub API的Internet连接
  • Git已安装在您的计算机上
  • GitHub账号

安装

克隆存储库

git clone https://github.com/YourUsername/mcp-llama-integration.git
cd mcp-llama-integration

再进行

pip install -r requirements.txt

文件结构

mcp-llama-integration/
├── llama_mcp_server.py      # MCP server with Llama and GitHub integration
├── llama_client_app.py      # Sample client application
└── README.md                # Project documentation

设置火焰模型

  1. 如果还没有,请安装 没有
  2. 拉动火焰模型:
   ollama pull llama3.2
  1. 验证模型是否正在运行:
   curl http://localhost:11434/api/tags
   http://localhost:11434
   http://localhost:11434/api/tags

image

运行MCP服务器

  1. 启动服务器:
   python llama_mcp_server.py
  1. 服务器将在上开始运行 http://localhost:8000
  1. 您可以通过检查运行状况终结点来验证服务器是否正在运行:
   curl http://localhost:8000/health

image

image

使用客户端应用程序

  1. 在单独的终端中,启动客户端应用程序:
   python llama_client_app.py
  1. 应用程序将提示您输入
  2. 键入您的查询并接收Llama模型的回复
  3. 要列出GitHub存储库中的文件,请使用以下查询:
   List files from https://github.com/username/repository
   List files from https://github.com/EXPESRaza/mcp-llama-github-integration
  1. 键入“exit”退出应用程序

image

API文档

MCP服务器端点

POST/上下文

请求给定查询的上下文。还可以处理GitHub存储库列表。

请求正文:

{
  "query_text": "Your query here or 'List files from https://github.com/username/repo'",
  "user_id": "optional-user-id",
  "session_id": "optional-session-id",
  "additional_context": {}
}

答复:

{
  "context_elements": [
    {
      "content": "Response from Llama model or GitHub file listing",
      "source": "llama_model or github_api",
      "relevance_score": 0.9
    }
  ],
  "metadata": {
    "processing_time_ms": 150,
    "query": "Your query here"
  }
}

POST/github/列表文件

用于在GitHub存储库中列出文件的专用端点。

请求正文:

{
  "repo_url": "https://github.com/username/repository"
}

答复:

{
  "files": ["📄 README.md", "📁 src", "📄 LICENSE"],
  "repository": "repository",
  "owner": "username",
  "success": true,
  "message": null
}

GET/健康

检查MCP服务器及其连接的运行状况。

答复:

{
  "status": "healthy",
  "llama_status": "connected",
  "github_status": "connected"
}

定制

改变火焰模型

如果你想使用不同的Llama模型,请修改 model 参数在 query_llama 功能在 llama_mcp_server.py:

payload = {
    "model": "your-model-name",  # Change this to your model name
    "prompt": text,
    "stream": False
}

修改GitHub API集成

服务器当前仅列出存储库根目录中的文件。要支持子目录或其他GitHub功能,请修改 list_github_repo_files 功能在 llama_mcp_server.py.

错误处理

该应用程序包括针对Llama模型和GitHub API的强大错误处理:

  1. 如果Llama型号不可用,将返回错误消息
  2. 如果GitHub存储库URL无效,将通知用户
  3. 如果GitHub API返回错误(例如,未找到存储库、速率限制),将显示相应的错误消息

故障排除

常见问题

  1. 连接被拒绝错误

- 确保火焰模型在运行http://localhost:11434/ - 验证Ollama是否正确安装并运行

  1. GitHub API 错误

- 检查存储库URL是否正确 - GitHub API对未经验证的请求有速率限制

  1. 未找到GitHub存储库

- 验证存储库是否存在并且是公共的 - 私有存储库需要身份验证(此版本中未实现)

贡献

欢迎投稿!请随时提交拉取请求。

许可证

此项目根据MIT许可证获得许可-有关详细信息,请参阅许可证文件。

目录标签

目录标签

本地LLM上下文管理PythonAPI集成GitHub工具AI集成本地部署API服务

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

session

工具数量(toolCount,工具数)

3

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiosession部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP