Skip to Content

Overview

MCP (Model Context Protocol) tools connect your agent to an MCP server — a standardised interface for exposing tools to LLMs. An MCP server can expose many tools; each mcp tool definition in Oshara maps to one specific tool on one specific server.

Setup: define an MCP server

Before defining mcp tools, register the server in your character configuration under mcp_servers:

{ "mcp_servers": [ { "name": "my-mcp", "url": "https://mcp.yoursite.com/call", "transport": "streamable_http", "headers": { "Authorization": "Bearer mcp-service-token" }, "timeout_seconds": 12 } ] }

MCP server fields

FieldTypeDefaultDescription
namestringRequired. Identifier used to reference this server in tool configs.
urlstringRequired. Endpoint URL of the MCP server.
transport"streamable_http" | "sse" | "http_json""streamable_http"Wire protocol. See comparison below.
headersobject{}Static headers sent with every call (auth tokens, tenant IDs).
timeout_secondsnumber12Per-call timeout (2–30 s).
is_activebooleantrueSet false to disable without deleting.

Transport comparison

TransportDescriptionWhen to use
streamable_httpHTTP POST with streaming JSON response (MCP spec default)Most MCP servers
sseServer-Sent Events streamServers that push incremental results
http_jsonPlain HTTP POST returning a single JSON responseSimple servers without streaming

Define an MCP tool

{ "name": "search_web", "kind": "mcp", "description": "Search the web for current information. Use when the user asks about recent events or topics not in the knowledge base.", "input_schema": { "type": "object", "properties": { "query": { "type": "string", "description": "Search query" } }, "required": ["query"] }, "config": { "server_name": "my-mcp", "tool_name": "web_search" } }

config reference

FieldTypeDescription
server_namestringMust match the name of an entry in mcp_servers.
tool_namestringThe tool name as exposed by the MCP server.

Multiple tools from one server

You can define many Oshara tools pointing at different tools on the same MCP server:

{ "mcp_servers": [ { "name": "integrations", "url": "https://mcp.yoursite.com/call", "transport": "streamable_http", "headers": { "Authorization": "Bearer token" } } ] }
[ { "name": "send_email", "kind": "mcp", "description": "Send an email to the user.", "input_schema": { ... }, "config": { "server_name": "integrations", "tool_name": "send_email" } }, { "name": "create_calendar_event", "kind": "mcp", "description": "Schedule a calendar event.", "input_schema": { ... }, "config": { "server_name": "integrations", "tool_name": "calendar_create" } } ]

Per-session MCP headers

For headers that vary per user (e.g. a user-scoped JWT), pass them at session start — they are merged into all MCP calls for that session:

POST /api/agents/agent-session/ { "agent": "support-bot", "mcp_headers": { "X-User-Id": "u_123", "X-Org-Token": "org-jwt-here" } }

Building an MCP server

An MCP server exposes a single HTTP endpoint that accepts a JSON body with:

{ "tool": "tool_name", "arguments": { ... } }

And returns:

{ "result": { ... } }

For the full MCP specification see modelcontextprotocol.io .

Last updated on