National Parks
Pricing
Pay per usage
National Parks
0.0 (0)
Pricing
Pay per usage
0
Total users
1
Monthly users
1
Runs succeeded
>99%
Last modified
6 days ago
MCP server template
A template for running and monetizing a Model Context Protocol server over stdio on Apify platform. This allows you to run any stdio MCP server as a standby Actor and connect via SSE transport with an MCP client.
How to use
Change the MCP_COMMAND
to spawn your stdio MCP server in src/main.ts
, and don't forget to install the required MCP server in the package.json
(using npm install ...
).
By default, this template runs a Sequential Thinking MCP Server server using the following command:
npx @modelcontextprotocol/server-sequential-thinking
Feel free to configure billing logic in .actor/pay_per_event.json
and src/billing.ts
.
Push your Actor to the Apify platform, configure standby mode, and then connect to the Actor standby URL with your MCP client (e.g., https://me--my-mcp-server.apify.actor/sse
).
Pay per event
This template uses the Pay Per Event (PPE) monetization model, which provides flexible pricing based on defined events.
To charge users, define events in JSON format and save them on the Apify platform. Here is an example schema with the tool-request
event:
[{"tool-request": {"eventTitle": "Price for completing a tool request","eventDescription": "Flat fee for completing a tool request.","eventPriceUsd": 0.05}}]
In the Actor, trigger the event with:
await Actor.charge({ eventName: 'tool-request' });
This approach allows you to programmatically charge users directly from your Actor, covering the costs of execution and related services.
To set up the PPE model for this Actor:
- Configure Pay Per Event: establish the Pay Per Event pricing schema in the Actor's Monetization settings. First, set the Pricing model to
Pay per event
and add the schema. An example schema can be found in pay_per_event.json.
Resources
- What is Anthropic's Model Context Protocol?
- How to use MCP with Apify Actors
- Apify MCP server
- Apify MCP server documentation
- Apify MCP client
- Model Context Protocol documentation
- TypeScript tutorials in Academy
- Apify SDK documentation
Getting started
For complete information see this article. To run the Actor use the following command:
$apify run
Deploy to Apify
Connect Git repository to Apify
If you've created a Git repository for the project, you can easily connect to Apify:
- Go to Actor creation page
- Click on Link Git Repository button
Push project on your local machine to Apify
You can also deploy the project on your local machine to Apify without the need for the Git repository.
-
Log in to Apify. You will need to provide your Apify API Token to complete this action.
$apify login -
Deploy your Actor. This command will deploy and build the Actor on the Apify Platform. You can find your newly created Actor under Actors -> My Actors.
$apify push
Documentation reference
To learn more about Apify and Actors, take a look at the following resources: