mcpField
M
MCP Server – Affinidi Elements API

MCP Server – Affinidi Elements API

リモート
github.com/kamarthiparamesh開発ツール078 週間前に更新
リポジトリ

MCP Server – Affinidi Elements API について

MCP Server – Affinidi Elements APIは、Affinidi TDK経由でAffinidi Elements APIを利用するTypeScriptサーバーです。MCPのリソース、ツール、プロンプトを示し、プロジェクトやログイン設定の取得、イベントチケットの認証情報発行に対応します。

主な機能

  1. 01Affinidiプロジェクトの一覧取得
  2. 02プロジェクトのログイン設定一覧
  3. 03イベントチケット認証情報の発行
  4. 04MCPのリソース、ツール、プロンプトの例

活用シーン

  1. 01プロジェクトとログイン設定の確認
  2. 02検証可能なイベントチケット認証情報の発行

MCP 対応

Affinidi Elements APIの操作をMCPツールとして提供し、ノート向けのリソースとプロンプトも例示します。付属のチャットアプリは接続して自然言語入力からツールを呼び出せます。

設定

リモートサーバーはインストール不要です。クライアントを選んで設定をコピーするか、ワンクリックで導入できます。

エンドポイントhttp://localhost:3002/mcp
インストールコマンドをコピー
Claude CodeTerminal
Cursor.cursor/mcp.json
VS Code.vscode/mcp.json
Claude Desktopclaude_desktop_config.json
Windsurf~/.codeium/windsurf/mcp_config.json

コマンドはターミナルで実行し、JSON は各クライアントの MCP 設定に貼り付けて再起動します。認可が必要なサーバーは初回接続時にログインを求めます。

ツール

詳細

MCP サーバー – Affinidi Elements API

Affinidi TDK を使用して Affinidi Elements API と連携する、ストリーミング可能な HTTP の Model Context Protocol(MCP) サーバーです。

この TypeScript ベースのサーバーでは、シンプルなメモシステムの構築方法を紹介しながら、次のような MCP の基本概念を実演します。

  • リソース:URI とメタデータを使ってテキストメモを表現します
  • ツール:データの作成や一覧表示などの操作を可能にします
  • プロンプト:メモの要約など、動的な生成をサポートします

🚀 機能

🛠️ ツール
  • list_project – Affinidi で作成されたプロジェクトの一覧を取得します
  • list_login_configurations – プロジェクト内のすべてのログイン設定を取得します
  • vc_issuance_event_ticket – イベントチケットの検証可能なクレデンシャル(VC)を発行します

🧑‍💻 開発

1. 依存関係をインストールする
npm install
2. サーバーを実行する
npm run dev

💬 チャットアプリとの連携

付属のチャットアプリはこの MCP サーバーに接続し、ツールと動的に連携します。これにより、ユーザーは自然言語の入力を通じて、プロジェクトの一覧表示やクレデンシャルの発行などの操作を実行できます。

リポジトリはこちらです:https://github.com/kamarthiparamesh/affinidi-ai-chat-bot

TODO

  1. OpenAPI 仕様をツールに変換し、すべての API をツール定義に変換する

サンプル MCP クライアントでテストする

  1. 新しいターミナルで MCP サーバーを実行します
npm run dev
  1. 新しいターミナルで MCP クライアントを実行します
npm run test

出力例

affinidi-elements-mcp-server % npm run test

> [email protected] test
> npx tsx src/affinidi-test-client.ts

MCP Interactive Client
=====================
Connecting to http://localhost:3002/mcp...
Transport created with session ID: 92ba5c09-ccfc-4218-bb1a-de32ca6728b5
Connected to MCP server

Available commands:
  connect [url]              - Connect to MCP server (default: http://localhost:3000/mcp)
  disconnect                 - Disconnect from server
  terminate-session          - Terminate the current session
  reconnect                  - Reconnect to the server
  list-tools                 - List available tools
  call-tool <name> [args]    - Call a tool with optional JSON arguments
  list-project <uat>  - Call the list projects tool by passing user access token
  list-login-config <pst>  - Call the list projects tool by passing project scope token
  list-prompts               - List available prompts
  get-prompt [name] [args]   - Get a prompt with optional JSON arguments
  list-resources             - List available resources
  read-resource [id]         - Read resource
  help                       - Show this help
  quit                       - Exit the program

> list-tools
Available tools:
  - list_project: Get the list of projects created in affinidi
  - list_login_configurations: List all the Login Configurations in the default Project
  - vc_issuance_event_ticket: Issue a verifiable credential (VC) for an event ticket. Use this tool when a user requests a ticket or VC for an event (e.g., "I want a ticket VC for Tech Event in Bangalore tomorrow"). On success, it returns a VC offer URL for the user to claim the ticket.

> list-project <YOUR USER ACCESS TOKEN>
Calling tool 'list_project' with args: {
  apiKey: 'eyJh...'
}
Tool result:
  List of projects => [{"id":"0be8df01-6099-4e1e-bcb6-2dc3562d72fd","name":"Test Project","description":"","createdAt":"2024-07-16T12:07:07.805Z","updatedAt":"2024-07-16T12:07:07.805Z","ownerId":"user/349f037d-c10c-4e81-a168-1222333"}]

> list-login-config <YOUR PROJECT SCOPE TOKEN>
Calling tool 'list_login_configurations' with args: {
  apiKey: 'ey....'
}
Tool result:
  List of Login Configurations => [{"ari":"ari:identity:ap-southeast-1:801a212a-90b1-4463-bfb3-5235181d477d:login_configuration/3b1433f3-1886-4a34-9072-7130ef3c3fbb","projectId":"801a212a-90b1-4463-bfb3-5235181d477d","configurationId":"3b1433f3-1886-4a34-9072-7130ef3c3fbb","name":"Eventi","redirectUris":["http://localhost:3000/api/auth/callback/affinidi"],"auth":{"clientId":"5619f48e-bca8-4529-ace3-96ebaafc2f04","issuer":"https://801a212a-90b1-4463-bfb3-5235181d477d.apse1.login.affinidi.io"},"tokenEndpointAuthMethod":"client_secret_post","description":"description#733123","createdAt":"2024-09-17T10:17:08.755Z","modifiedAt":"2024-09-17T10:17:08.755Z","createdBy":"user/349f037d-c10c-4e81-a168-f1b273c287e3","modifiedBy":"user/349f037d-c10c-4e81-a168-f1b273c287e3","creationDate":"2024-09-17T10:17:09Z","failOnMappingConflict":true,"clientMetadata":{"name":"Eventi","logo":"https://login.affinidi.com/default-client-logo.svg","domainVerified":false,"origin":"http://localhost:3000"}}]

> isssue-event-vc <YOUR PROJECT SCOPE TOKEN> <YOUR PROJECT ID>
Calling tool 'vc_issuance_event_ticket' with args: {
  apiKey: 'eyJ0eX...',
  project_id: '801a212a-90b1-4463-bfb3-5235181d477d',
  given_name: 'paramesh',
  last_name: 'kamarthi',
  email: '[email protected]',
  event_name: 'MCP Event',
  location: 'Banglore',
  ticket_type: 'regular',
  event_date: '2025-10-01'
}
Tool result:
  **Event ticket VC offer ready to claim!**
  Click the link below and enter the transaction code to complete the process:
  🔗 [Claim your Event Ticket VC](https://vault.affinidi.com/claim?credential_offer_uri=https://801a212a-90b1-4463-bfb3-5235181d477d.apse1.issuance.affinidi.io/offers/d620285d-a993-4ae5-a969-c3861ecbd414)
  🔒 **Transaction Code:** `539848`

コメント

MCP は初めてですか?

プロトコルの概要から最初のサーバーの導入まで、よくある疑問にまとめて答えます。

AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。