MCP Protocol
Model Context Protocol (MCP) is an open standard for connecting AI models to external tools and data sources. LTG API Portal uses MCP to give Claude agents access to real-time data and actions.
How it works
Agent run request │ ├── Discover tools: POST /mcp { method: "tools/list" } │ └── Returns: [{ name, description, inputSchema }] │ ├── Send to Claude API: messages + tools definitions │ └── Claude responds: text OR tool_use blocks │ └── For each tool_use block: ├── POST /mcp { method: "tools/call", params: { name, arguments } } └── Returns: { content: [{ type: "text", text: "..." }] }Transport
The portal uses Stateless HTTP transport (StreamableHTTPServerTransport). Each request to POST /mcp is independent — no session, no streaming state.
Request shape:
{ "jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {}}Or for tool calls:
{ "jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": { "name": "list_products", "arguments": {} }}Response shape:
{ "jsonrpc": "2.0", "id": 2, "result": { "content": [ { "type": "text", "text": "[{\"id\":\"prod_abc\",...}]" } ] }}Building an MCP server
To create a compatible MCP server:
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';import { z } from 'zod';
const mcp = new McpServer({ name: 'my-server', version: '1.0.0' });
mcp.tool('get_data', 'Fetch data from our system', { query: z.string().describe('Search query'), limit: z.number().optional().default(10),}, async ({ query, limit }) => { const results = await fetchFromDatabase(query, limit); return { content: [{ type: 'text', text: JSON.stringify(results) }] };});
// Hono handler — one transport per request (stateless)app.post('/mcp', async (c) => { const transport = new StreamableHTTPServerTransport({ sessionIdGenerator: undefined }); await mcp.connect(transport); const body = await c.req.json(); const response = await transport.handleRequest(body, Object.fromEntries(c.req.raw.headers)); return c.json(response);});Register your server URL in the portal under MCP Servers, then click Discover Tools.
Tool design tips
- Tool names should be snake_case verbs:
list_tickets,create_alert,get_report - Descriptions matter — Claude uses them to decide which tool to call. Be specific.
- Return JSON strings (not raw objects) in the
textfield — Claude can parse them - Keep responses focused — return only what Claude needs. Large responses burn context tokens.
- Handle errors gracefully — throw
McpErrorwith a helpful message rather than crashing