Cin7 Core Meta MCP Server

Cin7 Core Meta MCP Server

Enables AI to dynamically discover and invoke any Cin7 Core API endpoint using three generic tools (list, describe, invoke) plus a bug-report tool, covering the entire API surface without predefined endpoints.

Category
访问服务器

README

Cin7 Core Meta MCP Server

This is a Model Context Protocol (MCP) server for the Cin7 Core (DEAR) API. Instead of exposing one tool per Cin7 endpoint, this server exposes three generic API-walking tools plus a structured bug-report tool. The model finds what it needs at runtime: list endpoints → read an endpoint's schema → invoke it.

It's a sibling to mcp-cin7-core — that server ships hand-curated tools (cin7_products, cin7_create_purchase_order, …) for common operations. This one covers the full Cin7 Core API surface (Brands, Categories, Carriers, Chart of Accounts, Disassembly, Finished Goods, anything Cin7 ships) with a tiny tool list that doesn't grow as the API grows. Both servers can be installed in the same client; they're complementary.

Features

  • Four MCP tools that cover the full Cin7 Core REST API surface
  • API-walking pattern (list → describe → invoke) keeps the tool list tiny
  • Request validation against a vendored API Blueprint spec — unknown endpoints, wrong methods, missing required params, and type mismatches are caught before any network call
  • Rate-limit passthrough — Cin7's X-RateLimit-Remaining header is surfaced so the model can self-throttle
  • Structured bug-report tool — appends ISSUE_REPORT <json> to both a controlled file and stderr
  • ScaleKit OAuth 2.0 / Streamable HTTP transport for remote deployments
  • Stdio transport for local Claude Desktop integration
  • MCP protocol compliance

Prerequisites

  • Python 3.10+
  • uv package manager
  • A Cin7 Core (DEAR) account with API access — get your AccountID and Application Key from Integrations → API

Docs and Links

Setup

Get Cin7 Core API credentials

  1. Log in to Cin7 Core (DEAR)
  2. Navigate to Integrations → API
  3. Copy the AccountID and create/copy the Application Key

Authentication

There are 2 modes of running the Cin7 Core Meta MCP server:

1. Streamable HTTP with OAuth (Recommended for production)

This mode runs the server as a web service with OAuth 2.0 authentication via ScaleKit. This is the recommended approach for shared or remote deployments, including connecting via Claude Desktop's remote MCP connector.

Required environment variables:

  • CIN7_ACCOUNT_ID - Your Cin7 AccountID
  • CIN7_API_KEY - Your Cin7 Application Key
  • SCALEKIT_ENVIRONMENT_URL - ScaleKit environment URL (e.g., https://yourapp.scalekit.com)
  • SCALEKIT_CLIENT_ID - ScaleKit application client ID
  • SCALEKIT_CLIENT_SECRET - ScaleKit application client secret
  • SCALEKIT_RESOURCE_ID - ScaleKit resource identifier (e.g., res_xxx)
  • SCALEKIT_INTERCEPTOR_SECRET - Secret for verifying interceptor payloads
  • SERVER_URL - Your MCP server's public URL (e.g., https://your-server.example.com)

Optional:

  • ALLOWED_EMAILS - Comma-separated list of allowed email addresses (leave empty to allow all authenticated users)
  • CIN7_BASE_URL - Override the Cin7 base URL (default https://inventory.dearsystems.com/ExternalApi/v2/)
  • ISSUE_REPORT_PATH - Where report_issue appends its ISSUE_REPORT <json> lines (default ./data/issue_reports.log)
  • MCP_LOG_LEVEL - Logging level (default INFO)
  • MCP_LOG_FILE - Enable file logging with rotation

Running the server:

uv run python -m cin7_meta.server_http

Endpoints:

  • GET /health - Health check (no auth required)
  • GET /.well-known/oauth-protected-resource - OAuth discovery (no auth required)
  • POST /mcp - MCP endpoint (requires OAuth 2.0 Bearer token)

Connecting from Claude Desktop (remote):

  1. Deploy your server (e.g., to Render — see render.yaml)
  2. Open Claude Desktop > Settings > Connectors
  3. Click "Add Connector" and enter your server URL: https://your-server.com/mcp
  4. Claude will auto-discover OAuth configuration
  5. Click "Authorize" and log in

See CLAUDE.md for detailed ScaleKit setup and interceptor configuration.

2. Stdio Transport (Local development)

This mode runs the server locally using stdio transport for direct integration with Claude Desktop. No OAuth configuration needed — Cin7 credentials are used directly.

Required environment variables:

  • CIN7_ACCOUNT_ID
  • CIN7_API_KEY

Optional: CIN7_BASE_URL, ISSUE_REPORT_PATH, MCP_LOG_LEVEL, MCP_LOG_FILE.

Claude Desktop configuration:

Add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "cin7-meta": {
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/mcp-cin7-meta",
        "run",
        "python",
        "-m",
        "cin7_meta.server_stdio"
      ],
      "env": {
        "CIN7_ACCOUNT_ID": "your-account-id",
        "CIN7_API_KEY": "your-application-key"
      }
    }
  }
}

