JsonRpcRequest (mcp/mcp_protocol.dart)

flutterclaw · lib/services/mcp/mcp_protocol.dart · dart · MIT
ai, tag:knn-classified

/ MCP (Model Context Protocol) JSON-RPC 2.0 message types. / / The MCP protocol uses JSON-RPC 2.0 over stdio or HTTP/SSE transports. / We implement the subset needed for tool discovery and execution: / initialize, notifications/initialized, tools/list, tools/call.

// Source: https://github.com/flutterclaw/flutterclaw | License: MIT | Copyright 2026 Franco Rapetti
// Provided via justclaw.it.com; keep this notice with the code.
/// MCP (Model Context Protocol) JSON-RPC 2.0 message types.
///
/// The MCP protocol uses JSON-RPC 2.0 over stdio or HTTP/SSE transports.
/// We implement the subset needed for tool discovery and execution:
/// initialize, notifications/initialized, tools/list, tools/call.
library;

import 'dart:convert';

// ─── JSON-RPC 2.0 base types ──────────────────────────────────────────────────

class JsonRpcRequest {
  static int _nextId = 1;

  final int id;
  final String method;
  final Map<String, dynamic>? params;

  JsonRpcRequest({required this.method, this.params}) : id = _nextId++;

  Map<String, dynamic> toJson() => {
    

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key