npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

xliff-mcp

v1.0.6

Published

MCP server for XLIFF bilingual file processing

Readme

XLIFF MCP Server

一个专门处理XLIFF双语文件的Model Context Protocol (MCP)服务器,基于filesystem功能扩展,提供完整的XLIFF文件处理能力。

功能特性

文件系统操作

  • 读写文件
  • 列出目录内容
  • 搜索文件
  • 安全的路径验证(只允许在指定目录内操作)

XLIFF专用功能

  • 解析XLIFF文件:将XLIFF文件转换为JSON数据
  • 创建XLIFF文件:根据JSON数据生成XLIFF文件
  • 更新XLIFF文件:更新现有XLIFF文件的翻译内容
  • 验证XLIFF文件:检查XLIFF文件格式和结构
  • 批量处理:批量解析和验证目录中的XLIFF文件

支持的XLIFF版本

  • XLIFF 1.2
  • XLIFF 2.0
  • XLIFF 2.1

安装

npm install -g xliff-mcp

使用方法

与Claude Desktop一起使用

claude_desktop_config.json中添加以下配置:

{
  "mcpServers": {
    "xliff": {
      "command": "xliff-mcp",
      "args": ["/path/to/your/xliff/files", "/path/to/output/directory"]
    }
  }
}

与VS Code一起使用

{
  "mcp": {
    "servers": {
      "xliff": {
        "command": "xliff-mcp",
        "args": ["${workspaceFolder}"]
      }
    }
  }
}

API工具

文件系统工具

read_file

读取文件内容

  • 输入:path (string) - 文件路径

write_file

写入文件内容

  • 输入:
    • path (string) - 文件路径
    • content (string) - 文件内容

list_directory

列出目录内容

  • 输入:path (string) - 目录路径

search_files

搜索文件

  • 输入:
    • path (string) - 搜索起始目录
    • pattern (string) - 搜索模式
    • excludePatterns (string[]) - 排除模式(可选)

XLIFF工具

parse_xliff

解析XLIFF文件为JSON格式

  • 输入:path (string) - XLIFF文件路径
  • 输出:包含翻译单元的JSON数组

create_xliff

根据JSON数据创建XLIFF文件

  • 输入:
    • path (string) - 输出文件路径
    • data (XliffData[]) - 翻译数据数组
    • options (CreateXliffOptions) - 创建选项

update_xliff

更新现有XLIFF文件

  • 输入:
    • path (string) - XLIFF文件路径
    • updates (XliffData[]) - 更新数据数组
    • options (UpdateXliffOptions) - 更新选项

validate_xliff

验证XLIFF文件格式

  • 输入:path (string) - XLIFF文件路径
  • 输出:验证结果和错误信息

batch_process_xliff

批量处理XLIFF文件

  • 输入:
    • directory (string) - 包含XLIFF文件的目录
    • pattern (string) - 文件匹配模式(默认:*.xlf)
    • operation ('parse' | 'validate') - 操作类型

数据结构

XliffData

interface XliffData {
    fileName: string;        // 文件名
    segNumber: number;       // 段落编号
    percent: number;         // 匹配百分比
    source: string;          // 源文本
    target: string;          // 目标文本
    srcLang: string;         // 源语言
    tgtLang: string;         // 目标语言
    id?: string;             // 单元ID
    approved?: boolean;      // 是否已批准
    state?: string;          // 状态
    resname?: string;        // 资源名称
}

示例用法

解析XLIFF文件

# 通过MCP调用
parse_xliff --path "/path/to/file.xlf"

创建XLIFF文件

const xliffData = [
  {
    fileName: "test.xlf",
    segNumber: 1,
    percent: 100,
    source: "Hello",
    target: "你好",
    srcLang: "en",
    tgtLang: "zh-cn",
    id: "1"
  }
];

const options = {
  version: "1.2",
  sourceLanguage: "en",
  targetLanguage: "zh-cn",
  original: "source.txt"
};

开发

构建

npm run build

监听变化

npm run watch

许可证

MIT License

贡献

欢迎提交Issues和Pull Requests!