@commandable/mcp 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +10 -0
- package/README.md +34 -0
- package/dist/cli/bin.d.ts +3 -0
- package/dist/cli/bin.d.ts.map +1 -0
- package/dist/cli/bin.js +7 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/credentialManager.d.ts +19 -0
- package/dist/cli/credentialManager.d.ts.map +1 -0
- package/dist/cli/credentialManager.js +81 -0
- package/dist/cli/credentialManager.js.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +77 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/setup.d.ts +3 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli/setup.js +194 -0
- package/dist/cli/setup.js.map +1 -0
- package/dist/crypto/encryption.d.ts +3 -0
- package/dist/crypto/encryption.d.ts.map +1 -0
- package/dist/crypto/encryption.js +29 -0
- package/dist/crypto/encryption.js.map +1 -0
- package/dist/db/client.d.ts +22 -0
- package/dist/db/client.d.ts.map +1 -0
- package/dist/db/client.js +43 -0
- package/dist/db/client.js.map +1 -0
- package/dist/db/credentialStore.d.ts +13 -0
- package/dist/db/credentialStore.d.ts.map +1 -0
- package/dist/db/credentialStore.js +57 -0
- package/dist/db/credentialStore.js.map +1 -0
- package/dist/db/integrationStore.d.ts +5 -0
- package/dist/db/integrationStore.d.ts.map +1 -0
- package/dist/db/integrationStore.js +65 -0
- package/dist/db/integrationStore.js.map +1 -0
- package/dist/db/migrate.d.ts +3 -0
- package/dist/db/migrate.d.ts.map +1 -0
- package/dist/db/migrate.js +88 -0
- package/dist/db/migrate.js.map +1 -0
- package/dist/db/schema.d.ts +911 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +73 -0
- package/dist/db/schema.js.map +1 -0
- package/dist/errors/httpError.d.ts +6 -0
- package/dist/errors/httpError.d.ts.map +1 -0
- package/dist/errors/httpError.js +11 -0
- package/dist/errors/httpError.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/actionsFactory.d.ts +12 -0
- package/dist/integrations/actionsFactory.d.ts.map +1 -0
- package/dist/integrations/actionsFactory.js +68 -0
- package/dist/integrations/actionsFactory.js.map +1 -0
- package/dist/integrations/catalog.d.ts +9 -0
- package/dist/integrations/catalog.d.ts.map +1 -0
- package/dist/integrations/catalog.js +80 -0
- package/dist/integrations/catalog.js.map +1 -0
- package/dist/integrations/dataLoader.d.ts +47 -0
- package/dist/integrations/dataLoader.d.ts.map +1 -0
- package/dist/integrations/dataLoader.js +126 -0
- package/dist/integrations/dataLoader.js.map +1 -0
- package/dist/integrations/getIntegration.d.ts +11 -0
- package/dist/integrations/getIntegration.d.ts.map +1 -0
- package/dist/integrations/getIntegration.js +22 -0
- package/dist/integrations/getIntegration.js.map +1 -0
- package/dist/integrations/googleServiceAccount.d.ts +6 -0
- package/dist/integrations/googleServiceAccount.d.ts.map +1 -0
- package/dist/integrations/googleServiceAccount.js +54 -0
- package/dist/integrations/googleServiceAccount.js.map +1 -0
- package/dist/integrations/providerRegistry.d.ts +2 -0
- package/dist/integrations/providerRegistry.d.ts.map +1 -0
- package/dist/integrations/providerRegistry.js +50 -0
- package/dist/integrations/providerRegistry.js.map +1 -0
- package/dist/integrations/proxy.d.ts +16 -0
- package/dist/integrations/proxy.d.ts.map +1 -0
- package/dist/integrations/proxy.js +331 -0
- package/dist/integrations/proxy.js.map +1 -0
- package/dist/integrations/sandbox.d.ts +7 -0
- package/dist/integrations/sandbox.d.ts.map +1 -0
- package/dist/integrations/sandbox.js +210 -0
- package/dist/integrations/sandbox.js.map +1 -0
- package/dist/integrations/tools.d.ts +3 -0
- package/dist/integrations/tools.d.ts.map +1 -0
- package/dist/integrations/tools.js +70 -0
- package/dist/integrations/tools.js.map +1 -0
- package/dist/mcp/server.d.ts +15 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +50 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/toolAdapter.d.ts +17 -0
- package/dist/mcp/toolAdapter.d.ts.map +1 -0
- package/dist/mcp/toolAdapter.js +18 -0
- package/dist/mcp/toolAdapter.js.map +1 -0
- package/dist/types.d.ts +34 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/integration-data/README.md +52 -0
- package/integration-data/airtable/credentials.json +20 -0
- package/integration-data/airtable/credentials_hint.md +4 -0
- package/integration-data/airtable/handlers/create_record.js +12 -0
- package/integration-data/airtable/handlers/delete_record.js +7 -0
- package/integration-data/airtable/handlers/get_record.js +4 -0
- package/integration-data/airtable/handlers/get_table_schema.js +6 -0
- package/integration-data/airtable/handlers/list_bases.js +4 -0
- package/integration-data/airtable/handlers/list_records.js +25 -0
- package/integration-data/airtable/handlers/list_table_fields.js +6 -0
- package/integration-data/airtable/handlers/list_tables.js +4 -0
- package/integration-data/airtable/handlers/list_views.js +6 -0
- package/integration-data/airtable/handlers/search_records.js +6 -0
- package/integration-data/airtable/handlers/update_record.js +11 -0
- package/integration-data/airtable/manifest.json +83 -0
- package/integration-data/airtable/schemas/create_record.json +12 -0
- package/integration-data/airtable/schemas/delete_record.json +11 -0
- package/integration-data/airtable/schemas/empty.json +6 -0
- package/integration-data/airtable/schemas/get_record.json +11 -0
- package/integration-data/airtable/schemas/id_base.json +9 -0
- package/integration-data/airtable/schemas/id_base_table.json +10 -0
- package/integration-data/airtable/schemas/list_records.json +26 -0
- package/integration-data/airtable/schemas/search_records.json +12 -0
- package/integration-data/airtable/schemas/update_record.json +13 -0
- package/integration-data/github/credentials.json +20 -0
- package/integration-data/github/credentials_hint.md +7 -0
- package/integration-data/github/handlers/add_labels_to_issue.js +12 -0
- package/integration-data/github/handlers/close_issue.js +5 -0
- package/integration-data/github/handlers/comment_on_issue.js +5 -0
- package/integration-data/github/handlers/create_branch.js +33 -0
- package/integration-data/github/handlers/create_commit.js +91 -0
- package/integration-data/github/handlers/create_issue.js +10 -0
- package/integration-data/github/handlers/create_or_update_file.js +21 -0
- package/integration-data/github/handlers/create_pull_request.js +16 -0
- package/integration-data/github/handlers/create_repo.js +11 -0
- package/integration-data/github/handlers/delete_repo.js +6 -0
- package/integration-data/github/handlers/get_issue.js +4 -0
- package/integration-data/github/handlers/get_repo.js +4 -0
- package/integration-data/github/handlers/list_branches.js +4 -0
- package/integration-data/github/handlers/list_commits.js +12 -0
- package/integration-data/github/handlers/list_issues.js +12 -0
- package/integration-data/github/handlers/list_pull_requests.js +8 -0
- package/integration-data/github/handlers/list_repos_install.js +4 -0
- package/integration-data/github/handlers/list_repos_user.js +4 -0
- package/integration-data/github/handlers/merge_pull_request.js +14 -0
- package/integration-data/github/handlers/update_issue.js +15 -0
- package/integration-data/github/manifest.json +26 -0
- package/integration-data/github/schemas/add_labels_to_issue.json +12 -0
- package/integration-data/github/schemas/close_issue.json +10 -0
- package/integration-data/github/schemas/comment_on_issue.json +11 -0
- package/integration-data/github/schemas/create_branch.json +12 -0
- package/integration-data/github/schemas/create_commit.json +25 -0
- package/integration-data/github/schemas/create_issue.json +13 -0
- package/integration-data/github/schemas/create_or_update_file.json +15 -0
- package/integration-data/github/schemas/create_pull_request.json +15 -0
- package/integration-data/github/schemas/create_repo.json +12 -0
- package/integration-data/github/schemas/delete_repo.json +10 -0
- package/integration-data/github/schemas/empty.json +5 -0
- package/integration-data/github/schemas/get_issue.json +10 -0
- package/integration-data/github/schemas/get_repo.json +9 -0
- package/integration-data/github/schemas/list_commits.json +12 -0
- package/integration-data/github/schemas/list_issues.json +12 -0
- package/integration-data/github/schemas/list_pull_requests.json +10 -0
- package/integration-data/github/schemas/merge_pull_request.json +14 -0
- package/integration-data/github/schemas/owner_repo.json +9 -0
- package/integration-data/github/schemas/update_issue.json +15 -0
- package/integration-data/google-calendar/credentials.json +36 -0
- package/integration-data/google-calendar/credentials_hint.md +9 -0
- package/integration-data/google-calendar/handlers/create_event.js +6 -0
- package/integration-data/google-calendar/handlers/delete_acl.js +6 -0
- package/integration-data/google-calendar/handlers/delete_event.js +7 -0
- package/integration-data/google-calendar/handlers/freebusy_query.js +4 -0
- package/integration-data/google-calendar/handlers/get_acl.js +5 -0
- package/integration-data/google-calendar/handlers/get_calendar.js +4 -0
- package/integration-data/google-calendar/handlers/get_event.js +5 -0
- package/integration-data/google-calendar/handlers/insert_acl.js +6 -0
- package/integration-data/google-calendar/handlers/list_acl.js +5 -0
- package/integration-data/google-calendar/handlers/list_calendars.js +4 -0
- package/integration-data/google-calendar/handlers/list_colors.js +4 -0
- package/integration-data/google-calendar/handlers/list_events.js +21 -0
- package/integration-data/google-calendar/handlers/list_settings.js +4 -0
- package/integration-data/google-calendar/handlers/move_event.js +6 -0
- package/integration-data/google-calendar/handlers/patch_event.js +5 -0
- package/integration-data/google-calendar/handlers/quick_add.js +6 -0
- package/integration-data/google-calendar/handlers/update_acl.js +7 -0
- package/integration-data/google-calendar/handlers/update_event.js +5 -0
- package/integration-data/google-calendar/manifest.json +26 -0
- package/integration-data/google-calendar/schemas/create_event.json +34 -0
- package/integration-data/google-calendar/schemas/delete_acl.json +9 -0
- package/integration-data/google-calendar/schemas/empty.json +1 -0
- package/integration-data/google-calendar/schemas/freebusy_query.json +13 -0
- package/integration-data/google-calendar/schemas/get_acl.json +9 -0
- package/integration-data/google-calendar/schemas/id_calendar.json +8 -0
- package/integration-data/google-calendar/schemas/id_calendar_event.json +9 -0
- package/integration-data/google-calendar/schemas/insert_acl.json +18 -0
- package/integration-data/google-calendar/schemas/list_events.json +15 -0
- package/integration-data/google-calendar/schemas/move_event.json +10 -0
- package/integration-data/google-calendar/schemas/patch_event.json +10 -0
- package/integration-data/google-calendar/schemas/quick_add.json +9 -0
- package/integration-data/google-calendar/schemas/update_acl.json +10 -0
- package/integration-data/google-calendar/schemas/update_event.json +10 -0
- package/integration-data/google-docs/credentials.json +36 -0
- package/integration-data/google-docs/credentials_hint.md +9 -0
- package/integration-data/google-docs/handlers/append_text.js +12 -0
- package/integration-data/google-docs/handlers/batch_update.js +13 -0
- package/integration-data/google-docs/handlers/create_document.js +9 -0
- package/integration-data/google-docs/handlers/delete_first_match.js +50 -0
- package/integration-data/google-docs/handlers/get_document.js +12 -0
- package/integration-data/google-docs/handlers/get_document_structured.js +6 -0
- package/integration-data/google-docs/handlers/get_document_text.js +17 -0
- package/integration-data/google-docs/handlers/insert_inline_image_after_first_match.js +41 -0
- package/integration-data/google-docs/handlers/insert_page_break_after_first_match.js +49 -0
- package/integration-data/google-docs/handlers/insert_table_after_first_match.js +49 -0
- package/integration-data/google-docs/handlers/insert_text_after_first_match.js +51 -0
- package/integration-data/google-docs/handlers/replace_all_text.js +8 -0
- package/integration-data/google-docs/handlers/style_first_match.js +42 -0
- package/integration-data/google-docs/handlers/update_document_style.js +8 -0
- package/integration-data/google-docs/handlers/update_paragraph_style_for_first_match.js +48 -0
- package/integration-data/google-docs/manifest.json +58 -0
- package/integration-data/google-docs/schemas/append_text.json +10 -0
- package/integration-data/google-docs/schemas/apply_text_style.json +13 -0
- package/integration-data/google-docs/schemas/batch_update.json +16 -0
- package/integration-data/google-docs/schemas/create_document.json +8 -0
- package/integration-data/google-docs/schemas/delete_content_range.json +11 -0
- package/integration-data/google-docs/schemas/delete_first_match.json +10 -0
- package/integration-data/google-docs/schemas/get_document.json +11 -0
- package/integration-data/google-docs/schemas/get_document_structured.json +9 -0
- package/integration-data/google-docs/schemas/get_document_text.json +9 -0
- package/integration-data/google-docs/schemas/insert_inline_image.json +12 -0
- package/integration-data/google-docs/schemas/insert_inline_image_after_first_match.json +13 -0
- package/integration-data/google-docs/schemas/insert_page_break.json +10 -0
- package/integration-data/google-docs/schemas/insert_page_break_after_first_match.json +11 -0
- package/integration-data/google-docs/schemas/insert_table.json +12 -0
- package/integration-data/google-docs/schemas/insert_table_after_first_match.json +13 -0
- package/integration-data/google-docs/schemas/insert_text_after_first_match.json +12 -0
- package/integration-data/google-docs/schemas/insert_text_at.json +11 -0
- package/integration-data/google-docs/schemas/replace_all_text.json +12 -0
- package/integration-data/google-docs/schemas/style_first_match.json +12 -0
- package/integration-data/google-docs/schemas/update_document_style.json +11 -0
- package/integration-data/google-docs/schemas/update_paragraph_style.json +13 -0
- package/integration-data/google-docs/schemas/update_paragraph_style_for_first_match.json +12 -0
- package/integration-data/google-sheet/credentials.json +36 -0
- package/integration-data/google-sheet/credentials_hint.md +9 -0
- package/integration-data/google-sheet/handlers/append_values.js +18 -0
- package/integration-data/google-sheet/handlers/batch_clear_values.js +6 -0
- package/integration-data/google-sheet/handlers/batch_clear_values_by_data_filter.js +6 -0
- package/integration-data/google-sheet/handlers/batch_get_values.js +16 -0
- package/integration-data/google-sheet/handlers/batch_update.js +14 -0
- package/integration-data/google-sheet/handlers/batch_update_values.js +16 -0
- package/integration-data/google-sheet/handlers/batch_update_values_by_data_filter.js +16 -0
- package/integration-data/google-sheet/handlers/clear_values.js +6 -0
- package/integration-data/google-sheet/handlers/copy_to_spreadsheet.js +6 -0
- package/integration-data/google-sheet/handlers/create_spreadsheet.js +5 -0
- package/integration-data/google-sheet/handlers/get_developer_metadata.js +6 -0
- package/integration-data/google-sheet/handlers/get_spreadsheet.js +12 -0
- package/integration-data/google-sheet/handlers/get_spreadsheet_by_data_filter.js +10 -0
- package/integration-data/google-sheet/handlers/get_values.js +14 -0
- package/integration-data/google-sheet/handlers/get_values_by_data_filter.js +14 -0
- package/integration-data/google-sheet/handlers/search_developer_metadata.js +7 -0
- package/integration-data/google-sheet/handlers/update_values.js +16 -0
- package/integration-data/google-sheet/manifest.json +125 -0
- package/integration-data/google-sheet/schemas/append_values.json +16 -0
- package/integration-data/google-sheet/schemas/batch_clear_values.json +10 -0
- package/integration-data/google-sheet/schemas/batch_clear_values_by_data_filter.json +10 -0
- package/integration-data/google-sheet/schemas/batch_get_values.json +13 -0
- package/integration-data/google-sheet/schemas/batch_update.json +13 -0
- package/integration-data/google-sheet/schemas/batch_update_values.json +25 -0
- package/integration-data/google-sheet/schemas/batch_update_values_by_data_filter.json +25 -0
- package/integration-data/google-sheet/schemas/clear_values.json +10 -0
- package/integration-data/google-sheet/schemas/copy_to_spreadsheet.json +11 -0
- package/integration-data/google-sheet/schemas/create_spreadsheet.json +11 -0
- package/integration-data/google-sheet/schemas/get_developer_metadata.json +10 -0
- package/integration-data/google-sheet/schemas/get_spreadsheet.json +15 -0
- package/integration-data/google-sheet/schemas/get_spreadsheet_by_data_filter.json +11 -0
- package/integration-data/google-sheet/schemas/get_values.json +13 -0
- package/integration-data/google-sheet/schemas/get_values_by_data_filter.json +17 -0
- package/integration-data/google-sheet/schemas/search_developer_metadata.json +14 -0
- package/integration-data/google-sheet/schemas/update_values.json +15 -0
- package/integration-data/google-slides/credentials.json +36 -0
- package/integration-data/google-slides/credentials_hint.md +9 -0
- package/integration-data/google-slides/handlers/append_text_to_title_of_first_slide.js +17 -0
- package/integration-data/google-slides/handlers/batch_update.js +15 -0
- package/integration-data/google-slides/handlers/create_presentation.js +8 -0
- package/integration-data/google-slides/handlers/create_slide_after_first_match.js +20 -0
- package/integration-data/google-slides/handlers/get_page_thumbnail.js +12 -0
- package/integration-data/google-slides/handlers/get_presentation.js +6 -0
- package/integration-data/google-slides/handlers/insert_image_after_first_match.js +19 -0
- package/integration-data/google-slides/handlers/insert_shape_after_first_match.js +21 -0
- package/integration-data/google-slides/handlers/replace_text_first_match.js +9 -0
- package/integration-data/google-slides/handlers/set_background_color_for_slide_index.js +15 -0
- package/integration-data/google-slides/handlers/style_text_first_match.js +48 -0
- package/integration-data/google-slides/manifest.json +41 -0
- package/integration-data/google-slides/schemas/append_text_to_title_of_first_slide.json +11 -0
- package/integration-data/google-slides/schemas/batch_update.json +13 -0
- package/integration-data/google-slides/schemas/create_presentation.json +8 -0
- package/integration-data/google-slides/schemas/create_slide_after_first_match.json +11 -0
- package/integration-data/google-slides/schemas/get_page_thumbnail.json +12 -0
- package/integration-data/google-slides/schemas/get_presentation.json +9 -0
- package/integration-data/google-slides/schemas/insert_image_after_first_match.json +13 -0
- package/integration-data/google-slides/schemas/insert_shape_after_first_match.json +13 -0
- package/integration-data/google-slides/schemas/replace_text_first_match.json +12 -0
- package/integration-data/google-slides/schemas/set_background_color_for_slide_index.json +11 -0
- package/integration-data/google-slides/schemas/style_text_first_match.json +12 -0
- package/integration-data/new_integration_prompt.md +41 -0
- package/integration-data/notion/credentials.json +21 -0
- package/integration-data/notion/credentials_hint.md +5 -0
- package/integration-data/notion/handlers/append_block_children.js +7 -0
- package/integration-data/notion/handlers/create_comment.js +10 -0
- package/integration-data/notion/handlers/create_database.js +11 -0
- package/integration-data/notion/handlers/create_page.js +13 -0
- package/integration-data/notion/handlers/delete_block.js +8 -0
- package/integration-data/notion/handlers/get_me.js +4 -0
- package/integration-data/notion/handlers/list_block_children.js +10 -0
- package/integration-data/notion/handlers/list_comments.js +14 -0
- package/integration-data/notion/handlers/list_users.js +10 -0
- package/integration-data/notion/handlers/query_database.js +10 -0
- package/integration-data/notion/handlers/retrieve_block.js +4 -0
- package/integration-data/notion/handlers/retrieve_database.js +4 -0
- package/integration-data/notion/handlers/retrieve_page.js +4 -0
- package/integration-data/notion/handlers/retrieve_page_property_item.js +10 -0
- package/integration-data/notion/handlers/retrieve_user.js +4 -0
- package/integration-data/notion/handlers/search.js +11 -0
- package/integration-data/notion/handlers/update_block.js +7 -0
- package/integration-data/notion/handlers/update_database.js +10 -0
- package/integration-data/notion/handlers/update_page_properties.js +10 -0
- package/integration-data/notion/manifest.json +139 -0
- package/integration-data/notion/prompt.md +26 -0
- package/integration-data/notion/schemas/append_block_children.json +10 -0
- package/integration-data/notion/schemas/create_comment.json +18 -0
- package/integration-data/notion/schemas/create_database.json +18 -0
- package/integration-data/notion/schemas/create_page.json +22 -0
- package/integration-data/notion/schemas/delete_block.json +9 -0
- package/integration-data/notion/schemas/empty.json +6 -0
- package/integration-data/notion/schemas/id_block.json +9 -0
- package/integration-data/notion/schemas/id_database.json +9 -0
- package/integration-data/notion/schemas/id_page.json +9 -0
- package/integration-data/notion/schemas/id_user.json +9 -0
- package/integration-data/notion/schemas/list_block_children.json +11 -0
- package/integration-data/notion/schemas/list_comments.json +15 -0
- package/integration-data/notion/schemas/list_users.json +9 -0
- package/integration-data/notion/schemas/query_database.json +13 -0
- package/integration-data/notion/schemas/retrieve_page_property_item.json +12 -0
- package/integration-data/notion/schemas/search.json +27 -0
- package/integration-data/notion/schemas/update_block.json +10 -0
- package/integration-data/notion/schemas/update_database.json +13 -0
- package/integration-data/notion/schemas/update_page_properties.json +13 -0
- package/integration-data/trello/credentials.json +26 -0
- package/integration-data/trello/credentials_hint.md +4 -0
- package/integration-data/trello/handlers/add_checklist_to_card.js +5 -0
- package/integration-data/trello/handlers/add_member_to_card.js +5 -0
- package/integration-data/trello/handlers/archive_list.js +5 -0
- package/integration-data/trello/handlers/create_card.js +13 -0
- package/integration-data/trello/handlers/create_list.js +7 -0
- package/integration-data/trello/handlers/delete_card.js +9 -0
- package/integration-data/trello/handlers/get_board.js +4 -0
- package/integration-data/trello/handlers/get_board_cards.js +4 -0
- package/integration-data/trello/handlers/get_board_custom_fields.js +4 -0
- package/integration-data/trello/handlers/get_board_labels.js +4 -0
- package/integration-data/trello/handlers/get_board_lists.js +4 -0
- package/integration-data/trello/handlers/get_board_members.js +4 -0
- package/integration-data/trello/handlers/get_board_memberships.js +4 -0
- package/integration-data/trello/handlers/get_card.js +4 -0
- package/integration-data/trello/handlers/get_card_actions.js +4 -0
- package/integration-data/trello/handlers/get_card_attachments.js +4 -0
- package/integration-data/trello/handlers/get_card_checklists.js +4 -0
- package/integration-data/trello/handlers/get_card_custom_field_items.js +4 -0
- package/integration-data/trello/handlers/get_card_members.js +4 -0
- package/integration-data/trello/handlers/get_list.js +4 -0
- package/integration-data/trello/handlers/get_list_cards.js +4 -0
- package/integration-data/trello/handlers/get_member.js +4 -0
- package/integration-data/trello/handlers/get_member_boards.js +4 -0
- package/integration-data/trello/handlers/get_member_organizations.js +4 -0
- package/integration-data/trello/handlers/get_organization.js +4 -0
- package/integration-data/trello/handlers/get_organization_boards.js +4 -0
- package/integration-data/trello/handlers/move_card_to_list.js +5 -0
- package/integration-data/trello/handlers/remove_member_from_card.js +9 -0
- package/integration-data/trello/handlers/search.js +5 -0
- package/integration-data/trello/handlers/update_card.js +19 -0
- package/integration-data/trello/handlers/update_list.js +11 -0
- package/integration-data/trello/manifest.json +231 -0
- package/integration-data/trello/schemas/add_checklist_to_card.json +10 -0
- package/integration-data/trello/schemas/add_member_to_card.json +10 -0
- package/integration-data/trello/schemas/archive_list.json +9 -0
- package/integration-data/trello/schemas/create_card.json +13 -0
- package/integration-data/trello/schemas/create_list.json +11 -0
- package/integration-data/trello/schemas/delete_card.json +9 -0
- package/integration-data/trello/schemas/display_trello_cards.json +45 -0
- package/integration-data/trello/schemas/empty.json +5 -0
- package/integration-data/trello/schemas/get_member.json +5 -0
- package/integration-data/trello/schemas/id_board.json +8 -0
- package/integration-data/trello/schemas/id_card.json +8 -0
- package/integration-data/trello/schemas/id_list.json +8 -0
- package/integration-data/trello/schemas/id_org.json +8 -0
- package/integration-data/trello/schemas/move_card_to_list.json +10 -0
- package/integration-data/trello/schemas/remove_member_from_card.json +10 -0
- package/integration-data/trello/schemas/search.json +8 -0
- package/integration-data/trello/schemas/update_card.json +16 -0
- package/integration-data/trello/schemas/update_list.json +12 -0
- package/package.json +61 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { URL, URLSearchParams } from 'node:url';
|
|
2
|
+
import vm from 'node:vm';
|
|
3
|
+
import * as zodLib from 'zod';
|
|
4
|
+
function makeSyntheticFromObject(pkg, context) {
|
|
5
|
+
const exportNames = Array.from(new Set(['default', ...Object.keys(pkg)]));
|
|
6
|
+
return new vm.SyntheticModule(exportNames, function () {
|
|
7
|
+
this.setExport('default', pkg);
|
|
8
|
+
for (const key of Object.keys(pkg))
|
|
9
|
+
this.setExport(key, pkg[key]);
|
|
10
|
+
}, { context });
|
|
11
|
+
}
|
|
12
|
+
const ALLOWED_PACKAGES = {
|
|
13
|
+
zod: zodLib,
|
|
14
|
+
};
|
|
15
|
+
export async function loadWorkflowModule(source, getIntegration) {
|
|
16
|
+
const realConsole = console;
|
|
17
|
+
const isolatedConsole = {
|
|
18
|
+
log: (...args) => realConsole.log(...args),
|
|
19
|
+
info: (...args) => realConsole.info(...args),
|
|
20
|
+
warn: (...args) => realConsole.warn(...args),
|
|
21
|
+
error: (...args) => realConsole.error(...args),
|
|
22
|
+
debug: (...args) => realConsole.debug?.(...args) ?? realConsole.log(...args),
|
|
23
|
+
};
|
|
24
|
+
const safeAtob = (base64String) => {
|
|
25
|
+
if (typeof base64String !== 'string')
|
|
26
|
+
throw new TypeError('atob expects a string');
|
|
27
|
+
try {
|
|
28
|
+
const buffer = Buffer.from(base64String, 'base64');
|
|
29
|
+
return buffer.toString('binary');
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
throw new Error('Invalid base64 string');
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const safeEscape = (str) => {
|
|
36
|
+
return encodeURIComponent(str).replace(/[!'()*]/g, (c) => {
|
|
37
|
+
return `%${c.charCodeAt(0).toString(16).toUpperCase()}`;
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
const safeBtoa = (binaryString) => {
|
|
41
|
+
if (typeof binaryString !== 'string')
|
|
42
|
+
throw new TypeError('btoa expects a string');
|
|
43
|
+
try {
|
|
44
|
+
const buffer = Buffer.from(binaryString, 'binary');
|
|
45
|
+
return buffer.toString('base64');
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
throw new Error('Invalid binary string');
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const context = vm.createContext({
|
|
52
|
+
console: isolatedConsole,
|
|
53
|
+
getIntegration: getIntegration || (() => ({ fetch: undefined, post: undefined })),
|
|
54
|
+
URL,
|
|
55
|
+
URLSearchParams,
|
|
56
|
+
atob: safeAtob,
|
|
57
|
+
btoa: safeBtoa,
|
|
58
|
+
escape: safeEscape,
|
|
59
|
+
unescape,
|
|
60
|
+
decodeURIComponent,
|
|
61
|
+
encodeURIComponent,
|
|
62
|
+
fetch: undefined,
|
|
63
|
+
integrationFetch: undefined,
|
|
64
|
+
process: undefined,
|
|
65
|
+
require: undefined,
|
|
66
|
+
Buffer: undefined,
|
|
67
|
+
global: undefined,
|
|
68
|
+
globalThis: undefined,
|
|
69
|
+
setImmediate: undefined,
|
|
70
|
+
setInterval: undefined,
|
|
71
|
+
setTimeout: undefined,
|
|
72
|
+
clearImmediate: undefined,
|
|
73
|
+
clearInterval: undefined,
|
|
74
|
+
clearTimeout: undefined,
|
|
75
|
+
eval: undefined,
|
|
76
|
+
Function: undefined,
|
|
77
|
+
});
|
|
78
|
+
const userModule = new vm.SourceTextModule(source, { context });
|
|
79
|
+
const moduleCache = {};
|
|
80
|
+
await userModule.link((specifier) => {
|
|
81
|
+
const pkg = ALLOWED_PACKAGES[specifier];
|
|
82
|
+
if (!pkg)
|
|
83
|
+
throw new Error(`Import "${specifier}" is not allowed in workflow modules.`);
|
|
84
|
+
if (!moduleCache[specifier])
|
|
85
|
+
moduleCache[specifier] = makeSyntheticFromObject(pkg, context);
|
|
86
|
+
return moduleCache[specifier];
|
|
87
|
+
});
|
|
88
|
+
await userModule.evaluate({ timeout: 5000 });
|
|
89
|
+
return userModule.namespace;
|
|
90
|
+
}
|
|
91
|
+
export function createSafeHandlerFromString(handlerString, getIntegration) {
|
|
92
|
+
const realConsole = console;
|
|
93
|
+
const isolatedConsole = {
|
|
94
|
+
log: (...args) => realConsole.log(...args),
|
|
95
|
+
info: (...args) => realConsole.info(...args),
|
|
96
|
+
warn: (...args) => realConsole.warn(...args),
|
|
97
|
+
error: (...args) => realConsole.error(...args),
|
|
98
|
+
debug: (...args) => realConsole.debug?.(...args) ?? realConsole.log(...args),
|
|
99
|
+
};
|
|
100
|
+
const safeAtob = (base64String) => {
|
|
101
|
+
if (typeof base64String !== 'string')
|
|
102
|
+
throw new TypeError('atob expects a string');
|
|
103
|
+
try {
|
|
104
|
+
const buffer = Buffer.from(base64String, 'base64');
|
|
105
|
+
return buffer.toString('binary');
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
throw new Error('Invalid base64 string');
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
const safeBtoa = (binaryString) => {
|
|
112
|
+
if (typeof binaryString !== 'string')
|
|
113
|
+
throw new TypeError('btoa expects a string');
|
|
114
|
+
try {
|
|
115
|
+
const buffer = Buffer.from(binaryString, 'binary');
|
|
116
|
+
return buffer.toString('base64');
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
throw new Error('Invalid binary string');
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
const safeEscape = (str) => {
|
|
123
|
+
return encodeURIComponent(str).replace(/[!'()*]/g, (c) => {
|
|
124
|
+
return `%${c.charCodeAt(0).toString(16).toUpperCase()}`;
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
const context = vm.createContext({
|
|
128
|
+
console: isolatedConsole,
|
|
129
|
+
getIntegration,
|
|
130
|
+
module: {},
|
|
131
|
+
URL,
|
|
132
|
+
URLSearchParams,
|
|
133
|
+
atob: safeAtob,
|
|
134
|
+
btoa: safeBtoa,
|
|
135
|
+
escape: safeEscape,
|
|
136
|
+
unescape,
|
|
137
|
+
decodeURIComponent,
|
|
138
|
+
encodeURIComponent,
|
|
139
|
+
fetch: undefined,
|
|
140
|
+
integrationFetch: undefined,
|
|
141
|
+
process: undefined,
|
|
142
|
+
require: undefined,
|
|
143
|
+
Buffer: undefined,
|
|
144
|
+
global: undefined,
|
|
145
|
+
globalThis: undefined,
|
|
146
|
+
setImmediate: undefined,
|
|
147
|
+
setInterval: undefined,
|
|
148
|
+
setTimeout: undefined,
|
|
149
|
+
clearImmediate: undefined,
|
|
150
|
+
clearInterval: undefined,
|
|
151
|
+
clearTimeout: undefined,
|
|
152
|
+
eval: undefined,
|
|
153
|
+
Function: undefined,
|
|
154
|
+
});
|
|
155
|
+
const code = `module.exports = async function(input) { return (${handlerString})(input) }`;
|
|
156
|
+
const script = new vm.Script(code);
|
|
157
|
+
script.runInContext(context);
|
|
158
|
+
return withLogging(context.module.exports, isolatedConsole);
|
|
159
|
+
}
|
|
160
|
+
function withLogging(handler, vmConsole) {
|
|
161
|
+
function safeSerializeForLog(value) {
|
|
162
|
+
if (typeof value === 'string')
|
|
163
|
+
return value;
|
|
164
|
+
try {
|
|
165
|
+
if (value && typeof value === 'object' && typeof value.json === 'function' && typeof value.text === 'function') {
|
|
166
|
+
const resp = value;
|
|
167
|
+
const summary = {
|
|
168
|
+
type: 'FetchResponse',
|
|
169
|
+
ok: !!resp.ok,
|
|
170
|
+
status: resp.status,
|
|
171
|
+
statusText: resp.statusText,
|
|
172
|
+
url: resp.url,
|
|
173
|
+
bodyUsed: !!resp.bodyUsed,
|
|
174
|
+
};
|
|
175
|
+
return JSON.stringify(summary);
|
|
176
|
+
}
|
|
177
|
+
return JSON.stringify(value);
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
try {
|
|
181
|
+
return String(value);
|
|
182
|
+
}
|
|
183
|
+
catch {
|
|
184
|
+
return '[Unserializable]';
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return async function wrappedHandler(args) {
|
|
189
|
+
const logs = [];
|
|
190
|
+
const originalLog = vmConsole.log;
|
|
191
|
+
try {
|
|
192
|
+
vmConsole.log = (...args2) => {
|
|
193
|
+
const line = args2.map(a => safeSerializeForLog(a)).join(' ');
|
|
194
|
+
if (logs.join('\n').length < 10_000)
|
|
195
|
+
logs.push(line);
|
|
196
|
+
originalLog.apply(vmConsole, args2);
|
|
197
|
+
};
|
|
198
|
+
const result = await handler(args);
|
|
199
|
+
return { success: true, result, logs };
|
|
200
|
+
}
|
|
201
|
+
catch (err) {
|
|
202
|
+
logs.push(err?.stack || String(err));
|
|
203
|
+
return { success: false, result: err, logs };
|
|
204
|
+
}
|
|
205
|
+
finally {
|
|
206
|
+
vmConsole.log = originalLog;
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=sandbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox.js","sourceRoot":"","sources":["../../src/integrations/sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,KAAK,MAAM,MAAM,KAAK,CAAA;AAE7B,SAAS,uBAAuB,CAAC,GAAQ,EAAE,OAAmB;IAC5D,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IACzE,OAAO,IAAI,EAAE,CAAC,eAAe,CAAC,WAAW,EAAE;QACzC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,GAAG,CAAC,CAAA;QAC9B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;YAChC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;IACjC,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC,CAAA;AACjB,CAAC;AAED,MAAM,gBAAgB,GAAwB;IAC5C,GAAG,EAAE,MAAM;CACZ,CAAA;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,MAAc,EAAE,cAAyB;IAChF,MAAM,WAAW,GAAG,OAAO,CAAA;IAC3B,MAAM,eAAe,GAAQ;QAC3B,GAAG,EAAE,CAAC,GAAG,IAAW,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,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AAI,EAAE,CAAA;QAC9C,CAAC;gBACO,CAAC;YACP,SAAS,CAAC,GAAG,GAAG,WAAW,CAAA;QAC7B,CAAC;IACH,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/integrations/tools.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,CAuDnD;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAQ1F"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export function sanitizeJsonSchema(schema) {
|
|
2
|
+
if (!schema || typeof schema !== 'object')
|
|
3
|
+
return schema;
|
|
4
|
+
if (Array.isArray(schema))
|
|
5
|
+
return schema.map(sanitizeJsonSchema);
|
|
6
|
+
const isNullOnlySchema = (s) => {
|
|
7
|
+
if (!s || typeof s !== 'object')
|
|
8
|
+
return false;
|
|
9
|
+
if (s.type === 'null')
|
|
10
|
+
return true;
|
|
11
|
+
if (Array.isArray(s.type) && s.type.length > 0 && s.type.every((t) => t === 'null'))
|
|
12
|
+
return true;
|
|
13
|
+
return false;
|
|
14
|
+
};
|
|
15
|
+
const pickFirstNonNullVariant = (arr) => {
|
|
16
|
+
const sanitized = (arr || []).map(sanitizeJsonSchema);
|
|
17
|
+
const nonNull = sanitized.filter(s => !isNullOnlySchema(s));
|
|
18
|
+
return nonNull.length ? nonNull[0] : null;
|
|
19
|
+
};
|
|
20
|
+
if (Array.isArray(schema.oneOf)) {
|
|
21
|
+
const picked = pickFirstNonNullVariant(schema.oneOf);
|
|
22
|
+
if (picked) {
|
|
23
|
+
const { oneOf: _oneOf, ...rest } = schema;
|
|
24
|
+
return sanitizeJsonSchema({ ...rest, ...picked });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (Array.isArray(schema.anyOf)) {
|
|
28
|
+
const picked = pickFirstNonNullVariant(schema.anyOf);
|
|
29
|
+
if (picked) {
|
|
30
|
+
const { anyOf: _anyOf, ...rest } = schema;
|
|
31
|
+
return sanitizeJsonSchema({ ...rest, ...picked });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const out = {};
|
|
35
|
+
for (const [k, v] of Object.entries(schema)) {
|
|
36
|
+
if (k === '$schema' || k === '$id')
|
|
37
|
+
continue;
|
|
38
|
+
if (k === 'type' && typeof v === 'string' && v === 'integer') {
|
|
39
|
+
out[k] = 'number';
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (k === 'type' && Array.isArray(v)) {
|
|
43
|
+
const kept = v
|
|
44
|
+
.filter(t => t !== 'null')
|
|
45
|
+
.map(t => t === 'integer' ? 'number' : t)
|
|
46
|
+
.filter(Boolean);
|
|
47
|
+
if (kept.length === 1) {
|
|
48
|
+
out[k] = kept[0];
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (kept.length > 1) {
|
|
52
|
+
out[k] = kept[0];
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
out[k] = sanitizeJsonSchema(v);
|
|
58
|
+
}
|
|
59
|
+
return out;
|
|
60
|
+
}
|
|
61
|
+
export function makeIntegrationToolName(type, name, nodeId) {
|
|
62
|
+
const short = (nodeId || '').replace(/[^a-z0-9]/gi, '').slice(0, 8).toLowerCase();
|
|
63
|
+
let base = `${type}__${name}`.toLowerCase().replace(/[^a-z0-9_]/g, '_');
|
|
64
|
+
const suffix = `__n${short}`;
|
|
65
|
+
const maxBase = 64 - suffix.length;
|
|
66
|
+
if (base.length > maxBase)
|
|
67
|
+
base = base.slice(0, maxBase);
|
|
68
|
+
return `${base}${suffix}`;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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
+
import type { ExecutableTool } from '../types.js';
|
|
3
|
+
export interface StdioMcpServerParams {
|
|
4
|
+
serverInfo: Implementation;
|
|
5
|
+
tools: {
|
|
6
|
+
list: Array<{
|
|
7
|
+
name: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
inputSchema: any;
|
|
10
|
+
}>;
|
|
11
|
+
byName: Map<string, ExecutableTool>;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export declare function runStdioMcpServer(params: StdioMcpServerParams): Promise<void>;
|
|
15
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAA;AAIxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,cAAc,CAAA;IAC1B,KAAK,EAAE;QAAE,IAAI,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,WAAW,CAAC,EAAE,MAAM,CAAC;YAAC,WAAW,EAAE,GAAG,CAAA;SAAE,CAAC,CAAC;QAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;KAAE,CAAA;CACtH;AAaD,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAyCnF"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
3
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
|
+
function formatAsText(value) {
|
|
5
|
+
if (typeof value === 'string')
|
|
6
|
+
return value;
|
|
7
|
+
try {
|
|
8
|
+
return JSON.stringify(value, null, 2);
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return String(value);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export async function runStdioMcpServer(params) {
|
|
15
|
+
const server = new Server(params.serverInfo, {
|
|
16
|
+
capabilities: {
|
|
17
|
+
tools: {},
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
21
|
+
return {
|
|
22
|
+
tools: params.tools.list,
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
26
|
+
const name = req.params.name;
|
|
27
|
+
const args = (req.params.arguments ?? {});
|
|
28
|
+
const tool = params.tools.byName.get(name);
|
|
29
|
+
if (!tool)
|
|
30
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
31
|
+
const res = await tool.run(args);
|
|
32
|
+
if (!res.success) {
|
|
33
|
+
return {
|
|
34
|
+
content: [
|
|
35
|
+
{ type: 'text', text: `Tool error: ${formatAsText(res.result)}` },
|
|
36
|
+
...(res.logs?.length ? [{ type: 'text', text: `Logs:\\n${res.logs.join('\\n')}` }] : []),
|
|
37
|
+
],
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
content: [
|
|
42
|
+
{ type: 'text', text: formatAsText(res.result) },
|
|
43
|
+
...(res.logs?.length ? [{ type: 'text', text: `Logs:\\n${res.logs.join('\\n')}` }] : []),
|
|
44
|
+
],
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
const transport = new StdioServerTransport();
|
|
48
|
+
await server.connect(transport);
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,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hC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO;gBACL,OAAO,EAAE;oBACP,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE;oBACjE,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;iBACzF;aACF,CAAA;QACH,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;gBAChD,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;aACzF;SACF,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAA;IAC5C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;AACjC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { JSONSchema7 } from 'json-schema';
|
|
2
|
+
import type { ExecutableTool, IntegrationData } from '../types.js';
|
|
3
|
+
import type { IntegrationProxy } from '../integrations/proxy.js';
|
|
4
|
+
export interface McpToolDefinition {
|
|
5
|
+
name: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
inputSchema: JSONSchema7;
|
|
8
|
+
}
|
|
9
|
+
export declare function buildMcpToolIndex(params: {
|
|
10
|
+
spaceId: string;
|
|
11
|
+
integrations: IntegrationData[];
|
|
12
|
+
proxy: IntegrationProxy;
|
|
13
|
+
}): {
|
|
14
|
+
tools: McpToolDefinition[];
|
|
15
|
+
byName: Map<string, ExecutableTool>;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=toolAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolAdapter.d.ts","sourceRoot":"","sources":["../../src/mcp/toolAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAGhE,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,WAAW,CAAA;CAEzB;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACxC,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,eAAe,EAAE,CAAA;IAC/B,KAAK,EAAE,gBAAgB,CAAA;CACxB,GAAG;IAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;CAAE,CAkBtE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { buildToolsByIntegration } from '../integrations/actionsFactory.js';
|
|
2
|
+
export function buildMcpToolIndex(params) {
|
|
3
|
+
const toolsByIntegration = buildToolsByIntegration(params.spaceId, params.integrations, params.proxy);
|
|
4
|
+
const byName = new Map();
|
|
5
|
+
const tools = [];
|
|
6
|
+
for (const group of Object.values(toolsByIntegration)) {
|
|
7
|
+
for (const t of [...group.read, ...group.write, ...group.admin]) {
|
|
8
|
+
byName.set(t.name, t);
|
|
9
|
+
tools.push({
|
|
10
|
+
name: t.name,
|
|
11
|
+
description: t.description,
|
|
12
|
+
inputSchema: t.inputSchema,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return { tools, byName };
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=toolAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolAdapter.js","sourceRoot":"","sources":["../../src/mcp/toolAdapter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAA;AAS3E,MAAM,UAAU,iBAAiB,CAAC,MAIjC;IACC,MAAM,kBAAkB,GAAG,uBAAuB,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,CAAA;IAErG,MAAM,MAAM,GAAG,IAAI,GAAG,EAA0B,CAAA;IAChD,MAAM,KAAK,GAAwB,EAAE,CAAA;IAErC,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,EAAE,CAAC;QACtD,KAAK,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,KAAK,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;YAChE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;YACrB,KAAK,CAAC,IAAI,CAAC;gBACT,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,WAAW,EAAE,CAAC,CAAC,WAAW;gBAC1B,WAAW,EAAE,CAAC,CAAC,WAAW;aAC3B,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAA;AAC1B,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { JSONSchema7 } from 'json-schema';
|
|
2
|
+
export interface ToolData {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: JSONSchema7;
|
|
6
|
+
handlerCode: string;
|
|
7
|
+
displayName?: string;
|
|
8
|
+
}
|
|
9
|
+
export type IntegrationType = 'jira' | 'airtable' | 'slack' | 'github' | 'notion' | 'trello' | 'http' | 'google-calendar' | 'google-sheet' | 'google-docs' | 'google-slides' | (string & {});
|
|
10
|
+
export interface IntegrationData {
|
|
11
|
+
spaceId?: string;
|
|
12
|
+
id: string;
|
|
13
|
+
referenceId: string;
|
|
14
|
+
type: IntegrationType;
|
|
15
|
+
label: string;
|
|
16
|
+
config?: Record<string, any>;
|
|
17
|
+
connectionId?: string | null;
|
|
18
|
+
connectionMethod?: 'managed' | 'credentials';
|
|
19
|
+
credentialId?: string | null;
|
|
20
|
+
}
|
|
21
|
+
export interface ExecutableTool {
|
|
22
|
+
name: string;
|
|
23
|
+
displayName: string;
|
|
24
|
+
description: string;
|
|
25
|
+
inputSchema: JSONSchema7;
|
|
26
|
+
integrations?: IntegrationData[];
|
|
27
|
+
requireConfirmation?: boolean;
|
|
28
|
+
run: (args: any) => Promise<{
|
|
29
|
+
success: boolean;
|
|
30
|
+
result: any;
|
|
31
|
+
logs: string[];
|
|
32
|
+
}>;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,WAAW,CAAA;IACxB,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,UAAU,GACV,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,eAAe,GACf,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;AAEjB,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,eAAe,CAAA;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC5B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,gBAAgB,CAAC,EAAE,SAAS,GAAG,aAAa,CAAA;IAC5C,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC7B;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,WAAW,CAAA;IACxB,YAAY,CAAC,EAAE,eAAe,EAAE,CAAA;IAChC,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,GAAG,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,GAAG,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAA;CAC/E"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
Integration Data
|
|
2
|
+
================
|
|
3
|
+
|
|
4
|
+
Purpose
|
|
5
|
+
-------
|
|
6
|
+
|
|
7
|
+
This directory contains per-integration metadata and tool templates to inject standard read/write capabilities into tasks.
|
|
8
|
+
|
|
9
|
+
Structure
|
|
10
|
+
---------
|
|
11
|
+
|
|
12
|
+
Each integration lives under its own folder, e.g. `lib/integration-data/trello/`, with:
|
|
13
|
+
|
|
14
|
+
- `manifest.json`: declarative index of tools and files
|
|
15
|
+
- `schemas/*.json`: JSON Schemas for tool inputs
|
|
16
|
+
- `handlers/*.js`: JavaScript handlers executed in the sandbox; use `integration.fetch()`
|
|
17
|
+
- `prompt.md` (optional): extra prompt notes shown to the LLM
|
|
18
|
+
- `openapi.json` (optional): reference spec; not used at runtime
|
|
19
|
+
|
|
20
|
+
Manifest format
|
|
21
|
+
---------------
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
{
|
|
25
|
+
"name": string,
|
|
26
|
+
"version": string,
|
|
27
|
+
"baseUrl"?: string,
|
|
28
|
+
"tools": {
|
|
29
|
+
"read": [ToolRef],
|
|
30
|
+
"write": [ToolRef]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
ToolRef := {
|
|
35
|
+
"name": string,
|
|
36
|
+
"description": string,
|
|
37
|
+
"inputSchema": string, // path to JSON schema file
|
|
38
|
+
"handler": string // path to JS handler file
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Handler pattern
|
|
43
|
+
---------------
|
|
44
|
+
|
|
45
|
+
Handlers use the `integration.fetch(path, options?)` pattern rather than binding to a concrete integration id. At runtime, the host binds the task's selected integration instance as `integration` in the sandbox.
|
|
46
|
+
|
|
47
|
+
Notes
|
|
48
|
+
-----
|
|
49
|
+
|
|
50
|
+
- Keep schemas strict and aligned with handler expectations.
|
|
51
|
+
- Read tools MUST be side-effect free (GET only). Write tools include POST/PUT/DELETE.
|
|
52
|
+
- Prefer small, composable tools that mirror API resources.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": {
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"token": {
|
|
6
|
+
"type": "string",
|
|
7
|
+
"title": "Personal Access Token",
|
|
8
|
+
"description": "Airtable personal access token."
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"required": ["token"],
|
|
12
|
+
"additionalProperties": false
|
|
13
|
+
},
|
|
14
|
+
"injection": {
|
|
15
|
+
"headers": {
|
|
16
|
+
"Authorization": "Bearer {{token}}"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
async (input) => {
|
|
2
|
+
const path = `/${input.baseId}/${input.tableId}`
|
|
3
|
+
const body = {
|
|
4
|
+
records: [
|
|
5
|
+
{ fields: input.fields },
|
|
6
|
+
],
|
|
7
|
+
typecast: !!input.typecast,
|
|
8
|
+
}
|
|
9
|
+
const res = await integration.fetch(path, { method: 'POST', body })
|
|
10
|
+
const data = await res.json()
|
|
11
|
+
return data
|
|
12
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
async (input) => {
|
|
2
|
+
const path = `/${input.baseId}/${input.tableId}`
|
|
3
|
+
const params = new URLSearchParams()
|
|
4
|
+
params.set('records[]', input.recordId)
|
|
5
|
+
const res = await integration.fetch(`${path}?${params.toString()}`, { method: 'DELETE' })
|
|
6
|
+
return await res.json()
|
|
7
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
async (input) => {
|
|
2
|
+
const params = new URLSearchParams()
|
|
3
|
+
if (input.view)
|
|
4
|
+
params.set('view', input.view)
|
|
5
|
+
if (input.maxRecords)
|
|
6
|
+
params.set('maxRecords', String(input.maxRecords))
|
|
7
|
+
if (input.pageSize)
|
|
8
|
+
params.set('pageSize', String(input.pageSize))
|
|
9
|
+
if (input.filterByFormula)
|
|
10
|
+
params.set('filterByFormula', input.filterByFormula)
|
|
11
|
+
if (input.sort && Array.isArray(input.sort)) {
|
|
12
|
+
input.sort.forEach((s, i) => {
|
|
13
|
+
if (s && typeof s === 'object') {
|
|
14
|
+
if (s.field)
|
|
15
|
+
params.set(`sort[${i}][field]`, String(s.field))
|
|
16
|
+
if (s.direction)
|
|
17
|
+
params.set(`sort[${i}][direction]`, String(s.direction))
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
|
+
const qs = params.toString()
|
|
22
|
+
const path = `/${input.baseId}/${input.tableId}${qs ? `?${qs}` : ''}`
|
|
23
|
+
const res = await integration.fetch(path)
|
|
24
|
+
return await res.json()
|
|
25
|
+
}
|