Search

CN-122001691-A - Multi-body collaborative MCP registration, authorization and execution method based on blockchain

CN122001691ACN 122001691 ACN122001691 ACN 122001691ACN-122001691-A

Abstract

The invention provides a multi-body collaborative MCP registration, authorization and execution method based on a blockchain, which relates to the technical field of artificial intelligence and comprises an MCP provider, an LLM provider and an end user, wherein the registration, joint authorization and trusted execution of MCP are realized through intelligent contracts, and the method comprises the steps of registering MCP metadata uplink, applying authorization for a user-LLM combination, initiating double signature call by LLM, performing contract verification and triggering execution, returning results by Oracle and updating states. The invention realizes the decentralization and multi-body collaboration, MCP invokes full-link verifiable, accurate definition of authority, supports fine-grained authority management and control and automatic expense settlement, meets the compliance supervision requirements of GDPR, HIPAA and the like, provides bottom support for large-scale and safe invoking of external services, and is suitable for multi-scene applications such as SaaS, API market and the like.

Inventors

  • ZHANG ZHONGLEI
  • JIANG SHUAI
  • MENG JIAN

Assignees

  • 鱼快创领智能科技(南京)有限公司

Dates

Publication Date
20260508
Application Date
20260410

Claims (10)

  1. 1. A multi-body collaborative MCP registration, authorization and execution method based on a blockchain is characterized by comprising three parts of an MCP provider, an LLM provider and an end user, wherein the three parts are coordinated through a blockchain intelligent contract, an Oracle is used as a trusted chain lower agency to realize three-part interaction, and the MCP provider is provided with a blockchain address on the blockchain LLM provider owns blockchain address on blockchain An end user owns a blockchain address on the blockchain ; The method comprises the following steps: S1, registering MCP metadata uplink; registering the on-chain identity and service information of the LLM provider and the MCP provider to generate a registration record; s2, authorizing a user-LLM combination application; The LLM provider receives the request of the terminal user, submits application parameters to the intelligent contract, verifies the rule on the chain, checks whether the authorization is authorized through the front end or the under-chain, and generates an authorization certificate after the verification is passed; s3, LLM initiates double signature call; The LLM reasoning engine generates an MCP call request, generates an MCP call packet containing a dual-identity signature according to the authorization credential, and initiates an on-chain call request to the blockchain intelligent contract; S4, contract verification and triggering execution; Verifying identity and authority of the MCP calling packet, if verification is passed, performing fee calculation and token locking, triggering the predictor to execute the MCP service calling under the chain, and if verification fails, directly terminating the calling and throwing out exception; S5, the predictor returns a result and updates the state; After the MCP service under the execution chain of the prophetic machine is completed, the execution result is returned in a uplink mode, the state on the chain is updated, the expense is settled, and an audit log is generated.
  2. 2. The multi-master collaborative MCP registration, authorization and execution method based on blockchain of claim 1, wherein step S1 comprises: S11, LLM provider registration generates an on-chain state; The LLM provides a LLM registration parameter submitted to the intelligent contract of the blockchain LLMREGISTRY to generate a decentralised unique identity LLM _fid of the LLM provider to generate an on-chain state; S12, the MCP provider registers to obtain registration records; The MCP provides a global unique identification mcp_id for generating MCP service by submitting MCP registration parameters to the blockchain MCPREGISTRY intelligent contract, calling MCPREGISTRY intelligent contract, performing on-chain verification, and finally solidifying the MCP registration parameters and the global unique identification mcp_id into on-chain registration records 。
  3. 3. The multi-subject collaborative MCP registration, authorization and execution method based on blockchain as set forth in claim 2, comprising: s111, submitting LLM registration parameters by a LLM provider; Responsive to the registration operation, the LLM provider actively submits LLM registration parameters to the blockchain LLMREGISTRY smart contract; S112, processing on a chain to generate a decentralised unique identity identifier llm _id; LLMREGISTRY the intelligent contract calls LLMRegistry. RegisterLLM () method, obtains the blockchain timestamp when LLMREGISTRY intelligent contract is executed, and adds the blockchain timestamp and the blockchain address Generating a centralized unique identity identifier llm _id of a fixed-length hash value through a hash algorithm; S113, generating an on-chain state ; Obtaining LLM registration parameters and a decentralised unique identity identifier LLM _id, outputting and solidifying the LLM registration parameters and the decentralised unique identity identifier LLM _id into an on-chain state according to a fixed format ; On-chain state Blockchain address including LLM identification LLM _id, LLM provider Model name model_name, IPFS hash capability_hash of model capability description, compliance certificate hash complex_cert, charging model billing _mode; s121, the MCP provider submitting the MCP registration parameters; the MCP provider actively submits MCP registration parameters to MCPREGISTRY intelligent contracts; The registration parameters comprise IPFS hash spec_hash of the MCP specification file, an authorization mode auth_mode, LLM compliance attribute requirement required_complex, a pricing strategy pricing, a resource charging parameter cost_model_parameters and a charging scheme lambda; s122, performing on-chain processing verification; 1) Generating an MCP global unique identifier mcp_id; MCPREGISTRY Smart contracts are based on the MCP provider's blockchain address Generating a MCP global unique identifier mcp_id with a fixed-length hash value through a hash algorithm by using a blockchain timestamp when executing the MCPREGISTRY intelligent contracts; 2) Verifying the white list; invoking LLMREGISTRY on-chain states in a smart contract Obtaining llm _ids, obtaining MCPREGISTRY intelligent contracts when registering, traversing all llm _ids in the allowed_ llm _ids, verifying whether each llm _id in the allowed_ llm _ids is in the LLMREGISTRY intelligent contracts, if yes, proceeding to the next step, otherwise, filtering the llm _ids; 3) Screening compliance attributes; if the MCP provider designates required_complex, screening LLM providers LLM _id satisfying the compliance attribute from LLMREGISTRY smart contracts, and updating to the whitelist; 4) Storing the metadata; MCPREGISTRY the smart contract stores the MCP registration parameters after verification, compliance processing and the generated MCP _ id onto the chain, and broadcasts MCPREGISTERED (MCP _ id, ) An event; S123, generating a registration record on the chain; Solidifying the registration parameters of metadata and generated mcp_id into on-chain registration records 。
  4. 4. The multi-master collaborative MCP registration, authorization and execution method based on blockchain of claim 3, wherein step S2 comprises: S21, triggering an authorization request; The LLM provider receives the reasoning request of the terminal user, analyzes and obtains the MCP service to be called, obtains the mcp_id, and reads the corresponding registration record from MCPREGISTRY intelligent contracts Obtaining an authorization mode auth_mode; S22, submitting an authorization application; The LLM provider submits application parameters to MCPAccessControl intelligent contracts on behalf of itself and end users; s23, verifying rules on a chain; According to registration records Respectively verifying the integrity of the identity and the white list; s24, performing front-end or under-chain auditing; the MCP provider returns authorization failure when the application is subjected to audit rejection, and executes the next step when the audit passes; s25, generating an authorization credential; MCP provider invoking MCPAccessControl an intelligent contract to generate an on-chain unique authorization credential And storing.
  5. 5. The blockchain-based multi-master collaborative MCP registration, authorization and execution method of claim 4, wherein: s231, verifying the integrity of the identity; According to registration records Authentication mode auth_mode in (a); s232, verifying a white list; Registration record If the allowed_ llm _ids in the list is not empty, verifying whether the current llm _id is in the white list, and if not, directly refusing the application.
  6. 6. The method for blockchain-based multi-master collaborative MCP registration, authorization and execution of claim 4, wherein the application parameters include mcp_id, llm_id, end user blockchain address LLM provider blockchain address Maximum number of calls Expiration time Scope of authority ; Authorization credentials : ; Wherein, the method comprises the steps of, The initial value is 0 for the called times; For the authorization validation time, the execution start time defaults to the current timestamp when the authorization credential is captured and generated; The maximum calling times; Is an expiration time; is the scope of authority.
  7. 7. The blockchain-based multi-master collaborative MCP registration, authorization and execution method of claim 6, wherein step 3 comprises: S31, generating a call request; The LLM reasoning engine combines the authority range of the authorization credential A according to the original request of the end user Generating a specific calling parameter params of the MCP service and generating a calling packet of a MCP service calling request, wherein the calling packet comprises the specific calling parameter params, the mcp_id of the MCP service to be called and the LLM identifier LLM _id; S32, performing double-identity signature; The terminal user signs the call package by using the private key sku of the terminal user to generate a user signature LLM provider signs the call packet using its own private key skl, generating LLM signature ; S33, initiating an on-chain call; The LLM reasoning engine packages the call parameters and the double signature into a complete call package Submitting a call package to MCPExecutor smart contracts An MCP service invocation request is initiated.
  8. 8. The blockchain-based multi-master collaborative MCP registration, authorization and execution method of claim 7, wherein step S4 comprises: S41, verifying the identity and authority of the calling packet; Verifying the identity of the calling package by calling a blockchain signature verification algorithm to respectively verify the user signatures And LLM signature Is effective in (1); Verifying authority of authorization credential, namely reading authorization credential corresponding to calling package Q from MCPAccessControl intelligent contract Respectively verifying the authorization credentials Whether the called times are smaller than the maximum calling times, whether the blockchain time stamp in verification is smaller than the authorized expiration time, whether the specific calling parameters of the MCP service are in the authority range or not, if so, judging that the authorization is valid, otherwise, judging that the authorization is invalid, and if not, stopping and throwing out the abnormality; s42, calculating fees and locking tokens; according to call packet Q Reading a corresponding registration record from MCPREGISTRY smart contracts Obtaining pricing base pricing Cost_model_parameters, resource charging parameters alpha, beta, according to the formula Calculating the total cost of a single call Wherein, the method comprises the steps of, Is to count the number of tokens of the specific call parameter params, Performing time-consuming predictions for the MCP service, declaring or historical execution means on the blockchain for the MCP provider; S422, locking the token; Obtaining a charging scheme lambda, according to which the block chain addresses of the end users are respectively derived And LLM provided blockchain addresses Locking the token; the locking amounts are respectively lambda · of the end users LLM provider (1-lambda) ; S43, triggering a prophetic machine to call MCP under a chain; The predictor monitors MCPExecutor the execution of the intelligent contract in real time, reads the call request on the chain, and registers the record Analyzing the URL of the under-chain calling endpoint of the MCP service, taking the specific calling parameter params of the calling package Q as an entry, initiating the under-chain MCP service call, and recording the execution starting time of the MCP service After the execution of the MCP service under the chain is completed, an execution result is obtained; The execution results include MCP service execution results And actually time-consuming 。
  9. 9. The multi-master collaborative MCP registration, authorization and execution method based on blockchain of claim 8, wherein step S5 comprises: S51, performing uplink feedback on an execution result; Prophetic machine executes MCP service results Generating hash values Writing back on the chain; S52, updating the authorization state; for the number of invocations in the authorization credential A Performing atom increment, and increasing the numerical value by 1; S53, settlement cost: unlocking the locked tokens, releasing the tokens, and releasing the tokens borne by the user Tokens to be borne by LLM providers From blockchain addresses of end users, respectively And LLM provider blockchain address Deducting the blockchain address transferred to the MCP provider ; S54, generating an audit log; an on-chain audit log L is generated and stored to the blockchain.
  10. 10. The method of blockchain-based multi-master collaborative MCP registration, authorization and execution of claim 9, wherein the on-chain audit log L includes the end user blockchain address, the MCP provider blockchain address and the LLM provider blockchain address, 、 Time when execution of MCP service starts, time when execution ends, and MCP service execution result Is used to generate the hash value of (a).

