@apify/actors-mcp-server 0.1.0

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.
@@ -0,0 +1,57 @@
1
+ # Specify the base Docker image. You can read more about
2
+ # the available images at https://docs.apify.com/sdk/js/docs/guides/docker-images
3
+ # You can also use any other image from Docker Hub.
4
+ FROM apify/actor-node:20 AS builder
5
+
6
+ # Check preinstalled packages
7
+ RUN npm ls crawlee apify puppeteer playwright
8
+
9
+ # Copy just package.json and package-lock.json
10
+ # to speed up the build using Docker layer cache.
11
+ COPY package*.json ./
12
+
13
+ # Install all dependencies. Don't audit to speed up the installation.
14
+ RUN npm install --include=dev --audit=false
15
+
16
+ # Next, copy the source files using the user set
17
+ # in the base image.
18
+ COPY . ./
19
+
20
+ # Install all dependencies and build the project.
21
+ # Don't audit to speed up the installation.
22
+ RUN npm run build
23
+
24
+ # Create final image
25
+ FROM apify/actor-node:20
26
+
27
+ # Check preinstalled packages
28
+ RUN npm ls crawlee apify puppeteer playwright
29
+
30
+ # Copy just package.json and package-lock.json
31
+ # to speed up the build using Docker layer cache.
32
+ COPY package*.json ./
33
+
34
+ # Install NPM packages, skip optional and development dependencies to
35
+ # keep the image small. Avoid logging too much and print the dependency
36
+ # tree for debugging
37
+ RUN npm --quiet set progress=false \
38
+ && npm install --omit=dev --omit=optional \
39
+ && echo "Installed NPM packages:" \
40
+ && (npm list --omit=dev --all || true) \
41
+ && echo "Node.js version:" \
42
+ && node --version \
43
+ && echo "NPM version:" \
44
+ && npm --version \
45
+ && rm -r ~/.npm
46
+
47
+ # Copy built JS files from builder image
48
+ COPY --from=builder /usr/src/app/dist ./dist
49
+
50
+ # Next, copy the remaining files and directories with the source code.
51
+ # Since we do this after NPM install, quick build will be really fast
52
+ # for most source file changes.
53
+ COPY . ./
54
+
55
+
56
+ # Run the image.
57
+ CMD npm run start:prod --silent
@@ -0,0 +1,9 @@
1
+ {
2
+ "actorSpecification": 1,
3
+ "name": "apify-mcp-server",
4
+ "title": "Model Context Protocol Server for Apify Actors",
5
+ "description": "Implementation of a Model Context Protocol (MCP) Server for Apify Actors that enables AI applications (and AI agents) to interact with Apify Actors",
6
+ "version": "0.1",
7
+ "input": "./input_schema.json",
8
+ "dockerfile": "./Dockerfile"
9
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "title": "Apify MCP Server",
3
+ "type": "object",
4
+ "schemaVersion": 1,
5
+ "properties": {
6
+ "actors": {
7
+ "title": "Actors to be exposed for an AI application (AI agent)",
8
+ "type": "array",
9
+ "description": "List Actors to be exposed to an AI application (AI agent) for communication via the MCP protocol. \n\n Ensure the Actor definitions fit within the LLM context by limiting the number of used Actors.",
10
+ "editor": "stringList",
11
+ "prefill": [
12
+ "apify/instagram-scraper",
13
+ "apify/rag-web-browser",
14
+ "lukaskrivka/google-maps-with-contact-details"
15
+ ]
16
+ },
17
+ "debugActor": {
18
+ "title": "Debug Actor",
19
+ "type": "string",
20
+ "description": "Specify the name of the Actor that will be used for debugging in normal mode",
21
+ "editor": "textfield",
22
+ "prefill": "apify/rag-web-browser",
23
+ "sectionCaption": "Debugging settings (normal mode)"
24
+ },
25
+ "debugActorInput": {
26
+ "title": "Debug Actor input",
27
+ "type": "object",
28
+ "description": "Specify the input for the Actor that will be used for debugging in normal mode",
29
+ "editor": "json",
30
+ "prefill": {
31
+ "query": "hello world"
32
+ }
33
+ }
34
+ }
35
+ }
package/.dockerignore ADDED
@@ -0,0 +1,19 @@
1
+ # configurations
2
+ .idea
3
+
4
+ # crawlee and apify storage folders
5
+ apify_storage
6
+ crawlee_storage
7
+ storage
8
+
9
+ # installed files
10
+ node_modules
11
+
12
+ # git folder
13
+ .git
14
+
15
+ # data
16
+ data
17
+ src/storage
18
+ dist
19
+ .env
package/.editorconfig ADDED
@@ -0,0 +1,9 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 4
6
+ charset = utf-8
7
+ trim_trailing_whitespace = true
8
+ insert_final_newline = true
9
+ end_of_line = lf
package/.env.example ADDED
@@ -0,0 +1,3 @@
1
+ APIFY_TOKEN=
2
+ # ANTHROPIC_API_KEY is only required when you want to run examples/clientStdioChat.js
3
+ ANTHROPIC_API_KEY=
@@ -0,0 +1,32 @@
1
+ const { execSync } = require('child_process');
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+
5
+ const PKG_JSON_PATH = path.join(__dirname, '..', '..', 'package.json');
6
+
7
+ const pkgJson = require(PKG_JSON_PATH); // eslint-disable-line import/no-dynamic-require
8
+
9
+ const PACKAGE_NAME = pkgJson.name;
10
+ const VERSION = pkgJson.version;
11
+
12
+ const nextVersion = getNextVersion(VERSION);
13
+ console.log(`before-deploy: Setting version to ${nextVersion}`); // eslint-disable-line no-console
14
+ pkgJson.version = nextVersion;
15
+
16
+ fs.writeFileSync(PKG_JSON_PATH, `${JSON.stringify(pkgJson, null, 2)}\n`);
17
+
18
+ function getNextVersion(version) {
19
+ const versionString = execSync(`npm show ${PACKAGE_NAME} versions --json`, { encoding: 'utf8' });
20
+ const versions = JSON.parse(versionString);
21
+
22
+ if (versions.some((v) => v === VERSION)) {
23
+ console.error(`before-deploy: A release with version ${VERSION} already exists. Please increment version accordingly.`); // eslint-disable-line no-console
24
+ process.exit(1);
25
+ }
26
+
27
+ const prereleaseNumbers = versions
28
+ .filter((v) => (v.startsWith(VERSION) && v.includes('-')))
29
+ .map((v) => Number(v.match(/\.(\d+)$/)[1]));
30
+ const lastPrereleaseNumber = Math.max(-1, ...prereleaseNumbers);
31
+ return `${version}-beta.${lastPrereleaseNumber + 1}`;
32
+ }
@@ -0,0 +1,31 @@
1
+ # This workflow runs for every pull request to lint and test the proposed changes.
2
+
3
+ name: Check
4
+
5
+ on:
6
+ pull_request:
7
+
8
+ # Push to master will trigger code checks
9
+ push:
10
+ branches:
11
+ - master
12
+ - 'fix/ci' # TODO remove this branch after CI is fixed
13
+ tags-ignore:
14
+ - "**" # Ignore all tags to prevent duplicate builds when tags are pushed.
15
+
16
+ jobs:
17
+ lint:
18
+ name: Lint
19
+ runs-on: ubuntu-latest
20
+
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+ - name: Use Node.js 22
24
+ uses: actions/setup-node@v4
25
+ with:
26
+ node-version: 22
27
+ cache: 'npm'
28
+ cache-dependency-path: 'package-lock.json'
29
+ - name: Install Dependencies
30
+ run: npm ci
31
+ - run: npm run lint
@@ -0,0 +1,103 @@
1
+ name: Create a pre-release
2
+
3
+ on:
4
+ # Push to master will deploy a beta version
5
+ push:
6
+ branches:
7
+ - master
8
+ tags-ignore:
9
+ - "**" # Ignore all tags to prevent duplicate builds when tags are pushed.
10
+
11
+ concurrency:
12
+ group: release
13
+ cancel-in-progress: false
14
+
15
+ jobs:
16
+ release_metadata:
17
+ if: "!startsWith(github.event.head_commit.message, 'docs') && !startsWith(github.event.head_commit.message, 'ci') && startsWith(github.repository, 'apify/')"
18
+ name: Prepare release metadata
19
+ runs-on: ubuntu-latest
20
+ outputs:
21
+ version_number: ${{ steps.release_metadata.outputs.version_number }}
22
+ changelog: ${{ steps.release_metadata.outputs.changelog }}
23
+ steps:
24
+ - uses: apify/workflows/git-cliff-release@main
25
+ name: Prepare release metadata
26
+ id: release_metadata
27
+ with:
28
+ release_type: prerelease
29
+ existing_changelog_path: CHANGELOG.md
30
+
31
+ wait_for_checks:
32
+ name: Wait for code checks to pass
33
+ runs-on: ubuntu-latest
34
+ steps:
35
+ - uses: lewagon/wait-on-check-action@v1.3.4
36
+ with:
37
+ ref: ${{ github.ref }}
38
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
39
+ check-name: 'Lint'
40
+ wait-interval: 5
41
+
42
+ update_changelog:
43
+ needs: [ release_metadata, wait_for_checks ]
44
+ name: Update changelog
45
+ runs-on: ubuntu-latest
46
+ outputs:
47
+ changelog_commitish: ${{ steps.commit.outputs.commit_long_sha || github.sha }}
48
+
49
+ steps:
50
+ - name: Checkout repository
51
+ uses: actions/checkout@v4
52
+ with:
53
+ token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
54
+
55
+ - name: Use Node.js 22
56
+ uses: actions/setup-node@v4
57
+ with:
58
+ node-version: 22
59
+
60
+ - name: Update package version in package.json
61
+ run: npm version --no-git-tag-version --allow-same-version ${{ needs.release_metadata.outputs.version_number }}
62
+
63
+ - name: Update CHANGELOG.md
64
+ uses: DamianReeves/write-file-action@master
65
+ with:
66
+ path: CHANGELOG.md
67
+ write-mode: overwrite
68
+ contents: ${{ needs.release_metadata.outputs.changelog }}
69
+
70
+ - name: Commit changes
71
+ id: commit
72
+ uses: EndBug/add-and-commit@v9
73
+ with:
74
+ author_name: Apify Release Bot
75
+ author_email: noreply@apify.com
76
+ message: "chore(release): Update changelog and package version [skip ci]"
77
+
78
+ publish_to_npm:
79
+ name: Publish to NPM
80
+ needs: [ release_metadata, wait_for_checks ]
81
+ runs-on: ubuntu-latest
82
+ steps:
83
+ - uses: actions/checkout@v4
84
+ with:
85
+ ref: ${{ needs.update_changelog.changelog_commitish }}
86
+ - name: Use Node.js 22
87
+ uses: actions/setup-node@v4
88
+ with:
89
+ node-version: 22
90
+ - name: Install dependencies
91
+ run: |
92
+ echo "access=public" >> .npmrc
93
+ echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
94
+ npm install
95
+ - # Check version consistency and increment pre-release version number for beta only.
96
+ name: Bump pre-release version
97
+ run: node ./.github/scripts/before-beta-release.js
98
+ - name: Publish to NPM
99
+ run: npm publish --tag beta
100
+
101
+ env:
102
+ NODE_AUTH_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_NPM_TOKEN }}
103
+ NPM_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_NPM_TOKEN }}
@@ -0,0 +1,101 @@
1
+ name: Create a pre-release (CI-test)
2
+
3
+ on:
4
+ # Push to master will deploy a beta version
5
+ push:
6
+ branches:
7
+ - master
8
+ - 'fix/ci'
9
+ tags-ignore:
10
+ - "**" # Ignore all tags to prevent duplicate builds when tags are pushed.
11
+
12
+ concurrency:
13
+ group: release
14
+ cancel-in-progress: false
15
+
16
+ jobs:
17
+ release_metadata:
18
+ if: "!startsWith(github.event.head_commit.message, 'docs') && !startsWith(github.event.head_commit.message, 'ci') && startsWith(github.repository, 'apify/')"
19
+ name: Prepare release metadata
20
+ runs-on: ubuntu-latest
21
+ outputs:
22
+ version_number: ${{ steps.release_metadata.outputs.version_number }}
23
+ changelog: ${{ steps.release_metadata.outputs.changelog }}
24
+ steps:
25
+ - uses: apify/workflows/git-cliff-release@main
26
+ name: Prepare release metadata
27
+ id: release_metadata
28
+ with:
29
+ release_type: prerelease
30
+ existing_changelog_path: CHANGELOG.md
31
+
32
+ wait_for_checks:
33
+ name: Wait for code checks to pass
34
+ runs-on: ubuntu-latest
35
+ steps:
36
+ - uses: lewagon/wait-on-check-action@v1.3.4
37
+ with:
38
+ ref: ${{ github.ref }}
39
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
40
+ check-name: 'Lint'
41
+ wait-interval: 5
42
+
43
+ update_changelog:
44
+ needs: [ release_metadata, wait_for_checks ]
45
+ name: Update changelog
46
+ runs-on: ubuntu-latest
47
+ outputs:
48
+ changelog_commitish: ${{ steps.commit.outputs.commit_long_sha || github.sha }}
49
+
50
+ steps:
51
+ - name: Checkout repository
52
+ uses: actions/checkout@v4
53
+ with:
54
+ token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
55
+
56
+ - name: Use Node.js 22
57
+ uses: actions/setup-node@v4
58
+ with:
59
+ node-version: 22
60
+
61
+ - name: Update package version in package.json
62
+ run: npm version --no-git-tag-version --allow-same-version ${{ needs.release_metadata.outputs.version_number }}
63
+
64
+ - name: Update CHANGELOG.md
65
+ uses: DamianReeves/write-file-action@master
66
+ with:
67
+ path: CHANGELOG.md
68
+ write-mode: overwrite
69
+ contents: ${{ needs.release_metadata.outputs.changelog }}
70
+
71
+ - name: Commit changes
72
+ id: commit
73
+ uses: EndBug/add-and-commit@v9
74
+ with:
75
+ author_name: Apify Release Bot
76
+ author_email: noreply@apify.com
77
+ message: "chore(release): Update changelog and package version [skip ci]"
78
+
79
+ publish_to_npm:
80
+ name: Publish to NPM
81
+ needs: [ release_metadata, wait_for_checks ]
82
+ runs-on: ubuntu-latest
83
+ steps:
84
+ - uses: actions/checkout@v4
85
+ with:
86
+ ref: ${{ needs.update_changelog.changelog_commitish }}
87
+ - name: Use Node.js 22
88
+ uses: actions/setup-node@v4
89
+ with:
90
+ node-version: 22
91
+ - name: Install dependencies
92
+ run: |
93
+ echo "access=public" >> .npmrc
94
+ echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
95
+ npm install
96
+ - name: Publish to NPM
97
+ run: npm publish --access public
98
+
99
+ env:
100
+ NODE_AUTH_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_NPM_TOKEN }}
101
+ NPM_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_NPM_TOKEN }}
@@ -0,0 +1,119 @@
1
+ name: Create a release
2
+
3
+ on:
4
+ # Trigger a stable version release via GitHub's UI, with the ability to specify the type of release.
5
+ workflow_dispatch:
6
+ inputs:
7
+ release_type:
8
+ description: Release type
9
+ required: true
10
+ type: choice
11
+ default: auto
12
+ options:
13
+ - auto
14
+ - custom
15
+ - patch
16
+ - minor
17
+ - major
18
+ custom_version:
19
+ description: The custom version to bump to (only for "custom" type)
20
+ required: false
21
+ type: string
22
+ default: ""
23
+
24
+ concurrency:
25
+ group: release
26
+ cancel-in-progress: false
27
+
28
+ jobs:
29
+ release_metadata:
30
+ name: Prepare release metadata
31
+ runs-on: ubuntu-latest
32
+ outputs:
33
+ version_number: ${{ steps.release_metadata.outputs.version_number }}
34
+ tag_name: ${{ steps.release_metadata.outputs.tag_name }}
35
+ changelog: ${{ steps.release_metadata.outputs.changelog }}
36
+ release_notes: ${{ steps.release_metadata.outputs.release_notes }}
37
+ steps:
38
+ - uses: apify/workflows/git-cliff-release@main
39
+ name: Prepare release metadata
40
+ id: release_metadata
41
+ with:
42
+ release_type: ${{ inputs.release_type }}
43
+ custom_version: ${{ inputs.custom_version }}
44
+ existing_changelog_path: CHANGELOG.md
45
+
46
+ update_changelog:
47
+ needs: [ release_metadata ]
48
+ name: Update changelog
49
+ runs-on: ubuntu-latest
50
+ outputs:
51
+ changelog_commitish: ${{ steps.commit.outputs.commit_long_sha || github.sha }}
52
+
53
+ steps:
54
+ - name: Checkout repository
55
+ uses: actions/checkout@v4
56
+ with:
57
+ token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
58
+
59
+ - name: Use Node.js 22
60
+ uses: actions/setup-node@v4
61
+ with:
62
+ node-version: 22
63
+
64
+ - name: Update package version in package.json
65
+ run: npm version --no-git-tag-version --allow-same-version ${{ needs.release_metadata.outputs.version_number }}
66
+
67
+ - name: Update CHANGELOG.md
68
+ uses: DamianReeves/write-file-action@master
69
+ with:
70
+ path: CHANGELOG.md
71
+ write-mode: overwrite
72
+ contents: ${{ needs.release_metadata.outputs.changelog }}
73
+
74
+ - name: Commit changes
75
+ id: commit
76
+ uses: EndBug/add-and-commit@v9
77
+ with:
78
+ author_name: Apify Release Bot
79
+ author_email: noreply@apify.com
80
+ message: "chore(release): Update changelog and package version [skip ci]"
81
+
82
+ create_github_release:
83
+ name: Create github release
84
+ needs: [release_metadata, update_changelog]
85
+ runs-on: ubuntu-latest
86
+ env:
87
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88
+ steps:
89
+ - name: Create release
90
+ uses: softprops/action-gh-release@v2
91
+ with:
92
+ tag_name: ${{ needs.release_metadata.outputs.tag_name }}
93
+ name: ${{ needs.release_metadata.outputs.version_number }}
94
+ target_commitish: ${{ needs.update_changelog.outputs.changelog_commitish }}
95
+ body: ${{ needs.release_metadata.outputs.release_notes }}
96
+
97
+ publish_to_npm:
98
+ name: Publish to NPM
99
+ needs: [ update_changelog ]
100
+ runs-on: ubuntu-latest
101
+ steps:
102
+ - uses: actions/checkout@v4
103
+ with:
104
+ ref: ${{ needs.update_changelog.changelog_commitish }}
105
+ - name: Use Node.js 22
106
+ uses: actions/setup-node@v4
107
+ with:
108
+ node-version: 22
109
+ - name: Install dependencies
110
+ run: |
111
+ echo "access=public" >> .npmrc
112
+ echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
113
+ npm install
114
+ - name: Publish to NPM
115
+ run: npm publish --tag latest
116
+
117
+ env:
118
+ NODE_AUTH_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_NPM_TOKEN }}
119
+ NPM_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_NPM_TOKEN }}
package/CHANGELOG.md ADDED
@@ -0,0 +1,19 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ <!-- git-cliff-unreleased-start -->
6
+ ## 0.1.0 - **not yet released**
7
+
8
+ ### 🚀 Features
9
+
10
+ - MCP server implementation ([#1](https://github.com/apify/actors-mcp-server/pull/1)) ([5e2c9f0](https://github.com/apify/actors-mcp-server/commit/5e2c9f06008304257c887dc3c67eb9ddfd32d6cd)) by [@jirispilka](https://github.com/jirispilka)
11
+
12
+
13
+ <!-- git-cliff-unreleased-end -->
14
+ This changelog summarizes all changes of the Apify Model Context Protocol Server
15
+
16
+ ### 0.0.1 (2025-01-xx)
17
+
18
+ 🚀 Features
19
+ - Add functionality to call Apify Actors via Model Context Protocol