Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions templates/python-mcp-server/.actor/pay_per_event.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{
"actor-start": {
"eventTitle": "MCP server startup",
"eventDescription": "Initial fee for starting the MCP Server Actor",
"eventPriceUsd": 0.1
},
"search-papers": {
"eventTitle": "arXiv paper search",
"eventDescription": "Fee for searching papers on arXiv using the search_papers tool.",
Expand Down
20 changes: 0 additions & 20 deletions templates/python-mcp-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,10 @@ Charge for standard MCP operations with flat rates:

```json
{
"actor-start": {
"eventTitle": "MCP server startup",
"eventDescription": "Initial fee for starting the Actor MCP Server",
"eventPriceUsd": 0.1
},
"tool-call": {
"eventTitle": "MCP tool call",
"eventDescription": "Fee for executing MCP tools",
"eventPriceUsd": 0.05
},
"resource-read": {
"eventTitle": "MCP resource access",
"eventDescription": "Fee for accessing full content or resources",
"eventPriceUsd": 0.0001
},
"prompt-get": {
"eventTitle": "MCP prompt processing",
"eventDescription": "Fee for processing AI prompts",
"eventPriceUsd": 0.0001
}
}
```
Expand All @@ -94,11 +79,6 @@ Charge different amounts for different tools based on computational cost:

```json
{
"actor-start": {
"eventTitle": "arXiv MCP server startup",
"eventDescription": "Initial fee for starting the arXiv MCP Server Actor",
"eventPriceUsd": 0.1
},
"search_papers": {
"eventTitle": "arXiv paper search",
"eventDescription": "Fee for searching papers on arXiv",
Expand Down
2 changes: 1 addition & 1 deletion templates/python-mcp-server/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

apify < 3.0.0
apify-client
arxiv-mcp-server==0.2.11
arxiv-mcp-server==0.3.1
fastapi==0.117.1
httpx>=0.24.0
mcp==1.13.1
Expand Down
4 changes: 0 additions & 4 deletions templates/python-mcp-server/src/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ class ChargeEvents(str, Enum):
"""

# Generic MCP operations (can be used for any MCP server)
ACTOR_START = 'actor-start'
RESOURCE_READ = 'resource-read'
TOOL_LIST = 'tool-list'
PROMPT_GET = 'prompt-get'
TOOL_CALL = 'tool-call'

# arXiv-specific operations (example for domain-specific charging)
Expand Down
4 changes: 1 addition & 3 deletions templates/python-mcp-server/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from apify import Actor

from .const import TOOL_WHITELIST, ChargeEvents
from .const import TOOL_WHITELIST
from .models import ServerType
from .server import ProxyServer

Expand Down Expand Up @@ -72,8 +72,6 @@ async def main() -> None:
async with Actor:
# Initialize and charge for Actor startup
Actor.log.info('Starting MCP Server Actor')
await Actor.charge(ChargeEvents.ACTOR_START.value)

url = os.environ.get('ACTOR_STANDBY_URL', HOST)
if not STANDBY_MODE:
msg = (
Expand Down
5 changes: 0 additions & 5 deletions templates/python-mcp-server/src/mcp_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ async def _list_prompts(_: Any) -> types.ServerResult:
app.request_handlers[types.ListPromptsRequest] = _list_prompts

async def _get_prompt(req: types.GetPromptRequest) -> types.ServerResult:
# Uncomment the line below to charge for getting prompts
# await charge_mcp_operation(actor_charge_function, ChargeEvents.PROMPT_GET) # noqa: ERA001
result = await client_session.get_prompt(req.params.name, req.params.arguments)
return types.ServerResult(result)

Expand All @@ -106,8 +104,6 @@ async def _list_resource_templates(_: Any) -> types.ServerResult:
app.request_handlers[types.ListResourceTemplatesRequest] = _list_resource_templates

async def _read_resource(req: types.ReadResourceRequest) -> types.ServerResult:
# Uncomment the line below to charge for reading resources
# await charge_mcp_operation(actor_charge_function, ChargeEvents.RESOURCE_READ) # noqa: ERA001
result = await client_session.read_resource(req.params.uri)
return types.ServerResult(result)

Expand Down Expand Up @@ -151,7 +147,6 @@ async def _list_tools(_: Any) -> types.ServerResult:
authorized_tools.append(tool) # noqa: PERF401
tools.tools = authorized_tools

await charge_mcp_operation(actor_charge_function, ChargeEvents.TOOL_LIST.value)
return types.ServerResult(tools)

app.request_handlers[types.ListToolsRequest] = _list_tools
Expand Down
Loading