Description

Multi-body collaborative MCP registration, authorization and execution method based on blockchain Technical Field The invention relates to the technical field of artificial intelligence, in particular to a multi-body collaborative MCP registration, authorization and execution method based on a blockchain. Background Currently, large language models (LargeLanguageModels, LLMs) have become the dominant paradigm by invoking external tools to extend their capabilities. To this end, communities have proposed a model context protocol (ModelContextProtocol, MCP) aimed at standardizing the interaction interface between LLMs and external services (e.g., databases, APIs, simulators, compute engines). Typical implementations include FunctionCalling of ToolRegistry, openAI of LANGCHAIN, open source MCPSERVER, and the like. However, in the current architecture, usually, the authority authentication and the like related to MCP are integrated in a large model LLM provider platform through a configuration means, then a user calls a model on the large model LLM provider platform to call different MCP services, and all the log, charging and authority control are completed by the large model LLM which is centralized. The current architecture has the following problems if the current architecture is intended to realize a broader sense, multiple groups participate in a trusted interaction mode: 1) The responsibility is fuzzy, namely whether a user instruction or the behavior of the model itself triggers sensitive call cannot be distinguished; 2) Rights generalization-when the same user uses different LLMs, the rights policy cannot be differentiated; 3) Billing misalignment-the fee may be borne by the LLM provider (e.g., saaS mode), but the system cannot identify; 4) Compliance risk-regulatory authorities cannot trace back "which model called which external service at what time". Disclosure of Invention The invention aims to solve the defects in the prior art, and provides a multi-body collaborative MCP registration, authorization and execution method based on block chains, which is decentralised, multi-body collaborative and verifiable in full life cycle. In order to achieve the above purpose, the invention adopts the following technical scheme: A multi-body collaborative MCP registration, authorization and execution method based on a blockchain comprises three parts of an MCP provider, an LLM provider and an end user, wherein the three parts are coordinated through a blockchain intelligent contract, an Oracle is used as a trusted chain lower agency to realize three-part interaction, and the MCP provider is provided with a blockchain address on the blockchain LLM provider owns blockchain address on blockchainAn end user owns a blockchain address on the blockchain; The method comprises the following steps: S1, registering MCP metadata uplink; registering the on-chain identity and service information of the LLM provider and the MCP provider to generate a registration record; s2, authorizing a user-LLM combination application; The LLM provider receives the request of the terminal user, submits application parameters to the intelligent contract, verifies the rule on the chain, checks whether the authorization is authorized through the front end or the under-chain, and generates an authorization certificate after the verification is passed; s3, LLM initiates double signature call; The LLM reasoning engine generates an MCP call request, generates an MCP call packet containing a dual-identity signature according to the authorization credential, and initiates an on-chain call request to the blockchain intelligent contract; S4, contract verification and triggering execution; Verifying identity and authority of the MCP calling packet, if verification is passed, performing fee calculation and token locking, triggering the predictor to execute the MCP service calling under the chain, and if verification fails, directly terminating the calling and throwing out exception; S5, the predictor returns a result and updates the state; After the MCP service under the execution chain of the prophetic machine is completed, the execution result is returned in a uplink mode, the state on the chain is updated, the expense is settled, and an audit log is generated. Further, step S1 includes: S11, LLM provider registration generates an on-chain state; The LLM provides a LLM registration parameter submitted to the intelligent contract of the blockchain LLMREGISTRY to generate a decentralised unique identity LLM _fid of the LLM provider to generate an on-chain state; S12, the MCP provider registers to obtain registration records; The MCP provides a global unique identification mcp_id for generating MCP service by submitting MCP registration parameters to the blockchain MCPREGISTRY intelligent contract, calling MCPREGISTRY intelligent contract, performing on-chain verification, and finally solidifying the MCP registration parameters and the global unique ide