About Github公开仓库阅读器 Mcp Server
Github公开仓库阅读器 Mcp Server is a Java MCP server for reading files in public GitHub repositories from a repository URL. It exposes the repository contents through a single reading tool.
Key features
- 01Read public GitHub repositories by URL
- 02Return repository file contents
- 03Single `GitHubRepoReadTool`
Use cases
- 01Inspecting files across a public repository
- 02Providing repository contents to an MCP client
MCP support
It exposes `GitHubRepoReadTool` to MCP clients, accepting a GitHub repository URL and returning the contents of its files. The project uses the MCP Java SDK.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEGithub公开仓库阅读器 MCP Server
简介
该项目依赖MCP Java SDK开发,支持通过github仓库链接来读取仓库内所有文件内容。(前提是public仓库)
工具列表
仓库阅读 GitHubRepoReadTool
获取开源仓库中的文件信息
输入:github仓库的url链接
输出:仓库中所有文件的内容
快速开始
环境
需要Java 17运行环境
安装
git clone https://github.com/IAmYuanyu/GitHubRepoReader-mcp-server.git
构建
cd GitHubRepoReader-mcp-server
mvn clean package
使用
json配置文件:
{
"mcpServers": {
"GitHubRepoReader": {
"command": "java",
"args": [
"-Dspring.ai.mcp.server.stdio=true",
"-Dspring.main.web-application-type=none",
"-Dlogging.pattern.console=",
"-jar",
"/文件所在目录/GitHubRepoReader-0.0.1-SNAPSHOT.jar"
],
"env": {
"githubToken": "你的Github个人访问令牌"
}
}
}
}
如果没有Github个人访问令牌,可以看我的博客教程获取一个
代码调用
简单演示如何在Spring AI框架中使用
1)引入MCP Client依赖
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-starter-mcp-client</artifactId>
<version>1.1.2</version>
</dependency>
2)编写配置文件
spring:
ai:
mcp:
client:
stdio:
servers-configuration: classpath:mcp-servers.json # 写你的mcp服务的json配置文件的位置
request-timeout: 60s # 读大型仓库可能会有亿点点慢,所以超时时间可以设置长一些
3)使用mcp服务
@Bean
public ChatClient initChatClient(ChatClient.Builder chatClientBuilder,
ToolCallbackProvider mcpTools) {
return chatClientBuilder
.defaultToolCallbacks(mcpTools) // 注入mcp服务
.build();
}
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.