Skip to main content

MCP server for accessing Chromium source code that is otherwise difficult to fetch directly

Project description

Chromium Source MCP Server

这是一个 Model Context Protocol (MCP) 服务器,专门用于获取 Chromium 源代码。由于直接访问 Chromium 源码网站(如 source.chromium.org)无法获取代码内容,此服务器提供了一个解决方案。

功能

  • get_chromium_file(file_path, branch): 通过文件路径和分支获取 Chromium 源代码文件
  • get_chromium_file_from_url(url): 通过 source.chromium.org URL 获取 Chromium 源代码文件
  • search_chromium_files(pattern, branch): 搜索匹配模式的文件(占位功能)

使用方法

启动服务器

python main.py

或直接运行:

python source_fetch.py

与 MCP 客户端集成

在您的 MCP 客户端配置中添加服务器:

{
  "mcpServers": {
    "chromium-source": {
      "command": "python",
      "args": ["-m", "source_fetch"]
    }
  }
}

运行测试

测试文件位于 test/ 目录中(包含 init.py 使其成为 Python 包):

# 运行核心功能测试
python -m test.test_core

# 或直接运行测试文件
python test/test_core.py

工具说明

get_chromium_file

  • 参数: file_path (str), branch (str, 默认 "main")
  • 示例: 获取 chrome/app/chrome_main.cc 文件
  • 返回: 文件内容或错误信息

get_chromium_file_from_url

  • 参数: url (str) - source.chromium.org URL
  • 示例: https://source.chromium.org/chromium/chromium/src/+/main:chrome/app/chrome_main.cc
  • 返回: 文件内容或错误信息

search_chromium_files

  • 参数: pattern (str), branch (str, 默认 "main")
  • 说明: 目前为占位功能,需要实现完整的搜索逻辑

技术细节

  • 使用 FastMCP 框架创建 MCP 服务器
  • 通过 https://chromium.googlesource.com/ API 获取原始文件内容
  • 支持 base64 解码(Chromium 返回的内容通常被编码)
  • URL 解析支持多种格式(如 mainrefs/heads/main 等)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chromium_mcp_server-0.1.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chromium_mcp_server-0.1.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file chromium_mcp_server-0.1.0.tar.gz.

File metadata

  • Download URL: chromium_mcp_server-0.1.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for chromium_mcp_server-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ecea5f09cdb88a8dc2479c6964d4c098b4e1c3abe1fcab7c7941dae7134b8db7
MD5 bcfd1598e9dfb248f3b8aba44abbdb42
BLAKE2b-256 c2e632155b9e978c807038837f195ced2215a185e6a744dfb66e10d7ed1f6175

See more details on using hashes here.

File details

Details for the file chromium_mcp_server-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for chromium_mcp_server-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f6ea07bfa123cf45afe6f78267accb001ab996c179ae1072596ace2418d89d10
MD5 2a3fe9ff35f7d7d327e44c58295766ba
BLAKE2b-256 dc2062ab56698dd90b6cde442793b1a32fa04c11b1f1fad80409851830245f31

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page