安卓文档MCP服务器
MCP(模型上下文协议)服务器,允许AI代理直接访问 developer.android.com -搜索文档、查找API参考资料、浏览软件包和查看发行说明。
快速开始
无需安装--直接使用运行 npx 或 bunx:
npx android-docs-mcpbunx android-docs-mcp用法
VS Code
添加到您的 .vscode/mcp.json (如果克隆仓库,请使用附带的版本):
{
"servers": {
"android-docs": {
"type": "stdio",
"command": "npx",
"args": ["-y", "android-docs-mcp"]
}
}
}克劳德桌面/光标/其他MCP客户端
添加到MCP配置中:
{
"mcpServers": {
"android-docs": {
"command": "npx",
"args": ["-y", "android-docs-mcp"]
}
}
}来源
git clone https://github.com/ankit-verma-209171/android-docs-mcp.git
cd android-docs-mcp
bun install
bun run dev工具
search_android_docs
搜索所有Android文档。
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
query | 字符串 | *(必填)* | 搜索查询 |
max_results | number | 10 | 最大结果(1–30) |
get_android_doc_page
获取任何developer.android.com页面并将其解析为Markdown。
| 参数 | 类型 | 说明 |
|---|---|---|
url | string | developer.android.com页面的完整URL |
get_api_reference
按完全限定名称查找特定类的API引用。
| 参数 | 类型 | 默认值 | 说明 | |
|---|---|---|---|---|
class_name | 字符串 | *(必填)* | FQCN(例如。, android.app.Activity) | |
language | "java" | "kotlin" | auto | AndroidX默认为kotlin,平台默认为java |
list_android_packages
从官方套餐索引中列出可用套餐。
| 参数 | 类型 | 默认值 | 说明 | |
|---|---|---|---|---|
type | "platform" | "androidx" | "androidx" | 包装套装 |
language | "java" | "kotlin" | "java" | 文档语言 |
filter | string | -- | 子字符串过滤器(例如。, "compose") |
get_release_notes
获取Jetpack库发行说明。
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
library | 字符串 | *(必填)* | 库名称(例如。, compose, lifecycle) |
version | string | -- | 筛选到特定版本 |
max_entries | number | 5 | 最大输入数(1-50) |
配置
| 环境变量 | 默认值 | 描述 |
|---|---|---|
CACHE_TTL_MS | 86400000 (24小时) | 缓存生存时间(毫秒) |
建筑
src/
├── index.ts # MCP server entrypoint
├── lib/
│ ├── cache.ts # In-memory LRU cache (500 entries, 24h TTL)
│ ├── fetcher.ts # HTTP fetch with retry + cache integration
│ ├── parser.ts # HTML → Markdown (cheerio + turndown)
│ └── url-resolver.ts # FQCN → URL mapping
└── tools/
├── search.ts # search_android_docs
├── get-doc.ts # get_android_doc_page
├── get-api-reference.ts # get_api_reference
├── list-packages.ts # list_android_packages
└── get-release-notes.ts # get_release_notes免责声明
此工具从以下位置获取内容 developer.android.com 运行时按需。文档内容归谷歌所有,并根据 知识共享署名2.5许可,代码示例根据 Apache 2.0许可证。本项目与谷歌无关,也不受谷歌认可。
许可证
Apache 2.0——请参阅 许可证 了解详情。
