1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Logic Apps で MCP Server 経由で SharePoint Listの更新

1
Last updated at Posted at 2026-04-16

Logic Apps で MCP Server 経由で SharePoint Listの更新をしてみました。
基本的なAzure Logic Apps での MCP Serverの作り方は以下を参照。

前提

  • Logic Appsのリソース作成済
  • SharePoint接続のためのユーザあり
  • Foundryリソースがあり、Agent定義済(MCP ClientであればFoundry以外でもOK)

Steps

1. ワークフロー定義

まず、ワークフロー定義をします。以下の記事のようにMCP Server作成と同時にやろうとすると内部エラーが起きたので、独立して作ります(ここで詰まった)。

メニュー ワークフロー -> ワークフロー で「+Create」
image.png

Stateful で作成。
image.png

1.1. Trigger

HTTP Request Triggerを作る。
以下のサンプルからJSON Schemaを定義(直接定義してもOK)。

sample payload
{
  "title": "Issue Title",
  "content": "Issue Content"  
}

あとで、JSON Schema微調整。本当はproperties の各項目に descriptions を入れるべきだけど省略。

Request Body JSON Schema
{
    "type": "object",
    "required": [
        "subject",
        "content"
    ],
    "properties": {
        "subject": {
            "type": "string"
        },
        "content": {
            "type": "string"
        }
    }
}

上の方にTriggerの説明も記載。これが、Tool実行時のDescriptionになるらしい。
image.png

1.2. SharePoint Item作成

SharePointの「項目の作成」を選択し値を設定していく。
取り急ぎ、Title と Issue descriptionを入れて、Statu Valueを固定値「New」にしておく。
image.png

1.3. Response

登録した内容を出すためにBodyにLink to itemを設定。
もっと本番稼働に近くするにはJSONで登録項目出しておくべきですが、今は省略。
image.png

Code View全体。

code view
{
    "definition": {
        "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
        "contentVersion": "1.0.0.0",
        "actions": {
            "項目の作成": {
                "type": "ApiConnection",
                "inputs": {
                    "host": {
                        "connection": {
                            "referenceName": "sharepointonline"
                        }
                    },
                    "method": "post",
                    "body": {
                        "Title": "@triggerBody()?['subject']",
                        "Description": "<p class=\"editor-paragraph\">@{triggerBody()?['content']}</p>",
                        "Status": {
                            "Value": "New"
                        }
                    },
                    "path": "/datasets/@{encodeURIComponent(encodeURIComponent('https://<host>.sharepoint.com/sites/list-test'))}/tables/@{encodeURIComponent(encodeURIComponent('b00e1d16-0cf5-45a2-aa73-bf0b5eadb70c'))}/items"
                },
                "runAfter": {}
            },
            "Response": {
                "type": "Response",
                "kind": "Http",
                "inputs": {
                    "statusCode": 200,
                    "body": "@body('項目の作成')?['{Link}']"
                },
                "runAfter": {
                    "項目の作成": [
                        "SUCCEEDED"
                    ]
                }
            }
        },
        "outputs": {},
        "triggers": {
            "When_an_HTTP_request_is_received": {
                "type": "Request",
                "description": "この操作では、Issue Registration をします。",
                "kind": "Http",
                "inputs": {
                    "schema": {
                        "type": "object",
                        "required": [
                            "subject",
                            "content"
                        ],
                        "properties": {
                            "subject": {
                                "type": "string"
                            },
                            "content": {
                                "type": "string"
                            }
                        }
                    }
                }
            }
        }
    },
    "kind": "stateful"
}

2. 単体テスト

Logic Apps単体でテスト。
以下のPayloadを入れて実行。

payload
{
  "subject": "Issue Title2",
  "content": "Issue Content2"  
}

応答にリンクテキストも返ってきています。
image.png

3. MCP Server 作成

メニュー Agents -> MCP servers から 「Use existing workflows」を選択。
image.png

名前などを入れて作成。この辺の詳細は、「Azure Logic Apps で MCP Server を作ってみた」記事参照
image.png

4. Foundry から呼出。

Foundry AgentからカスタムMCPをTool定義して呼出。リンクも返してくれています。
image.png

リンククリックするとSharePoint Listの登録したItem画面に行けました!
image.png

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?