Skip to content

What is MCP?

MCP stands for Model Context Protocol - an open standard that lets AI agents (like Claude, Cursor, or any LLM-based app) discover and call tools at runtime without needing custom integrations for each one.


The problem MCP solves

Before MCP, connecting an AI agent to external tools meant:

  • Writing a custom integration for every tool
  • Hard-coding function signatures into prompts
  • No standard way for agents to discover what a tool can do

MCP defines a common interface so agents can ask: “What tools do you have?” and “Call this one with these inputs” - in a standardized way.


How MCP works

MCP uses JSON-RPC 2.0 - a simple request/response protocol over JSON.

An agent sends a request like:

{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list",
"params": {}
}

Your MCP server responds with a list of available tools and their input schemas. The agent then knows exactly what it can call and how.

To call a tool:

{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "get_weather",
"arguments": { "city": "London" }
}
}

MCP on Rival

On Rival, an MCP tool is just a serverless function that handles JSON-RPC requests. You write a handler in Python, JavaScript, or Lua, and the platform runs it on demand.

def cortexone_handler(event, context=None):
req = event if isinstance(event, dict) else json.loads(event)
method = req.get("method")
if method == "initialize":
return {"jsonrpc": "2.0", "id": req["id"], "result": {
"protocolVersion": "2024-11-05",
"capabilities": {"tools": {}},
"serverInfo": {"name": "my-server", "version": "1.0.0"}
}}
if method == "tools/list":
return {"jsonrpc": "2.0", "id": req["id"], "result": {"tools": [...]}}
# handle tools/call, etc.

Once deployed, any MCP-compatible agent can point to your Rival tool endpoint and start using it - no server to manage, no custom SDK needed.


Key MCP methods

MethodPurpose
initializeHandshake - must always be implemented
tools/listReturns all available tools and their schemas
tools/callExecutes a specific tool
resources/listLists data resources the server exposes
prompts/listLists prompt templates

Why use MCP on Rival?

  • Serverless - no infrastructure, scales automatically
  • Published to the marketplace - other developers and agents can discover your tools
  • Versioned - roll out new capabilities without breaking existing integrations
  • Works with any MCP client - Claude, Cursor, custom agents, anything that speaks JSON-RPC 2.0

Next steps