MCP cover image
See in Github
2025-03-05

一个用于定义MCP服务器的组件库。

0

Github Watches

1

Github Forks

0

Github Stars

Xircuits MCP Component Library

A Xircuits component library for implementing Model Context Protocol (MCP) servers. This library provides components that make it easy to create, configure, and run MCP servers using the Xircuits visual programming interface.

What is Model Context Protocol (MCP)?

The Model Context Protocol (MCP) lets you build servers that expose data and functionality to LLM applications in a secure, standardized way. Think of it like a web API, but specifically designed for LLM interactions. MCP servers can:

  • Expose data through Resources (think of these sort of like GET endpoints; they are used to load information into the LLM's context)
  • Provide functionality through Tools (sort of like POST endpoints; they are used to execute code or otherwise produce a side effect)
  • Define interaction patterns through Prompts (reusable templates for LLM interactions)
  • And more!

Prerequisites

  • Python 3.8 or higher
  • Xircuits
  • MCP Python SDK

Installation

To use this component library, ensure you have Xircuits installed, then simply run:

xircuits install https://github.com/xpressai/xai-mcp

Alternatively, you may manually copy the directory / clone or submodule the repository to your working Xircuits project directory then install the packages using:

pip install -r requirements.txt

Components

This library provides components for implementing MCP servers, organized into several categories:

Server Setup Components

  • MCPCreateServer: Creates a FastMCP server instance with the specified name and optional dependencies.
  • MCPRunServer: Starts the MCP server and keeps it running until interrupted.

Start Node Components

These components act as entry points for defining MCP server capabilities. They can be dragged onto the canvas to implement responses to events:

  • MCPDefineTool (Royal Blue): Defines a tool for the MCP server, allowing LLMs to perform actions and computations.
  • MCPDefineResource (Lime Green): Defines a resource for the MCP server, allowing LLMs to access data through URI patterns.
  • MCPDefinePrompt (Dark Orchid): Defines a prompt template for the MCP server, providing reusable interaction patterns for LLMs.
  • MCPServerOnStart (Dark Orange): Defines code to execute when the MCP server starts.
  • MCPServerOnShutdown (Firebrick): Defines code to execute when the MCP server shuts down.

Result Setting Components

These components are used within the body of start nodes to set the results of tool, resource, or prompt executions:

  • MCPSetToolResult (Royal Blue): Sets the result of a tool execution.
  • MCPSetResourceResult (Lime Green): Sets the result of a resource execution.
  • MCPSetPromptResult (Dark Orchid): Sets the result of a prompt execution.

Utility Components

  • MCPCreateImage: Creates an Image object for use with MCP tools and resources.
  • MCPGetArgument: Gets an argument from the args dictionary.
  • MCPReportProgress: Reports progress for a long-running operation.
  • MCPReadResource: Reads a resource from the MCP server.
  • MCPCreateUserMessage: Creates a user message for use in prompts.
  • MCPCreateAssistantMessage: Creates an assistant message for use in prompts.
  • MCPCreateMessageList: Creates a list of messages for use in prompts.

Usage Example

Here's an example of how to use this component library to create an MCP server:

  1. Create a new Xircuits workflow
  2. Add an MCPCreateServer component to create a server instance
  3. Add MCPDefineTool, MCPDefineResource, and MCPDefinePrompt start nodes to define the server's capabilities
  4. For each start node, connect components to implement the logic for the tool, resource, or prompt
  5. Use MCPSetToolResult, MCPSetResourceResult, or MCPSetPromptResult to set the results
  6. Optionally, add MCPServerOnStart and MCPServerOnShutdown start nodes to define server lifecycle behavior
  7. Add an MCPRunServer component to start the server

Example: Creating a Calculator Tool

  1. Drag an MCPDefineTool start node onto the canvas
  2. Set its name to "add" and description to "Add two numbers"
  3. Connect an MCPGetArgument component to get the "a" argument
  4. Connect another MCPGetArgument component to get the "b" argument
  5. Connect a component that adds the two numbers
  6. Connect an MCPSetToolResult component to set the result

Example: Server Lifecycle Management

  1. Drag an MCPServerOnStart start node onto the canvas
  2. Connect components to initialize resources, load data, or perform other startup tasks
  3. Drag an MCPServerOnShutdown start node onto the canvas
  4. Connect components to clean up resources, save data, or perform other shutdown tasks

Documentation

License

Apache License 2.0

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Bora Yalcin
  • Evaluator for marketplace product descriptions, checks for relevancy and keyword stuffing.

  • https://jgadvisorycpa.com
  • This GPT assists in finding a top-rated business CPA - local or virtual. We account for their qualifications, experience, testimonials and reviews. Business operators provide a short description of your business, services wanted, and city or state.

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • OffchainLabs
  • 进行以太坊的实施

  • huahuayu
  • 统一的API网关,用于将多个Etherscan样区块链Explorer API与对AI助手的模型上下文协议(MCP)支持。

  • modelcontextprotocol
  • 模型上下文协议服务器

    Reviews

    5 (1)
    Avatar
    user_8dtM4zZu
    2025-04-16

    I have been using the xai-mcp by XpressAI and it has significantly impressed me with its performance and robustness. The utility and ease of integration into my workflow are unmatched. If you're looking for a reliable and efficient mcp application, this is definitely the one to go for. Highly recommended!