開発者

Welleyで作る

Welley APIを使って、クライアント、スクリプト、コミュニティ向けのツール、連携を作れます。使える操作とスキーマは、最新のSwaggerリファレンスで確認できます。

MCPModel Context Protocol

AIエージェントをつなぐ

WelleyにはMCPサーバーがあるので、Claude、Codex、CursorなどのAIエージェントからWelleyのアカウントを使えます。お使いのエージェントにサーバーを追加して、Welleyでサインインしてください。そのあとは、グループやフィードについて聞いたり、投稿や返信、イベントの計画をエージェントに頼んだりできます。エージェントはあなたとして動くので、あなたにできることだけができます。

サーバー
https://welley.social/mcp
トランスポート
Streamable HTTP
サインイン
OAuth、クライアントID welley-mcp、クライアントシークレットなし
有効期間
7日間。そのあとは、もう一度サインインします
サインアウトしているとき
エージェントは、APIの検索と公開投稿の閲覧はできます

お使いのエージェント

Claude、Codex、Cursor、Geminiなど

MCP

welley.social/mcp

  • overview
  • find
  • call
HTTPS

Welley API

投稿、グループ、イベント、メッセージ、サーバー設定

エージェントはAPI全体を読み込みません。必要な操作を検索して、その操作だけを実行します。
ツールできること
overview()APIでできることを、分野ごとに説明します。
find(query)「投稿に返信する」のような普通の言葉から、合う操作を見つけます。
call(operation_id, params, body, mode)1つの操作について、説明、確認、実行をします。実際にリクエストを送るのは mode: "execute" のときだけです。

エージェントにWelleyを追加する

Claude Code

terminal
claude mcp add --transport http --client-id welley-mcp welley https://welley.social/mcp
claude mcp login welley
  1. ブラウザが開きます。Welleyにサインインして、接続を承認してください。
  2. ブラウザーのないコンピューターでは、ログインのコマンドに --no-browser を付け、表示されたリンクを別の端末で開きます。そのあと、ブラウザーが最後に表示したアドレスを貼り付けてください。

エージェントが動くところを見る

これはClaude Codeでの実際のセッションです。Mayaは、コミュニティガーデンのグループ「Riverside Garden」のメンバーです。MayaはWelleyをつないで、見逃したことを聞き、そのあと、ある質問に代わりに答えるようエージェントに頼みます。このグループでは新しい投稿を公開前に確認しているため、Mayaの返信はモデレーターの確認を待ちます。

~/garden $ claude mcp add --transport http --client-id welley-mcp welley https://welley.social/mcp
Added HTTP MCP server welley with URL: https://welley.social/mcp to local config
 
~/garden $ claude mcp login welley --no-browser
Starting authentication for "welley"…
Visit this URL to authorize:
  https://welley.social/oauth/authorize?response_type=code&client_id=welley-mcp&code_challenge=…
 
Waiting for authorization… (^C to cancel)
Or paste the redirect URL here:
 
# Maya opens the link, signs in to Welley and clicks Allow.
 
~/garden $ claude
 
> What's new in Riverside Garden lately? Is there a question nobody has answered yet?
 
