Token导航 LogoToken导航TokenDH.com
Components MCP logo
开发工具stdio官方级别未说明来源级核验

Components MCP

MCP Server

一个简单的MCP服务器,提供列出和检索存储在.libs目录中的可重用组件详细信息的工具。

工具数

2

提示词数

0

GitHub Stars

0

资源数

0
PythonClaude开发工具Claude DesktopClaudeCursor

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

husams

提供方

husams

最后核验

2026/5/17 20:22

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

uvx --from . components-mcp

详细介绍

组件MCP服务器

一个简单的MCP服务器,提供列出和检索存储在中的可重用组件详细信息的工具 .libs 目录。

特性

此服务器提供 两个工具:

  1. 列表_组件:列出给定类型(应用程序或功能)的所有组件
  2. 获取详细信息:返回特定组件的详细信息

组件类型

组件根据其 index.yaml 文件:

  • 函数:多个公共函数(index.yaml中有2+个条目)

- 具有多种可重用功能的库 - 每个函数都可以独立调用 - 示例:具有文本格式、数学运算等的实用程序库。

  • 应用:单个主入口点(index.yaml中的1个入口)

- 具有主要功能的完整应用程序 - 子目录中的助手/私有模块 - 示例:带有一个main()函数的电子邮件应用程序,该函数处理所有操作

安装

选项1:使用uvx运行(无需安装)

使用服务器的最快方法:

# Run directly with uvx (from local directory)
uvx --from . components-mcp

# Or from a built package
uvx --from dist/components_mcp-0.1.0-py3-none-any.whl components-mcp

# Or from a Git repository
uvx --from git+https://github.com/your-org/components-mcp.git components-mcp

选项2:本地安装

# Install with uv
uv sync

# Or with pip
pip install -e .

用法

运行服务器

# METHOD 1: Run with uvx (recommended for quick use)
uvx --from . components-mcp

# METHOD 2: Run with FastMCP CLI
fastmcp run src/components_mcp/server.py

# METHOD 3: Run as installed command
uv run components-mcp

# METHOD 4: Run as Python module
python -m components_mcp

# Run with HTTP transport
fastmcp run src/components_mcp/server.py --transport http --port 8000

# Run with MCP Inspector for testing
fastmcp dev src/components_mcp/server.py

在MCP客户端中安装

# Install in Claude Desktop
fastmcp install claude-desktop src/components_mcp/server.py

# Install in Claude Code
fastmcp install claude-code src/components_mcp/server.py

# Install in Cursor
fastmcp install cursor src/components_mcp/server.py

组件目录发现

服务器扫描 .libs 目录按以下顺序排列:

  1. 本地项目: ./libs (当前工作目录)
  2. 环境变量: $COMPONENT_DIR/.libs
  3. 默认缓存: ~/.cache/agent-tools/.libs

设置 COMPONENT_DIR 使用自定义位置的环境变量:

export COMPONENT_DIR=/path/to/components
fastmcp run server.py

工具

1.列表_组件

列出.lbs目录中的组件。

参数:

  • type (可选):按类型筛选- "app", "function",或省略列出所有内容

退货:

[
  {
    "name": "category.feature.function_name",
    "description": "Brief description of the component"
  }
]

示例:

# List all components (apps + functions)
result = await client.call_tool(
    name="list_components",
    arguments={}
)

# List only functions
result = await client.call_tool(
    name="list_components",
    arguments={"type": "function"}
)

# List only apps
result = await client.call_tool(
    name="list_components",
    arguments={"type": "app"}
)

2.获取详细信息

返回特定组件的详细信息。

参数:

  • type (必填):要么 "app""function"
  • name (必填):完全限定的组件名称(例如。, "category.feature.function")

退货:

{
  "name": "category.feature.function_name",
  "type": "function",
  "description": "Full docstring from the component",
  "short_description": "Brief description from index.yaml",
  "module_path": "/path/to/.libs/category/feature/module.py",
  "root_directory": "/path/to/.libs",
  "category": "category",
  "feature": "feature"
}

例子:

# Get details for a specific component
result = await client.call_tool(
    name="get_details",
    arguments={
        "type": "function",
        "name": "utils.service_config.rename_service"
    }
)

测试

使用pytest运行测试套件:

# Install test dependencies
uv sync --group dev

# Run all tests
uv run pytest

# Run with verbose output
uv run pytest -v

# Run specific test file
uv run pytest tests/test_server.py -v

# Run with coverage
uv run pytest --cov=src/components_mcp

项目结构

components-mcp/
├── src/
│   └── components_mcp/
│       ├── __init__.py
│       ├── __main__.py           # Entry point
│       └── server.py             # MCP server implementation
├── tests/
│   ├── __init__.py
│   ├── test_server.py            # Server configuration tests
│   ├── test_list_components.py  # list_components tool tests
│   └── test_get_details.py      # get_details tool tests
├── .libs/                        # Example component library
│   ├── index.yaml
│   └── example/
│       ├── utils/
│       └── email_app/
├── pyproject.toml
└── README.md

组件目录结构

注: 没有根index.yaml文件。每个组件目录都有自己的index.yaml。

功能类型组件

组件与 多种公共职能 (索引yaml中有2个以上条目):

.libs/
└── category/
    └── feature/                  # Function component
        ├── __init__.py
        ├── index.yaml            # Lists all public functions
        ├── module_1.py           # Contains public function(s)
        └── module_2.py           # Contains public function(s)

函数的示例index.yaml:

functions:
  - name: category.feature.module_1.function_a
    description: First public function
  - name: category.feature.module_1.function_b
    description: Second public function
  - name: category.feature.module_2.function_c
    description: Third public function

应用程序类型组件

带有a的组件 单一主要入口点 (索引yaml中有1个条目):

.libs/
└── category/
    └── app_name/                 # App component
        ├── __init__.py
        ├── index.yaml            # Lists only main function
        ├── main.py               # Contains main() function
        └── helpers/              # Private helper modules
            ├── __init__.py
            ├── helper_1.py
            └── helper_2.py

应用程序的index.yaml示例:

functions:
  - name: category.app_name.main.main
    description: Main entry point for the application

配电楼

为uvx或PyPI构建可分发的包:

# Build wheel and source distribution
uv build

# Output will be in dist/
# - dist/components_mcp-0.1.0-py3-none-any.whl (wheel)
# - dist/components_mcp-0.1.0.tar.gz (source)

# Run from built wheel with uvx
uvx --from dist/components_mcp-0.1.0-py3-none-any.whl components-mcp

# Or install from wheel
pip install dist/components_mcp-0.1.0-py3-none-any.whl

发展

# Run server with auto-reload during development
fastmcp dev src/components_mcp/server.py

# Inspect server components
fastmcp inspect src/components_mcp/server.py

# Generate JSON report
fastmcp inspect src/components_mcp/server.py --format fastmcp -o report.json

# Run tests during development
uv run pytest tests/ -v --tb=short

# Build package
uv build

许可证

麻省理工学院

目录标签

目录标签

PythonClaude开发工具组件管理本地部署代码复用MCP协议

支持客户端

Claude DesktopClaudeCursor

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

2

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP