关于 FirstKey
FirstKey 是运行在 Internet Computer canister 上的 MCP 服务,为 Agent 提供钱包创建、cycles 资助和静态网站部署。它还可查询余额、提供充值链接并返回只读 ICPSwap 报价。
主要功能
- 01创建 Ed25519 Agent 钱包
- 02领取一次性 cycles 赠款
- 03将静态网站部署到站点 canister
- 04分块上传大型文件
- 05查询 cycles 余额并获取充值链接
- 06获取只读 ICPSwap 报价
适用场景
- 01为 Agent 创建钱包
- 02为 Agent 领取 cycles 赠款
- 03在 ICP 上部署 Agent 的静态网站
- 04在不转移代币时查询兑换报价
MCP 相关
通过 Streamable HTTP 向 MCP 客户端提供钱包、水龙头、部署、余额、充值链接和兑换报价工具。服务无状态,端点为 https://mcp.firstkey.io/mcp。
配置
远程服务无需本地安装。选择你使用的客户端,复制配置或使用一键安装。
https://mcp.firstkey.io/mcpclaude mcp add --transport http firstkeyhq-firstkey https://mcp.firstkey.io/mcp{"mcpServers":{"firstkeyhq-firstkey":{"type":"http","url":"https://mcp.firstkey.io/mcp"}}}在 Cursor 中打开{"servers":{"firstkeyhq-firstkey":{"type":"http","url":"https://mcp.firstkey.io/mcp"}}}在 VS Code 中打开{"mcpServers":{"firstkeyhq-firstkey":{"type":"http","url":"https://mcp.firstkey.io/mcp"}}}{"mcpServers":{"firstkeyhq-firstkey":{"serverUrl":"https://mcp.firstkey.io/mcp"}}}命令在终端中运行;JSON 粘贴到对应客户端的 MCP 配置后重启。需要授权的服务会在首次连接时提示登录。
工具
8此工具无需参数。
详细介绍
FirstKey MCP 服务
一个作为 Internet Computer 上 canister 运行的 MCP(Model Context Protocol)服务。 每个兼容 MCP 的 Agent 框架都可原生使用的集成入口: LangChain/LangGraph、CrewAI、AutoGen、Vercel AI SDK、OpenAI Agents SDK、Google ADK、 Claude Desktop、Cursor 等。
端点: POST https://mcp.firstkey.io/mcp(JSON-RPC 2.0,Streamable HTTP)
返回纯 JSON,无状态(无会话 ID)。已启用 CORS(*)。
工具
| 工具 | 功能 |
|---|---|
create_wallet | 生成一个全新的 Ed25519 钱包(principal + PKCS#8 PEM 私钥)。密钥只返回一次,且永不存储。 |
claim_faucet_grant | 为 Agent principal 领取 FirstKey 水龙头提供的一次性免费 1T cycles 赠款。 |
deploy_site | 创建站点 canister、安装静态主机、上传文件,并返回可访问的 https://<canister>.icp.net URL。Agent 将成为其站点的控制器。每个 Agent 可免费部署一次。 |
deploy_upload_chunk | 将大文件分块上传到已部署的 Agent 站点。 |
check_cycles | 在 cycles 账本上读取 principal 的 cycles 余额。 |
get_fuel_link | 返回 FirstKey Fuel 的银行卡付款链接,为 Agent 补充燃料(https://firstkey.io/fuel?for=<principal>)。 |
get_swap_quote | 获取实时、只读的 ICPSwap 报价(链上 factory→pool):支付代币/金额 → 收到的金额 + 推算价格。接受符号或账本 principal;不会转移代币。 |
快速测试
URL=https://mcp.firstkey.io/mcp
# initialize
curl -s $URL -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"curl","version":"0"}}}' | head -c 600
# list tools
curl -s $URL -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' | python3 -c "import json,sys; [print(t['name']) for t in json.load(sys.stdin)['result']['tools']]"
# create a wallet
curl -s $URL -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"create_wallet","arguments":{}}}'
架构
http_request(查询):提供initialize、tools/list、ping、CORS 预检请求、/.well-known/ic-domains和落地页。tools/call会升级为http_request_update(更新上下文),因为它会进行 canister 间调用:raw_rand(钱包)、水龙头的claim_for(赠款)、 cycles 账本(余额),以及管理 canister (部署时使用create_canister_with_extra_cycles/install_code/update_settings)。- 静态站点主机 WASM(
firstkey-static-host)通过include_bytes!嵌入,并安装到每个已部署的站点 canister 中。 - 部署资金池:canister 自身的 cycles 余额。每个 Agent principal 可免费部署一次 (记录在稳定内存中);资金池无法支付部署费用时,工具会改为返回 Fuel 链接。
构建与部署
export PATH="$HOME/.local/bin:$HOME/.cargo/bin:$PATH"
cd ~/workspace/firstkey-static-host && cargo build --target wasm32-unknown-unknown --release
cd ~/workspace/firstkey-mcp && cargo build --target wasm32-unknown-unknown --release
# create (needs ~5.5T cycles on the strider identity's cycles ledger)
icp canister create -n ic --detached --cycles "5.5t" \
--controller fhvid-ondyx-ziq2v-udsry-cfgki-okcur-gcryu-2wwai-b63ku-ptgkk-yqe \
--controller o5joj-543gr-ibdnq-q6f26-sbevy-iorvz-lqo2i-ocyr7-crp2u-sggj7-cae \
--identity strider -q
# install
icp canister install <CANISTER> \
--wasm ~/workspace/firstkey-mcp/target/wasm32-unknown-unknown/release/firstkey_mcp.wasm \
-n ic --identity ops -y
# authorize on the faucet
icp canister call --network ic 3l667-lyaaa-aaaam-ajkqa-cai set_mcp_canister \
--candid ~/workspace/firstkey-faucet/faucet.did --identity ops \
'(principal "<MCP_CANISTER>")'
自定义域名(mcp.firstkey.io)
Porkbun 上需要配置以下 DNS 记录(参见 DNS.md):
CNAME mcp.firstkey.io→mcp.firstkey.io.icp1.ioTXT _canister-id.mcp.firstkey.io→<canister-id>CNAME _acme-challenge.mcp.firstkey.io→_acme-challenge.mcp.firstkey.io.icp2.io
然后验证并注册:
curl 'https://icp.net/custom-domains/v1/mcp.firstkey.io/validate'
curl -X POST 'https://icp.net/custom-domains/v1/mcp.firstkey.io'
curl 'https://icp.net/custom-domains/v1/mcp.firstkey.io' # poll until "registered"
canister 已提供 /.well-known/ic-domains。
注册表发布
- 官方 MCP 注册表(
registry.modelcontextprotocol.io):参见registry/server.json(草稿)。通过仓库 CI 使用 GitHub OIDC 发布。 - Smithery(
smithery.ai/new):待mcp.firstkey.io上线后,提交公开的 HTTPS URL。
水龙头对应实现
claim_for(agent) 位于水龙头 canister(3l667-lyaaa-aaaam-ajkqa-cai,
源码位于 ~/workspace/firstkey-faucet/)。它针对 Agent principal 执行每个 principal 仅可领取一次的规则,
并发放标准的 1T 账本赠款。只有通过 set_mcp_canister 设置的 principal(仅限控制器)才能调用它。
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。