Skip to content

Commit 880dccb

Browse files
authored
feat: return run information when MCP server is started in standby mode (#48)
* feat: return run information when MCP server is started in standby mode
1 parent f150d13 commit 880dccb

File tree

2 files changed

+35
-11
lines changed

2 files changed

+35
-11
lines changed

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
Implementation of an MCP server for all [Apify Actors](https://apify.com/store).
77
This server enables interaction with one or more Apify Actors that can be defined in the MCP Server configuration.
88

9-
The server can be used in several ways:
9+
The server can be used in two ways:
1010
- **🇦 [MCP Server Actor](https://apify.com/apify/actors-mcp-server)** – HTTP server accessible via Server-Sent Events (SSE).
1111
- **⾕ MCP Server Stdio** – Local server available via standard input/output (stdio).
12-
- **💬 [Tester MCP Client](https://apify.com/jiri.spilka/tester-mcp-client)** – Chat-like UI for interacting with the MCP server.
12+
13+
14+
If can also interact with the MCP server using chat-like UI with 💬 [Tester MCP Client](https://apify.com/jiri.spilka/tester-mcp-client)
1315

1416
# 🎯 What does Apify MCP server do?
1517

@@ -25,7 +27,7 @@ For example it can:
2527

2628
To interact with the Apify MCP server, you can use MCP clients such as:
2729
- [Claude Desktop](https://claude.ai/download) (only Stdio support)
28-
- [LibreChat](https://www.librechat.ai/) (stdio and SSE support (yeah without Authorization header))
30+
- [LibreChat](https://www.librechat.ai/) (stdio and SSE support (yet without Authorization header))
2931
- [Apify Tester MCP Client](https://apify.com/jiri.spilka/tester-mcp-client) (SSE support with Authorization headers)
3032
- other clients at [https://modelcontextprotocol.io/clients](https://modelcontextprotocol.io/clients)
3133
- more clients at [https://glama.ai/mcp/clients](https://glama.ai/mcp/clients)
@@ -43,8 +45,8 @@ The following image shows how the Apify MCP server interacts with the Apify plat
4345

4446
![Actors-MCP-server](https://raw.githubusercontent.com/apify/actors-mcp-server/refs/heads/master/docs/actors-mcp-server.png)
4547

46-
In the future, we plan to load Actors dynamically and provide Apify's dataset and key-value store as resources.
47-
See the [Roadmap](#-roadmap-march-2025) for more details.
48+
With the MCP Tester client you can load Actors dynamically but this is not yet supported by other MCP clients.
49+
We also plan to add more features, see [Roadmap](#-roadmap-march-2025) for more details.
4850

4951
# 🔄 What is the Model Context Protocol?
5052

@@ -129,9 +131,9 @@ https://actors-mcp-server.apify.actor?token=<APIFY_TOKEN>
129131
It is also possible to start the MCP server with a different set of Actors.
130132
To do this, create a [task](https://docs.apify.com/platform/actors/running/tasks) and specify the list of Actors you want to use.
131133

132-
Then, run task in Standby mode with the selected Actors using your Apify API token.
134+
Then, run task in Standby mode with the selected Actors.
133135
```shell
134-
https://actors-mcp-server-task.apify.actor?token=<APIFY_TOKEN>
136+
https://USERNAME--actors-mcp-server-task.apify.actor?token=<APIFY_TOKEN>
135137
```
136138

137139
You can find a list of all available Actors in the [Apify Store](https://apify.com/store).
@@ -141,9 +143,8 @@ You can find a list of all available Actors in the [Apify Store](https://apify.c
141143
Once the server is running, you can interact with Server-Sent Events (SSE) to send messages to the server and receive responses.
142144
The easiest way is to use [Tester MCP Client](https://apify.com/jiri.spilka/tester-mcp-client) on Apify.
143145

144-
Other clients do not support SSE yet, but this will likely change.
145-
Please verify if MCP clients such as [Superinference.ai](https://superinterface.ai/) or [LibreChat](https://www.librechat.ai/) support SSE with custom headers.
146-
([Claude Desktop](https://claude.ai/download) does not support SSE transport yet, see [Claude Desktop Configuration](#claude-desktop) section for more details).
146+
Most of the MCP clients do not support SSE yet (as of March 2025), but this will likely change.
147+
[Claude Desktop](https://claude.ai/download) does not support SEE yet, but you can use it with Stdio transport, see [MCP Sever at a local host](#-mcp-server-at-a-local-host) for more details.
147148

148149
In the client settings you need to provide server configuration:
149150
```json

src/main.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,29 @@ let transport: SSEServerTransport;
3333
const HELP_MESSAGE = `Connect to the server with GET request to ${HOST}/sse?token=YOUR-APIFY-TOKEN`
3434
+ ` and then send POST requests to ${HOST}/message?token=YOUR-APIFY-TOKEN`;
3535

36+
const actorRun = Actor.isAtHome() ? {
37+
id: process.env.ACTOR_RUN_ID,
38+
actId: process.env.ACTOR_ID,
39+
userId: process.env.APIFY_USER_ID,
40+
startedAt: process.env.ACTOR_STARTED_AT,
41+
finishedAt: null,
42+
status: 'RUNNING',
43+
meta: {
44+
origin: process.env.APIFY_META_ORIGIN,
45+
},
46+
options: {
47+
build: process.env.ACTOR_BUILD_NUMBER,
48+
memoryMbytes: process.env.ACTOR_MEMORY_MBYTES,
49+
},
50+
buildId: process.env.ACTOR_BUILD_ID,
51+
defaultKeyValueStoreId: process.env.ACTOR_DEFAULT_KEY_VALUE_STORE_ID,
52+
defaultDatasetId: process.env.ACTOR_DEFAULT_DATASET_ID,
53+
defaultRequestQueueId: process.env.ACTOR_DEFAULT_REQUEST_QUEUE_ID,
54+
buildNumber: process.env.ACTOR_BUILD_NUMBER,
55+
containerUrl: process.env.ACTOR_WEB_SERVER_URL,
56+
standbyUrl: process.env.ACTOR_STANDBY_URL,
57+
} : {};
58+
3659
/**
3760
* Process input parameters and update tools
3861
* If URL contains query parameter actors, add tools from actors, otherwise add tools from default actors
@@ -63,7 +86,7 @@ app.route(Routes.ROOT)
6386
try {
6487
log.info(`Received GET message at: ${Routes.ROOT}`);
6588
await processParamsAndUpdateTools(req.url);
66-
res.status(200).json({ message: `Actor is using Model Context Protocol. ${HELP_MESSAGE}` }).end();
89+
res.status(200).json({ message: `Actor is using Model Context Protocol. ${HELP_MESSAGE}`, data: actorRun }).end();
6790
} catch (error) {
6891
log.error(`Error in GET ${Routes.ROOT} ${error}`);
6992
res.status(500).json({ message: 'Internal Server Error' }).end();

0 commit comments

Comments
 (0)