Centia MCP Server

Centia MCP Server

Exposes the Centia API as MCP tools generated from its OpenAPI spec, enabling natural language interaction with Centia services.

Category
访问服务器

README

Centia MCP Server

A Model Context Protocol (MCP) server that exposes the Centia API as MCP tools generated from the OpenAPI spec. It communicates over STDIO and can be used with any MCP-compatible client (Claude Desktop, MCP Inspector, etc.).

Prerequisites

  • Node.js 18+ (20+ recommended)
  • npm 9+

Install

# From the project root
npm install

Authentication

The MCP server uses the same login as the gc2-cli:

npm i -g @mapcentia/gc2-cli
gc2 connect https://api.centia.io   # only if not the default
gc2 login                            # browser, device, or password

The MCP server reads ~/.config/configstore/gc2-env.json (managed by gc2-cli) and refreshes the access token automatically when it expires.

For headless / CI use, set API_TOKEN (and optionally API_BASE_URL) — env vars take precedence over the stored session:

  • API_BASE_URL (optional) — Base URL for the Centia API. Default: https://api.centia.io
  • API_TOKEN (optional) — Static personal access token. Bypasses the stored gc2-cli session.

The API surface is defined in centia-api.json (already included in the repo). The server reads it at runtime to generate tools.

Run locally (development)

Hot‑reload development run with tsx:

npm run dev

This starts the MCP server on STDIO. It is meant to be launched by an MCP client (see below), but you can also smoke‑test it with the MCP Inspector.

Run with npx

You can run the server directly using npx.

If running from the source locally:

npm run build
npx .

If the package is installed or you want to use the published version:

npx @centia/mcp-server

Build and run (production)

npm run build
npm start

This compiles TypeScript to dist/ and starts node dist/index.js.

If you prefer a static token over the stored gc2-cli session (e.g. CI):

API_TOKEN=your_token_here npm start
# or
API_BASE_URL=https://api.centia.io API_TOKEN=your_token_here npm run dev

Using with MCP Inspector (recommended for local testing)

MCP Inspector lets you connect to the server and try tools interactively.

  1. Start the Inspector UI:
    npx @modelcontextprotocol/inspector -- npx @centia/mcp-server
    
  2. If needed, add environment variables in the Inspector connection dialog (e.g., API_TOKEN).

Using with Claude Desktop

Add the server to your Claude Desktop MCP config (e.g., claude_desktop_config.json).

Using npx (easiest)

{
  "mcpServers": {
    "centia": {
      "command": "npx",
      "args": ["-y", "@centia/mcp-server"]
    }
  }
}

Run gc2 login once and the server will pick up the session. To force a static token instead, add "env": { "API_TOKEN": "YOUR_CENTIA_TOKEN" }.

Using local source

{
  "mcpServers": {
    "centia": {
      "command": "npm",
      "args": ["run", "start"],
      "cwd": "/absolute/path/to/your/mcp-server"
    }
  }
}
  • For development, replace "args": ["run", "start"] with "args": ["run", "dev"].
  • Ensure cwd points to this project directory.

NPM scripts

  • npm run dev — Run TypeScript directly with tsx (hot‑reload style dev loop).
  • npm run build — Compile TypeScript to CommonJS/ESM in dist/ via tsc.
  • npm start — Run the built server (node dist/index.js).

Using AGENTS.md and Skills with AI Coding Agents

This repository includes an AGENTS.md file with global hard rules and a skills/ folder with task-specific guidance for AI coding agents (like Claude Code, Junie, etc.) when working with Centia BaaS.

AGENTS.md contains the core rules (tool priority, security baselines, destructive-ops policy), while each skill in skills/*/SKILL.md covers a specific workflow area.

To ensure your AI agent follows these rules while developing your application:

  1. Copy AGENTS.md and the skills/ folder from this repository to the root of your own application's repository.
  2. When starting a session with your AI agent, it will automatically find and follow the guidelines.

AGENTS.md covers:

  • Prime Directive: Preferring MCP tools and official SDKs.
  • Tool Priority: Order of interaction (MCP tools > SDK > HTTP).
  • Security & Auth: How to handle tokens and OAuth flows correctly.
  • Destructive Operations Policy: Requiring explicit confirmation before destructive changes.

Skills (skills/*/SKILL.md) cover task-specific workflows:

  • centia-runtime-sdk — Building JS/TS runtime code with @centia-io/sdk
  • centia-provisioning — Schema, tables, columns, constraints, indexes, migrations
  • centia-json-rpc — JSON-RPC method lifecycle and TypeScript interfaces
  • centia-auth-model — Auth across browser, backend, CLI, and provisioning
  • centia-types-formats — PostgreSQL types, casts, type hints, output formats
  • centia-file-import — File import workflow
  • centia-openapi-docs — OpenAPI and docs fallback policy
  • centia-delivery — Delivery checklist and quality gate

Troubleshooting

  • Tools missing or inputs look odd: ensure centia-api.json exists and is valid. The server generates tools from this file at startup.
  • 401/403 errors: run gc2 login (or set a valid API_TOKEN in the environment for headless use).
  • JSON Schema validation errors: schemas are auto‑normalized/sanitized for MCP, but if you updated centia-api.json, re-run and check logs for details.
  • ESM/CommonJS issues: this project uses ESM ("type": "module"). Use Node.js 18+ and run scripts via npm as shown above.

License

ISC

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选