apollo-connectors by apollographql/skills
npx skills add https://github.com/apollographql/skills --skill apollo-connectors如果 GraphOS MCP 工具可用,请使用它们:
按主题划分的文档路径:
/graphos/connectors/requests/url、/headers、/body、/batching/graphos/connectors/responses/fields、/error-handling/graphos/connectors/mapping、、、广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
/arrays/enums/literals/graphos/connectors/entities、/patterns遵循这个 5 步流程。请勿跳过任何步骤。
rover supergraph compose --config ./supergraph.yamlrover connector run --schema <file> -c "<Type.field>" -v "{}"/tests/ 下创建或更新测试文件rover connector test# Note to AI Friends: This is an Apollo Connectors schema. You should use your connectors-spec MCP tool if you have it available before editing this file.
extend schema
@link(url: "https://specs.apollo.dev/federation/v2.12")
@link(url: "https://specs.apollo.dev/connect/v0.3", import: ["@source", "@connect"])
@source(name: "api_name", http: { baseURL: "https://api.example.com" })
type Query {
example(id: ID!): Example
@connect(
source: "api_name"
http: { GET: "/example/{$args.id}" }
selection: """
id
name
"""
)
}
type Example {
id: ID!
name: String
}
版本要求: 除非另有说明,否则始终使用 federation/v2.12 和 connect/v0.3。
在实现连接器之前,请阅读相关的参考文件:
优先使用子选择而非 ->map 以获得更清晰的映射
直接从根选择字段时,请勿使用 $
字段别名:newName: originalField(仅在重命名时使用)
子选择:fieldName { ... }(用于映射嵌套内容)
$.results { firstName: name.first lastName: name.last }
$ { id name }
id name
@connect 使其成为实体(不需要 @key)user: { id: userId }productId)时,创建实体关系@connect 的权威子图在映射中使用 $() 包装器处理字面量值:
$(1) # 数字
$(true) # 布尔值
$("hello") # 字符串
$({"a": "b"}) # 对象
# 在 body 中
body: "$({ a: $args.a })" # 正确
body: "{ a: $args.a }" # 错误 - 将无法组合
http: {
GET: "/api"
headers: [
{ name: "Authorization", value: "Bearer {$env.API_KEY}" },
{ name: "X-Forwarded", from: "x-client" }
]
}
使用 $batch 转换 N+1 模式:
type Product @connect(
source: "api"
http: {
POST: "/batch"
body: "ids: $batch.id"
}
selection: "id name"
) {
id: ID!
name: String
}
--elv2-license accept(仅限人类使用)rover supergraph compose 进行验证$env 而非 $configrover dev 在本地运行 Apollo Router每周安装量
439
代码仓库
GitHub 星标数
36
首次出现
2026年1月23日
安全审计
安装于
claude-code388
opencode354
codex351
gemini-cli342
github-copilot341
cursor323
If GraphOS MCP Tools are available, use them:
Documentation paths by topic:
/graphos/connectors/requests/url, /headers, /body, /batching/graphos/connectors/responses/fields, /error-handling/graphos/connectors/mapping, /arrays, /enums, /literals/graphos/connectors/entities, /patternsFollow this 5-step process. DO NOT skip any steps.
rover supergraph compose --config ./supergraph.yamlrover connector run --schema <file> -c "<Type.field>" -v "{}"/tests/rover connector test# Note to AI Friends: This is an Apollo Connectors schema. You should use your connectors-spec MCP tool if you have it available before editing this file.
extend schema
@link(url: "https://specs.apollo.dev/federation/v2.12")
@link(url: "https://specs.apollo.dev/connect/v0.3", import: ["@source", "@connect"])
@source(name: "api_name", http: { baseURL: "https://api.example.com" })
type Query {
example(id: ID!): Example
@connect(
source: "api_name"
http: { GET: "/example/{$args.id}" }
selection: """
id
name
"""
)
}
type Example {
id: ID!
name: String
}
Version Requirements: Always use federation/v2.12 and connect/v0.3 unless specified otherwise.
Before implementing connectors, read the relevant reference files:
Prefer sub-selections over ->map for cleaner mappings
Do NOT use $ when selecting fields directly from root
Field aliasing: newName: originalField (only when renaming)
Sub-selection: fieldName { ... } (to map nested content)
$.results { firstName: name.first lastName: name.last }
$ { id name }
id name
@connect on a type to make it an entity (no @key needed)user: { id: userId }productId), create an entity relationship@connectUse $() wrapper for literal values in mappings:
$(1) # number
$(true) # boolean
$("hello") # string
$({"a": "b"}) # object
# In body
body: "$({ a: $args.a })" # CORRECT
body: "{ a: $args.a }" # WRONG - will not compose
http: {
GET: "/api"
headers: [
{ name: "Authorization", value: "Bearer {$env.API_KEY}" },
{ name: "X-Forwarded", from: "x-client" }
]
}
Convert N+1 patterns using $batch:
type Product @connect(
source: "api"
http: {
POST: "/batch"
body: "ids: $batch.id"
}
selection: "id name"
) {
id: ID!
name: String
}
--elv2-license accept (for humans only)rover supergraph compose after changes$env over $config for environment variablesrover dev for running Apollo Router locallyWeekly Installs
439
Repository
GitHub Stars
36
First Seen
Jan 23, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
claude-code388
opencode354
codex351
gemini-cli342
github-copilot341
cursor323
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
138,300 周安装