Sofia Data MCP

Sofia Data MCP

MCP server for querying and analyzing urban data from the Sofia municipality CKAN portal. Provides tools for dataset search, retrieval, preview, summarization, and faceted browsing.

Category
访问服务器

README

Sofia Data MCP

TypeScript MCP server, stdio bridge, and CLI client for the Sofia municipality urban data portal at https://urbandata.sofia.bg.

Architecture

  • Canonical server transport: Streamable HTTP
  • Desktop compatibility transport: local stdio bridge that forwards to HTTP
  • Local default endpoint: http://127.0.0.1:3000/mcp
  • Source portal integration: CKAN Action API

Connect an MCP Client

The deployed server is public, requires no auth, and speaks Streamable HTTP at:

https://sofia-data-mcp-oparjiwnqa-ew.a.run.app/mcp

Clients with native remote/HTTP MCP support (recommended)

VS Code (Copilot Chat) — add to .vscode/mcp.json in your project (or your user mcp.json via the MCP: Open User Configuration command):

{
  "servers": {
    "sofia-data": {
      "type": "http",
      "url": "https://sofia-data-mcp-oparjiwnqa-ew.a.run.app/mcp"
    }
  }
}

Cursor — add to .cursor/mcp.json:

{
  "mcpServers": {
    "sofia-data": {
      "url": "https://sofia-data-mcp-oparjiwnqa-ew.a.run.app/mcp"
    }
  }
}

Clients that only support local stdio servers (e.g. Claude Desktop)

Claude Desktop's claude_desktop_config.json only launches local processes, so bridge to the remote HTTP endpoint with the widely-used mcp-remote adapter (no install/build required, runs via npx):

{
  "mcpServers": {
    "sofia-data": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://sofia-data-mcp-oparjiwnqa-ew.a.run.app/mcp"
      ]
    }
  }
}

Alternatively, this repo's own @sofia-data/stdio-bridge package works the same way — point it at the deployed URL instead of running the server locally:

pnpm --filter @sofia-data/stdio-bridge dev -- \
  --upstream-url https://sofia-data-mcp-oparjiwnqa-ew.a.run.app/mcp

Quick smoke test (no client needed)

curl -s https://sofia-data-mcp-oparjiwnqa-ew.a.run.app/health

Packages

  • @sofia-data/core: shared CKAN client, normalization, analytics, and MCP tool definitions
  • @sofia-data/http-server: HTTP MCP server
  • @sofia-data/stdio-bridge: stdio bridge to an HTTP MCP server
  • @sofia-data/cli: bilingual CLI client

Requirements

  • Node.js 24+
  • Corepack available

Install

corepack enable
corepack prepare pnpm@10.8.1 --activate
pnpm install

Build

pnpm build

Run Locally

Start the HTTP server:

pnpm dev:server

Default endpoint:

http://127.0.0.1:3000/mcp

Run the CLI:

pnpm dev:cli

Run the stdio bridge:

pnpm dev:bridge

Override the bridge upstream URL:

pnpm --filter @sofia-data/stdio-bridge dev -- --upstream-url http://127.0.0.1:3000/mcp

Docker

Build and run with Docker Compose:

docker compose up --build

End-to-End Tests

packages/e2e runs a full black-box smoke test against a deployed instance (health check, MCP initialize handshake, listTools, and a real search_datasets call) — distinct from packages/http-server's unit tests, which spin up a local in-process server. It's skipped automatically (not failed) when no target is given, so it never affects normal pnpm test/CI:

E2E_BASE_URL=https://sofia-data-mcp-oparjiwnqa-ew.a.run.app pnpm test:e2e

This also runs automatically as a post-deploy gate in .github/workflows/deploy.yml, against the URL of the revision that was just deployed.

Deploying to Google Cloud Run

See deploy/gcp/README.md for scripts that deploy http-server to Cloud Run (capped at 1 instance) with an automated budget kill-switch that scales the service to zero if spend reaches a configured threshold (default $2).

Environment Variables

Copy .env.example and adjust as needed.

Key values:

  • SOFIA_CKAN_BASE_URL
  • HOST
  • PORT
  • MCP_HTTP_PATH
  • REQUEST_TIMEOUT_MS=30000
  • PREVIEW_MAX_BYTES=262144
  • MAX_SEARCH_RESULTS=50
  • CACHE_TTL_MS=300000 — in-memory TTL cache for CKAN reads (groups, organizations, search results, dataset lookups). Set to 0 to disable caching.
  • ALLOWED_HOSTS / ALLOWED_ORIGINS — comma-separated extra hostnames/origins (beyond 127.0.0.1/localhost) allowed to reach the MCP endpoint. Required when deploying publicly (e.g. Cloud Run) so the server's own DNS-rebinding/CORS protection doesn't reject requests to its own public hostname. Left unset, the server only accepts local traffic.
  • MCP_UPSTREAM_URL
  • MCP_SERVER_URL

Tools

  • search_datasets
  • get_dataset
  • list_groups
  • get_group
  • list_organizations
  • get_organization
  • list_dataset_resources
  • preview_resource
  • summarize_dataset
  • find_related_datasets
  • facet_datasets — returns catalog-wide counts (group/organization/format/license) computed by CKAN's native faceting, not a client-side count over a capped page of results

Dataset Metadata Enrichment

Dataset summaries include a semanticProfile field generated generically from CKAN metadata alone (groups, tags, resource formats) — there is no per-dataset hardcoded knowledge to maintain, so it scales automatically as datasets are added or renamed on the portal. For exact field-level structure, use summarize_dataset or preview_resource, which parse an actual sampled resource (JSON/GeoJSON) to report real geometry types and property/field names.

Group names that were corrupted by a source-side Cyrillic transliteration/encoding bug (e.g. bnopa3hoo6pa3ne) are automatically repaired using a generic transliteration of the group's title, rather than a hardcoded name-to-name mapping.

Testing

Each package has a unit test suite using Node's built-in test runner:

pnpm test

CI runs pnpm build, pnpm check (typecheck), and pnpm test on every push/PR to main (see .github/workflows/ci.yml).

Automated dependency updates

Dependabot (.github/dependabot.yml) checks weekly for updates to npm/pnpm packages, GitHub Actions, and the Docker base image, grouping patch/minor updates into a single PR per ecosystem. .github/workflows/dependabot-auto-merge.yml automatically approves and enables auto-merge for patch/minor version PRs; the merge only completes once the required build-and-test CI check passes on that PR (enforced by branch protection on main). Major version bumps are left for manual review.

Notes

  • Technical naming is English-only.
  • CLI display text is bilingual and rendered as two lines with English first.
  • Source metadata from the portal is preserved as published.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选