Replace /absolute/path/to/mcp-cin7-meta with the actual path to your clone of this repository.

If you're running both servers together, give them distinct names (e.g. cin7-core for the curated server and cin7-meta for this one) so Claude lists their tools separately.

Installation

# Create virtual environment and install dependencies
uv venv
uv pip install -e .

# Quick import check
uv run python -c "import cin7_meta.server; print('OK')"

Vendor the API Blueprint spec (one-time)

This server validates requests against a vendored API Blueprint that ships at cin7_meta/spec/cin7_v2.apib, plus a derived normalized JSON catalog at cin7_meta/spec/cin7_v2.json. A fresh clone won't have these — generate them:

uv run python scripts/refresh_spec.py

Re-run any time the Cin7 API changes or you want to pick up new endpoints. See docs/spec_refresh.md for the full workflow.

Testing with MCP Inspector

# Start the HTTP server
uv run python -m cin7_meta.server_http

# In another terminal, open MCP Inspector
npx @modelcontextprotocol/inspector http://localhost:3000/mcp

Available MCP Tools

API walking:

  • list_api_endpoints(keyword, methods, limit) — Ranked keyword search across endpoint paths, summaries, groups, and parameter names. Returns {"results": [...], "total": int, "truncated": bool}.
  • get_api_endpoint_schema(method, path) — Return the full schema for one endpoint: query params (with types and defaults), request body schema, response schema, and JSON examples.

Execution:

  • invoke_api_endpoint(method, path, query_params, body) — Validate, then execute, an arbitrary Cin7 Core API call. Validation errors (unknown endpoint, wrong method, missing required param, type mismatch) are returned without a network call. Returns {"status", "data", "rate_limit_remaining"} — use rate_limit_remaining for self-throttling.

Issue reporting:

  • report_issue(summary, tool_name, tool_arguments, observed_behavior, expected_behavior, ...) — File a structured bug report when a tool doesn't behave as expected. Each report is appended as one ISSUE_REPORT <json> line to data/issue_reports.log and emitted on stderr in the same format, so reports survive even on hosts with ephemeral filesystems (Render's log stream captures the stderr line). Returns a report_id the model can quote in follow-ups.

For detailed signatures, examples, and return shapes, see docs/tools.md.

For the underlying Cin7 Core API documentation, refer to the Cin7 Core API Reference.

For Developers

Running Tests

# Full test suite
uv run pytest -v

# Quick pass/fail check
uv run pytest --tb=short

# Specific test file
uv run pytest tests/test_invoke_api_endpoint.py -v

Contributing — Test-Driven Development

This project follows a strict test-driven development (TDD) workflow. Every utility and tool was implemented test-first:

  1. Add fixtures to tests/fixtures/ — either using the small hand-rolled mini_spec.py (fast, deterministic) or the vendored cin7_v2.json for contract tests
  2. Write failing tests — unit tests against the mini spec, contract tests against the real vendored spec where relevant
  3. Implement to make the tests pass

No new code should be merged without corresponding test coverage. See CLAUDE.md for detailed test patterns, the mock_cin7 fixture, and the EXPECTED_TOOLS registration assertion.

Architecture

  • cin7_client.py - Async REST client for the Cin7 Core API with retry and error handling (ported from mcp-cin7-core)
  • spec_loader.py - Loads the vendored normalized JSON catalog at startup, builds the in-memory endpoint and search indexes
  • spec_parser.py - Parses API Blueprint markdown into the normalized JSON catalog (used by scripts/refresh_spec.py)
  • spec_search.py - Ranked substring search over the spec index (exact path > prefix > substring > summary/param-name match)
  • validator.py - Validates query params (unknowns, required, types) and body (required fields) against the loaded spec; returns structured error responses instead of raising
  • issue_reporter.py - Single-function entry point for report_issue storage — appends one ISSUE_REPORT <json> line to a controlled file and to stderr
  • session_store.py - In-memory session storage with TTL (ported)
  • server.py - FastMCP server with the four tool registrations
  • server_http.py - Starlette wrapper with MCP Streamable HTTP transport and ScaleKit OAuth (ported)
  • server_stdio.py - Stdio transport for local Claude Desktop integration
  • resources/ - Tool implementations (endpoints.py, invoke.py, issues.py)
  • utils/ - Shared utilities

See CLAUDE.md for comprehensive development documentation, test patterns, and architecture details.

Security

Do not commit your .env file or any Cin7 API credentials to version control (it is included in .gitignore as a safe default).

Issue reports written by report_issue may contain raw request bodies, query parameters, and response excerpts — review data/issue_reports.log before sharing it with anyone outside the project.

License

MIT

推荐服务器

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

官方
精选