Cldf Mcp

io.github.hsouf由 GitHub 账号 hsouf 发布v0.1.0更新于 Nov 2, 2026

WALS typology joined with Glottolog classification, with provenance and family-aware counts.

概览

AI 生成的概览

只读 MCP 服务器,为助手提供有出处的 WALS 类型学数据并结合 Glottolog 分类,附带来源与按语系统计的计数。

可以做什么
  • 列出已加载数据集及其版本、覆盖范围、许可与引用方式
  • 按名称、ISO 代码或 Glottocode 查找语言,并按关键词检索类型学特征
  • 查询各语言的特征取值、单个语言的完整档案以及单个特征的取值分布
  • 按最多八个特征条件筛选语言,并对两个特征做交叉统计
  • 查看 Glottolog 谱系、子群与姐妹语言,并获取数据点所引来源的完整文献信息
适用场景
适合回答跨语言类型学、语序、音系或特征共现方面的问题,也适合检验某个所谓普遍规律是否跨语系成立而非只反映单一谱系。查询语言分类与濒危状况时同样有用。
运行要求
以 uvx 在本地运行(需 Python 3.11+ 及 uv 或 pip)。首次使用会下载固定版本的 WALS 与 Glottolog 数据(约 40 MB)并构建本地 SQLite 数据库,也可提前执行 setup 命令完成。之后无需账号、API 密钥或网络。可选配置:CLDF_MCP_DATA_DIR、CLDF_MCP_CONFIG,以及 streamable-http 传输方式。
安装前请注意
所有工具均为只读,数据准备完成后可离线使用。首次运行会从第三方发布源下载数据并校验校验和。可选配置项可加载来自远程地址或本地路径的额外 CLDF 数据集。数据采用 CC-BY-4.0 许可,须注明引用;WALS 反映约 2013 年以前的文献,每个特征仅覆盖数百种语言,百分比基于已编码语言而非世界全部语言。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Cldf Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

cldf-mcp

An MCP server that gives AI assistants grounded access to cross-linguistic data published in the CLDF format. Version 0.1 ships with:

  • WALS, the World Atlas of Language Structures: 192 typological features (word order, phonology, morphology…) for 2,660 languages, with sources for every datapoint;
  • Glottolog: the catalog of the world's ~27,000 languoids, their classification, alternate names, endangerment and description status.

Language models know WALS exists but are unreliable on specifics: which value a language has for feature 85A, or how many languages combine SOV order with prepositions. This server returns the actual data, with the release it came from and the reference behind it.

What makes it different from a lookup table

  • Family-aware counts. Related languages inherit features, so "400 languages do X" can mean "three big families do X". Every count comes with the number of distinct families (from Glottolog) and WALS genera, plus the share of the largest family, so the model can tell a cross-linguistic tendency from the signature of one lineage. WALS's balanced 100- and 200-language samples are available as filters.
  • Provenance everywhere. Each answer names the dataset, release and citation; datapoints carry their bibliographic sources and page numbers.
  • No silent guessing. bsq is WALS's code for Basque and the ISO code for Bassa, so the server asks instead of picking one. "No data" is never reported as "absent".
  • Pinned, verified data. Datasets are fetched from tagged releases and checked against SHA-256 checksums before loading.

Quick start

Requires Python 3.11+ and uv (or pip).

Claude Code

bash
claude mcp add cldf -- uvx cldf-mcp

Claude Desktop and other clients that use an mcpServers config:

json
{  "mcpServers": {    "cldf": {      "command": "uvx",      "args": ["cldf-mcp"]    }  }}

On first use the server downloads the pinned releases (about 40 MB) and builds a local SQLite database (about 35 MB) in a few seconds. To do this ahead of time:

bash
uvx cldf-mcp setup

Then ask things like:

  • Which languages in WALS are SOV but use prepositions? Are they spread across families?
  • Is "VSO implies prepositions" a real tendency? Check it within the WALS 200-language sample.
  • Give me Basque's word-order features, with sources.
  • How does WALS cover the Austronesian family? Which branches have the most data?

Tools

ToolWhat it does
list_datasetsLoaded datasets, release versions, coverage, licenses and citations
find_languageNames (including alternate names and misspellings), ISO 639-3 codes, Glottocodes or dataset codes → ranked candidates with family, macroarea and which entries have data
search_featuresKeyword search over feature names, chapters and value labels → feature IDs and possible values
get_featureDefinition, chapter, authors and value distribution, counted by languages, families and genera; optional filters by macroarea, family/subgroup or WALS sample
get_valuesLanguage × feature grid with values, comments, sources and full citations; unresolvable names are reported with candidates instead of failing the call
language_profileEverything about one language: Glottolog identity, lineage, endangerment, description status and all feature values
filter_languagesLanguages matching up to 8 conditions (AND, with exclude), across datasets, with the denominator (languages coded for all conditions) and family counts
crosstabTwo features cross-tabulated: languages, families, genera and largest-family share per cell, zero cells kept, optional macroarea breakdown
classificationGlottolog lineage, children (with how many dataset entries fall under each), sisters
get_sourceFull bibliographic references for the source IDs cited in datapoints

Resources:

  • cldf://guide/typology-caveats: how to use counts responsibly (sampling bias, areal effects, coverage, citation). The server's instructions point the model to it.
  • cldf://datasets: versions, licenses and citations of the loaded data.

All tools are read-only and work offline once the data is prepared.

Configuration

