Function getVincentAppServer

  • Creates an MCP server for a Vincent application

    This function configures an MCP server with the tools defined in the Vincent application definition. Each tool is registered with the server and configured to use the provided delegatee signer for execution.

    Check (MCP Typescript SDK docs)[https://github.com/modelcontextprotocol/typescript-sdk] for more details on MCP server definition.

    Parameters

    • delegateeSigner: Signer

      The Ethereum signer used to execute the tools

    • vincentAppDefinition: {
          id: string;
          name: string;
          tools: Record<
              string,
              {
                  description: string;
                  name: string;
                  parameters: {
                      description: string;
                      name: string;
                      type: | "string"
                      | "number"
                      | "number_array"
                      | "bool"
                      | "bool_array"
                      | "address"
                      | "address_array"
                      | "string_array"
                      | "bytes"
                      | "bytes_array";
                  }[];
              },
          >;
          version: string;
      }

      The Vincent application definition containing the tools to register

    Returns McpServer

    A configured MCP server instance

    import { ethers } from 'ethers';
    import { mcp } from '@lit-protocol/vincent-sdk';
    import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';

    // Create a signer
    const provider = new ethers.providers.JsonRpcProvider('https://mainnet.infura.io/v3/YOUR_INFURA_KEY');
    const wallet = new ethers.Wallet('YOUR_PRIVATE_KEY', provider);

    // Define your Vincent application
    const appDef: mcp.VincentAppDef = {
    id: '8462368',
    version: '1',
    name: 'My Vincent App',
    description: 'A Vincent application that executes tools for its delegators',
    tools: {
    'QmIpfsCid1': {
    name: 'myTool',
    description: 'A tool that does something',
    parameters: [
    {
    name: 'param1',
    type: 'string',
    description: 'A parameter that is used in the tool to do something'
    }
    ]
    }
    }
    };

    // Create the MCP server
    const server = mcp.getVincentAppServer(wallet, appDef);

    // Add transport to expose the server
    const stdio = new StdioServerTransport();
    await server.connect(stdio);