⏺ welley - find (MCP)(query: "community feed recent posts and unanswered questions")
  ⎿  {"status":"task_not_finished_yet","candidates":[{"operationId":"get_api_v1_pos…
 
⏺ Riverside Garden is likely a group. Let me try the group feed with intent to resolve the id.
 
⏺ welley - call (MCP)(operation_id: "get_api_v1_groups_groupid_feed", mode: "execute")
  ⎿  {"ok":false,"operationId":"get_api_v1_groups_groupid_feed","error":{"type":"va…
 
⏺ welley - call (MCP)(operation_id: "get_api_v1_groups_search", params: {"query": "Riverside Garden"}, mode: "execute")
  ⎿  {"ok":false,"operationId":"get_api_v1_groups_search","error":{"type":"validati…
 
⏺ welley - call (MCP)(operation_id: "get_api_v1_groups_search", params: {"substring": "Riverside Garden"}, mode: "execute")
  ⎿  {"status":200,"body":{"groups":[{"groupId":"gr_01m4y6errre80b2101wdbn7kfm","gr…
 
⏺ welley - call (MCP)(operation_id: "get_api_v1_groups_groupid_feed", params: {"groupId": "gr_01m4y6errre80b2101wdbn7kfm", "limit": 30, "includeComments": true, "includePublisher": true}, mode: "execute")
  ⎿  {"status":200,"body":[{"id":"pt_01m67821z8e0qv7eqtf4jb44n3","uri":"https://wel…
 
⏺ The group has 22 posts but the feed returned only 7, so some channels may be missing. I'll look up the group's channels.
 
⏺ welley - find (MCP)(query: "list channels of a group")
  ⎿  {"status":"task_not_finished_yet","candidates":[{"operationId":"get_api_v1_gro…
 
⏺ welley - call (MCP)(operation_id: "get_api_v1_groups_groupid_channels", params: {"groupId": "gr_01m4y6errre80b2101wdbn7kfm"}, mode: "execute")
  ⎿  {"status":200,"body":[{"id":"gc_01m4y6nfrheyeszr37r94fh9r7","username":"rivers…
 
⏺ Questions most likely live in the "Growing advice" forum channel, which isn't in the main feed. Let me fetch its posts.
 
⏺ welley - call (MCP)(operation_id: "get_api_v1_posts", mode: "describe")
  ⎿  {"operationId":"get_api_v1_posts","method":"GET","path":"/api/v1/posts","title…
 
⏺ Pulling the forum posts (all forum categories) plus the volunteering channel in parallel.
 
⏺ welley - call (MCP)(operation_id: "get_api_v1_posts", params: {"groupId": "gr_01m4y6errre80b2101wdbn7kfm", "channelAppMeta": "welley.group.forum", "limit": 30, "htmlContent": "false"}, mode: "execute")
  ⎿  {"status":200,"body":[{"id":"pt_01m4y6wn9sejw9pyb4kkpf4fet","uri":"https://wel…
 
⏺ welley - call (MCP)(operation_id: "get_api_v1_posts", params: {"ownerId": "gc_01m4y6ndqte0naxpd23nxj2zpd", "limit": 20, "htmlContent": "false"}, mode: "execute")
  ⎿  {"status":200,"body":[{"id":"pt_01m6781k5weasa5819xvhzcxwy","uri":"https://wel…
 
⏺ Riverside Garden has been quiet since Oct 30. Nobody has posted in the last six days. And yes, there's one question with no replies.
  
  Recent activity (Oct 30)
  - Water shut-off on Nov 15 (Alex Morgan, Announcements): take your hoses home or hang them in the shed before then. That's 10 days away.
  - Garlic for bed 4 is in (Maya Chen): three kinds from the seed library. It gets planted Saturday, after the compost work.
  - First harvest from bed 12 (Noah Bennett): two pounds of cherry tomatoes. It got 4 likes and 2 comments.
  - Watering shifts (Elena Ruiz, Volunteering): Elena will do Tuesdays until the water goes off and asked if anyone needs Thursday covered. One person has replied.
  
  Older posts still around (Oct 14)
  - Saturday workday plan (Garden projects): 9:00 at the main gate. Turn the compost, mulch the paths, plant the garlic. It has 2 replies.
  - Second compost bay (Sam Rivera): needs about 8 pallets, wire and two people for an afternoon. It has 1 reply.
  - Aphids on the kale in bed 7 (Maya Chen, Growing advice): asks about companion planting. It has 1 reply.
  - Spring seed exchange: March 14 in the community room.
  
  The question nobody has answered
  "When should we sow the fava beans?", posted by Sam Rivera in Growing advice on Oct 14. It has no replies, one 👍 and one view. Sam says the October sowing came through winter well, but the March sowing gave a bigger harvest, and asks if anyone has notes from earlier seasons. If anyone is going to sow this fall, now is the time, so a reply would help soon.
  
  I only read the public channels. I didn't open Staff discussion or Chess, which are private.
 
> Answer Sam for me: we sowed half in late October and half in March last year. The October ones flowered first, but the March ones gave more pods, so I'd do both again.
 
⏺ welley - find (MCP)(query: "reply to a post (create comment)")
  ⎿  {"status":"task_not_finished_yet","candidates":[{"operationId":"post_api_v1_po…
 
⏺ welley - call (MCP)(operation_id: "post_api_v1_posts_postid_comments", params: {"postId": "pt_01m4y6wgw9eve9me2bzs0dap01"}, body_json: {"text": "We sowed half in late October and half in March last year. The October ones flowered first, but the March ones gave more pods, so I'd do both again.", "privacy": "PUBLIC", "kind": "Note"}, mode: "execute")
  ⎿  {"status":202,"body":{"id":"pp_01m6pe5xzde5yttak8e857qfqs","groupId":"gr_01m4y…
 
⏺ The server accepted the reply but marked it as pending. I'll check whether it has gone live.
 
⏺ welley - find (MCP)(query: "get comments of a post", limit: 3)
  ⎿  {"status":"task_not_finished_yet","candidates":[{"operationId":"get_api_v1_pos…
 
⏺ welley - call (MCP)(operation_id: "get_api_v1_posts_postid_comments", params: {"postId": "pt_01m4y6wgw9eve9me2bzs0dap01", "htmlContent": "false"}, mode: "execute")
  ⎿  {"status":200,"body":[],"request":{"operationId":"get_api_v1_posts_postid_comm…
 
⏺ welley - call (MCP)(operation_id: "get_api_v1_posts_postid_comments", params: {"postId": "pt_01m4y6wgw9eve9me2bzs0dap01", "htmlContent": "false"}, mode: "execute")
  ⎿  {"status":200,"body":[],"request":{"operationId":"get_api_v1_posts_postid_comm…
 
⏺ I sent your reply to Sam's fava bean question, but it isn't showing in the thread yet.
  
  The reply is under your account (Maya Chen) in Growing advice:
  
  > We sowed half in late October and half in March last year. The October ones flowered first, but the March ones gave more pods, so I'd do both again.
  
  Welley accepted it and marked it pending (pending post id pp_01m6pe5xzde5yttak8e857qfqs). I checked the thread twice right after, and both times it still had no comments. It may still be processing, or the group may have to approve it first. If it doesn't appear within a few minutes, look at the post in Growing advice. I can check it again for you if you like.
 
> 

公開APIへのリクエストから始める

APIはHTTPS上で動き、ほとんどの操作はJSONを受け取り、JSONを返します。公開されている情報の読み取りは、アカウントなしでも使えることがあります。

サーバー情報を読み取る

このリクエストは、サーバーの公開メタデータを返します。サーバーのデータは変更しません。

curl --fail --silent --show-error "https://welley.social/api/v1/instance"

Swaggerで操作を調べる

クライアントを書く前に、パラメーター、リクエストのスキーマ、レスポンスのスキーマ、必要な権限を確認してください。

連携を認証する

保護された操作には、Authorizationヘッダーに有効なトークンが必要です。公式のCLIは、Bearerプレフィックスを付けてトークンを送ります。

サーバーでの自分の有効な権限を読み取る

WELLEY_TOKENには、普段シークレットを扱う方法で、自分の有効なトークンを設定してください。この例はデータを読み取るだけです。

curl --fail --silent --show-error \ -H "Authorization: Bearer $WELLEY_TOKEN" \ "https://welley.social/api/v1/rbac/permissions"
  • 連携用には、アカウント設定でパーソナルアクセストークンを作成します。
  • 名前と有効期限を付けます。APIはexpiresInDays=0も受け付け、その場合は保存された有効期限のないトークンになります。
  • トークンで使えるグローバル権限、グループ権限、グループを絞り込みます。
  • 許可リストを空にした項目は、現在のあなたのアクセス権の範囲だけで制限されます。トークンが、あなたにない権限を与えることはありません。
  • トークンのシークレットが表示されるのは一度だけです。作成結果を閉じる前に保存してください。
  • トークンを管理するには、アカウントのログインセッションが必要です。パーソナルアクセストークンでは、トークンの作成、一覧表示、コピー、取り消しはできません。

権限とスコープを確認する

認証は、誰が呼び出しているかをAPIに伝えます。その呼び出し元がどの操作を使えるかは、ロールの権限で決まります。

  • 保護されたリクエストに有効な認証がない場合、APIは401を返します。
  • 呼び出し元に必要な権限がない場合、APIは403を返します。
  • 権限名はResource.Actionの形式です。例: GroupSettings.Manage
  • スコープ付きのWebhookや権限の操作では、scopeを省略するとサーバースコープになります。グループスコープにするには、グループのTypeIdを渡します。
  • 各操作の説明を読んでください。一部のエンドポイントは、アカウントのトークンではなく、HTTP署名や別のプロトコルを使います。

APIの分野を選ぶ

リファレンスには、ソーシャル機能、連携、サーバー管理が載っています。ここにある例は、APIのごく一部です。

アカウントとプロフィール

プロフィールの読み取り、アカウントのアイデンティティの管理、アカウントのエクスポートや移行の操作ができます。

メソッドパス操作アクセス
GET/api/v1/usersユーザー名で、ローカルまたはリモートのプロフィールを読み取ります。公開、またはトークンは任意
POST/api/v1/usersサーバーの上限まで、現在のアカウントにプロフィールを追加します。トークンが必要

投稿とフィード

フィードの読み取りと投稿の作成ができます。ほかの操作では、返信、投票、リアクション、下書き、保存した投稿を扱います。

メソッドパス操作アクセス
GET/api/v1/postsゲストとして公開投稿を読み取れます。認証済みの場合は、あなた向けのフィードを読み取れます。公開、またはトークンは任意
POST/api/v1/posts内容と公開範囲を指定して、投稿を作成します。トークンが必要

グループとイベント

グループ、メンバーシップ、チャンネル、モデレーション、イベントを使って、コミュニティ向けのツールを作れます。

メソッドパス操作アクセス
POST/api/v1/groups認証済みユーザーの権限で、グループを作成します。トークンが必要
GET/api/v1/events公開イベント、または認証済みユーザーが見られるイベントを一覧にします。公開、またはトークンは任意
POST/api/v1/eventsイベントを作成します。グループのイベントには、GroupEvents.Createが必要です。トークンが必要

会話と通知

会話ルームとそのメッセージを読み取ります。通知のコレクションを読み取り、既読かどうかを更新します。

メソッドパス操作アクセス
GET/api/v1/rooms現在のユーザーのルームを一覧にします。一覧の続きを取得するには、レスポンスボディのnextCursorを使います。トークンが必要
GET/api/v1/user-notifications現在のユーザーの通知を一覧にします。トークンが必要

WebhookとAIエージェント

Webhookで外部のサービスとつなげます。AIエージェントは、エージェントAPIで設定します。

メソッドパス操作アクセス
GET/api/v1/webhooks/events対応しているWebhookのイベントタイプの一覧を取得します。トークンが必要
POST/api/v1/webhooks権限のあるサーバースコープまたはグループスコープで、Webhookを作成します。HTTP署名のシークレットが表示されるのは一度だけです。トークンが必要
GET/api/v1/ai-agents呼び出し元が見られるAIエージェントを一覧にします。トークンが必要

サーバーとグループの管理

設定、通報、モデレーション、連合の制御、クォータ、デプロイの管理にAPIを使えます。

メソッドパス操作アクセス
GET/api/v1/rbac/permissions現在のユーザーとスコープで有効な権限を読み取ります。トークンが必要
GET/api/v1/settingsアカウントに必要な権限があれば、プラットフォーム設定を読み取ります。公開、またはトークンは任意

レスポンスとメディアを扱う

ページ送りとアップロードの流れは、各操作の説明に従ってください。

  • カーソル式のフィードでは、サーバーが返すページ送りのリンクをたどってください。IDの推測でカーソルを作らないでください。
  • ルームでは、レスポンスボディに不透明なnextCursorが返されます。一覧の続きを取得するときは、同じフィルターを使い続けてください。
  • メディアをアップロードするには、アップロードエントリーを作成し、返されたURLに内容を送ります。
  • 各操作のエラーレスポンスと上限を確認してください。ドキュメントに載っている操作でも、ロール、サーバーの設定、外部プロバイダーが必要な場合があります。