使用说明
天气InfluxDB克劳德代码插件
克劳德代码插件,连接到环境气象站MCP服务器,并提供 每个天气指标类别的预格式化InfluxQL查询技能。
先决条件
- 克劳德代码CLI
- 访问
https://wagstrom2022mba.pirate-walleye.ts.net/mcp(需要OAuth 2.0凭据)
设置
1.加载插件
claude --plugin-dir . --debug
首次使用时,MCP服务器将返回 401 WWW-Authenticate 挑战和克劳德代码将
通过以下方式自动执行完整的OAuth 2.0流程 .well-known 发现--没有凭据
提前配置。
3.验证
/help
你应该看到下面列出的所有6项技能 weather-influx 命名空间。
可用技能
| 技能 | 触发器 | 描述 |
|---|---|---|
search-temperature |
/weather-influx:search-temperature |
室外/室内温度,高/低 |
search-precipitation |
/weather-influx:search-precipitation |
按时段划分的降雨总量 |
search-humidity |
/weather-influx:search-humidity |
室外/室内湿度 |
search-wind |
/weather-influx:search-wind |
风速、阵风、风向 |
search-pressure |
/weather-influx:search-pressure |
大气压力趋势 |
search-summary |
/weather-influx:search-summary |
全面天气预报 |
示例用法
/weather-influx:search-temperature last 7 days
/weather-influx:search-precipitation how much did it rain this month?
/weather-influx:search-summary what was the weather like yesterday?
InfluxDB架构
- 测量:
weather - 标签:
host=edgewater - 领域:
tempf,tempinf,humidity,humidityin,baromabsin,baromrelin,hourlyrainin,dailyrainin,eventrainin,weeklyrainin,monthlyrainin,totalrainin,windspeedmph,windgustmph,maxdailygust,winddir,solarradiation,uv,batt_co2
团队市场安装
如果此仓库发布到GitHub,队友可以通过以下方式安装:
/plugin marketplace add <your-org>/influx_weather_cowork_plugin
/plugin install weather-influx@wagstrom-weather
口袋ID配置说明
让Claude Code的OAuth流端到端地工作 口袋ID 需要三个不明显的修复。此处记录了所有复制此设置的人。
1.发球 /.well-known/oauth-authorization-server 通过Caddy
Claude Code通过以下方式发现授权服务器 /.well-known/oauth-authorization-server,
不 /.well-known/openid-configuration.Pocket ID本身并不为前者提供服务,因此
使用Caddy将其置于前端,并在该路径上提供一个静态文件。
/etc/caddy/oauth-authorization-server.json:
{
"issuer": "https://YOUR_POCKET_ID_SERVER",
"authorization_endpoint": "https://YOUR_POCKET_ID_SERVER/authorize",
"token_endpoint": "https://YOUR_POCKET_ID_SERVER/api/oidc/token",
"jwks_uri": "https://YOUR_POCKET_ID_SERVER/.well-known/jwks.json",
"response_types_supported": ["code"],
"grant_types_supported": ["authorization_code", "refresh_token"],
"code_challenge_methods_supported": ["S256"],
"token_endpoint_auth_methods_supported": ["client_secret_post", "client_secret_basic"]
}
在Caddyfile中添加一条路由,以便在以下位置静态提供此文件
/.well-known/oauth-authorization-server 在Pocket ID域上。
2.包括 scopes_supported 在MCP服务器的受保护资源元数据中
Claude Code在MCP服务器的令牌请求中没有发送作用域
/.well-known/oauth-protected-resource 回复明确列出了它们。工作回应
对于此服务器,位于 https://wagstrom2022mba.pirate-walleye.ts.net/mcp:
{
"resource": "https://wagstrom2022mba.pirate-walleye.ts.net/mcp",
"authorization_servers": ["https://YOUR_POCKET_ID_SERVER"],
"scopes_supported": ["openid", "profile", "email", "groups"],
"bearer_methods_supported": ["header"]
}
3.正确配置Pocket ID OIDC客户端
在该MCP服务器客户端应用程序的Pocket ID管理UI中:
- 公共客户端:必须选中--Claude Code插件/CoWork需要公共客户端
- PKCE:必须启用--为没有客户端机密的公共客户端提供安全性
- 回调URL:添加
http://localhost:*/callback--Claude Code打开本地浏览器 重定向以完成授权码交换
这 clientId 在 .mcp.json 来自此Pocket ID客户端注册。不 clientSecret
公共客户需要(或可能)。
备注
- 所有查询都使用InfluxQL(v1),而不是Flux。
- MCP工具名称为
query_weather--接受单个InfluxQL查询字符串。 - OAuth由Claude Code通过以下方式自动处理
401 WWW-Authenticate/.well-known发现。没有存储凭据.mcp.json--Claude Code管理令牌存储。 - 与一起跑步
--debug首次启动时,确认OAuth握手和工具发现。