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.1.tar.gz (5.4 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.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: chromium_mcp_server-0.1.1.tar.gz
  • Upload date:
  • Size: 5.4 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.1.tar.gz
Algorithm Hash digest
SHA256 b8152ba9feb06453331d50f15464556c0fa93b79c9f9198a0c2c918d431d319c
MD5 096983ba206aa1f4ddd6c64ad770896c
BLAKE2b-256 92cb84d08fa9c8171bed0de64d6406baf26727b58512b0c730d81b45c036d627

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chromium_mcp_server-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 52f928e6536396e5f818664141d3ce456ef0718d3da03a3c0e6e70bcd8c2d6fe
MD5 9f0e7d73de47878ac0b8dbc7dd737df4
BLAKE2b-256 67dac9b24aef0e5a17cf9860775384bbb8699577da251cdb16f6f513a53ddd0e

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