SettingDefault
--data-dir / CLDF_MCP_DATA_DIR~/.cache/cldf-mcp (Linux), ~/Library/Caches/cldf-mcp (macOS), %LOCALAPPDATA%\cldf-mcp (Windows)
--config / CLDF_MCP_CONFIGnone: extra TOML to add or override datasets (experimental, see below)
--transportstdio; streamable-http with --host / --port for remote use

Other commands: cldf-mcp info (where data lives, whether it is current) and cldf-mcp setup --force (rebuild).

Adding a dataset (experimental)

Any CLDF StructureDataset whose languages carry Glottocodes can be loaded alongside WALS. Feature tools, family counting and cross-dataset filters work on it automatically:

toml
# my-datasets.toml[datasets.mydata]title = "My typological survey"role = "features"version = "v1.0"base_url = "https://raw.githubusercontent.com/me/mydata/v1.0/cldf/"   # or: local_path = "/path/to/cldf"metadata = "StructureDataset-metadata.json"license = "CC-BY-4.0"citation = "Me. 2026. My typological survey."
[datasets.mydata.files]   # every file the loader needs, with optional sha256 checksums"StructureDataset-metadata.json" = """languages.csv" = """parameters.csv" = """codes.csv" = """values.csv" = ""
bash
cldf-mcp setup --config my-datasets.toml

Data, licenses and citation

The server code is MIT-licensed. The data is not part of this package: it is downloaded from the original releases, which are licensed under CC-BY-4.0. If you publish results obtained with this server, cite the datasets (see DATA_LICENSES.md):

Dryer, Matthew S. & Haspelmath, Martin (eds.) 2013. The World Atlas of Language Structures Online. Leipzig: Max Planck Institute for Evolutionary Anthropology. https://wals.info (CLDF release v2020.6)

Hammarström, Harald & Forkel, Robert & Haspelmath, Martin & Bank, Sebastian. 2026. Glottolog 5.3. Leipzig: Max Planck Institute for Evolutionary Anthropology. https://glottolog.org

This is an independent project and is not affiliated with the WALS, Glottolog or CLDF teams.

Limitations

  • WALS reflects the literature up to about 2013, and most features are coded for a few hundred languages. Percentages are of coded languages, not of the world's languages.
  • Family counts follow Glottolog, which does not recognise proposed macro-families (e.g. Altaic). Of the 17 WALS languages without a Glottocode, 10 are matched to a Glottolog family through WALS's family or genus name; the other 7 keep WALS's own label (e.g. "Niger-Congo").
  • Glottolog's full bibliography is not bundled; its references are returned as links.

Roadmap

  • 0.2: Grambank, the first dataset that overlaps with WALS, with side-by-side comparison of related features.
  • 0.3: PHOIBLE sound inventories and Lexibank wordlists (get_inventory, get_forms).

Development

bash
git clone https://github.com/hsouf/cldf-mcp && cd cldf-mcppython -m venv .venv && . .venv/bin/activatepip install -e ".[dev]"pytest                # offline tests on small fixtures (tests/fixtures)pytest -m network     # downloads the real pinned releases and checks known WALS countsruff check src tests && ruff format --check src tests

See RELEASING.md for publishing to PyPI and the MCP Registry.

来源:README.md,提交 cf08703

工具

10

list_datasets

List the loaded datasets with their release versions, coverage, licenses and how to cite them.

无需输入参数。

find_language

Find languages by name or code. Returns Glottocodes, family, macroarea and which dataset entries have data. Use this before other tools when a name might be ambiguous (e.g. 'Arabic' is a family; WALS has Arabic varieties). Candidates are ranked: exact codes, exact names, alternate names, then partial matches.

输入参数limitquery必填

search_features

Search typological features by keyword. Returns feature IDs, names, possible values and how many languages are coded for each.

输入参数limitquery必填dataset

get_feature

Describe one feature: definition, chapter and authors, and how its values are distributed, counted by languages, families and genera.

输入参数familysamplefeature必填macroareaby_macroarea

get_values

Look up specific datapoints: the value of each feature for each language, with sources, comments and full citations. Unresolvable names are reported in 'errors' with candidates instead of failing the call. When several dataset entries share a Glottocode (e.g. Basque and Basque dialects), the main entry is used and the others are listed; pass a dataset ref like 'wals:bso' to pick a specific one.

输入参数features必填languages必填

language_profile

Everything known about one language: Glottolog identity, classification, endangerment and description status, plus all its feature values per dataset.

输入参数limitdatasetlanguage必填

filter_languages

Find languages matching feature conditions, e.g. SOV order AND postpositions. Returns match counts against the number of languages coded for all conditions (the denominator), with family and genus counts and the families contributing most matches, plus the matching languages.

输入参数limitfamilysamplemacroareaconditions必填

crosstab

Cross-tabulate two features over the languages coded for both. Each cell gives languages, families and genera attesting the combination and the share of its largest family, so you can tell a cross-linguistic tendency from the signature of one big family. Use this to check implicational universals.

输入参数familysamplefeature_a必填feature_b必填macroareaby_macroarea

classification

Glottolog classification of a language or group: lineage, children (with how many dataset entries fall under each), sisters, and the number of languages below.

输入参数language必填max_children

get_source

Full bibliographic references for source IDs cited in datapoints.

输入参数datasetsource_ids必填

版本历史

1
  1. v0.1.0最新Oct 26, 2026

评分

已满足适用检查项的 90%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分
  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分