TimeLib MCP
Enables AI agents to manage products, inventory, collections, orders, and customers in a Medusa v2 store via the Admin API.
README
TimeLib MCP — AI agent for your Medusa store
An MCP server that lets an AI agent (Claude Desktop, Claude Code, or any MCP client) add and manage products — plus inventory, collections/categories, orders and customers — in your TimeLib Medusa v2 store via the Admin API.
You just chat, e.g.:
"Add a product called Chrono Field Watch, a draft, with S/M/L bands at $180, 20 in stock each, in the Watches collection."
and the agent creates it.
What the agent can do
| Area | Tools |
|---|---|
| Orientation | get_store_context (regions, currencies, sales channels, locations) |
| Products | list_products, get_product, create_product, update_product, delete_product |
| Variants | create_variant, update_variant, delete_variant |
| Inventory | list_inventory_items, set_inventory_level |
| Catalog | list_collections, create_collection, list_categories, create_category, list_product_tags, list_product_types |
| Orders / Customers | list_orders, get_order, list_customers |
| Anything else | medusa_admin_request (raw Admin API escape hatch) |
Setup (one time)
1. Install
cd timelib-mcp
npm install
2. Configure credentials
cp .env.example .env
Open .env. MEDUSA_BACKEND_URL is already filled in. You need admin
credentials. Two options:
Option A — Secret API key (recommended: non-expiring, revocable, no password stored).
Temporarily put your Medusa admin email + password in .env, then:
npm run create-key
Copy the printed token into MEDUSA_ADMIN_API_KEY in .env, then delete the
email/password lines.
Option B — Email + password. Just set MEDUSA_ADMIN_EMAIL and
MEDUSA_ADMIN_PASSWORD in .env and leave MEDUSA_ADMIN_API_KEY empty. The
server logs in and refreshes the token automatically.
3. Test the connection
npm run smoke
You should see ✅ Auth OK and a few product titles.
Connect it to Claude
Claude Code (CLI)
claude mcp add timelib -- node "C:\Users\dashi\Desktop\Projects\TimeLib\timelib-mcp\src\index.mjs"
(Credentials are read from timelib-mcp/.env, so you don't need to pass them on
the command line. To pass them explicitly instead, add -e MEDUSA_BACKEND_URL=... -e MEDUSA_ADMIN_API_KEY=... before the --.)
Verify with claude mcp list, then in a session ask: "What tools does timelib expose?"
Claude Desktop
Edit %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"timelib": {
"command": "node",
"args": ["C:\\Users\\dashi\\Desktop\\Projects\\TimeLib\\timelib-mcp\\src\\index.mjs"]
}
}
}
Restart Claude Desktop. The 🔌 icon should show the timelib tools.
Hosting the server (remote / always-on)
The server has two entrypoints that share the same tools:
| Entrypoint | Command | Use |
|---|---|---|
| Local (stdio) | node src/index.mjs |
Claude launches it on your machine |
| Hosted (HTTP) | node src/http-server.mjs |
Runs as a web service; clients connect over HTTPS |
The hosted server exposes MCP at POST /mcp and is protected by a static bearer
token (MCP_AUTH_TOKEN). It refuses to start without one.
Deploy to Railway (new service in the TimeLib project)
- Push
timelib-mcp/to a Git repo (GitHub). - In your existing TimeLib Railway project → New → GitHub Repo → pick this repo
(set the root directory to
timelib-mcpif it lives in a monorepo). - Railway reads
railway.jsonand runsnode src/http-server.mjs. - Add these Variables in the service:
MEDUSA_BACKEND_URL=https://timelib-production.up.railway.appMEDUSA_ADMIN_API_KEYorMEDUSA_ADMIN_EMAIL+MEDUSA_ADMIN_PASSWORDMCP_AUTH_TOKEN= a long random secret (see below)- (
PORTis injected by Railway automatically.)
- Under Settings → Networking, generate a public domain. You'll get a URL like
https://timelib-mcp-production.up.railway.app. Your MCP endpoint is that URL +/mcp.
Generate a token:
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
Sanity-check the deploy:
curl https://YOUR-MCP-DOMAIN.up.railway.app/ # -> {"name":"timelib-mcp","status":"ok",...}
Connect clients to the hosted server
Claude Code (CLI) — native HTTP transport with a header:
claude mcp add --transport http timelib-remote https://YOUR-MCP-DOMAIN.up.railway.app/mcp \
--header "Authorization: Bearer YOUR_MCP_AUTH_TOKEN"
Claude Desktop — use the mcp-remote bridge (no native header field in the UI):
{
"mcpServers": {
"timelib-remote": {
"command": "npx",
"args": [
"mcp-remote",
"https://YOUR-MCP-DOMAIN.up.railway.app/mcp",
"--header", "Authorization: Bearer YOUR_MCP_AUTH_TOKEN"
]
}
}
}
Claude.ai web / mobile — uses OAuth (see next section). No token to paste; you approve access with your owner password in the browser.
OAuth for claude.ai web / mobile
claude.ai custom connectors authenticate via OAuth, not a static token. The hosted server implements a full OAuth 2.1 flow (metadata discovery, dynamic client registration, authorize + token endpoints, PKCE, refresh tokens). It's stateless — client registrations and tokens are signed JWTs, so it survives Railway redeploys with no database. Access is gated by a single owner password.
Enable it
Add two more variables to the Railway service and redeploy:
OWNER_PASSWORD = <a password you'll type to approve access>
OAUTH_JWT_SECRET = <64+ random hex chars: node -e "console.log(require('crypto').randomBytes(48).toString('hex'))">
PUBLIC_URL is auto-detected from Railway's RAILWAY_PUBLIC_DOMAIN. The static
MCP_AUTH_TOKEN keeps working for Claude Code/Desktop at the same time.
Connect claude.ai
- claude.ai → Settings → Connectors → Add custom connector.
- URL:
https://YOUR-MCP-DOMAIN.up.railway.app/mcp - Claude discovers the OAuth endpoints and opens a login page → enter your
OWNER_PASSWORD→ Authorize. - The
timelibtools appear in claude.ai (web and mobile).
Health check shows which modes are active:
curl https://YOUR-MCP-DOMAIN.up.railway.app/ # -> "auth":{"static_token":true,"oauth":true}
Notes & safety
- Prices are in major currency units in Medusa v2 (e.g.
25= $25.00, not cents). - New products default to
draft. Ask the agent to setstatus: "published"(or useupdate_product) to make them live. - Destructive actions (
delete_product, deletes viamedusa_admin_request) are permanent — the agent is instructed to confirm with you first, but review before approving. - The secret API key has full admin access. Keep
.envout of version control (already in.gitignore) and revoke the key in the Medusa admin if it leaks. - Product images are passed as public URLs. To upload local files first, use the Medusa admin UI or extend the server with the
/admin/uploadsendpoint viamedusa_admin_request. - Hosted server = full admin access behind one token. Anyone with the
MCP_AUTH_TOKENand the URL can manage your store. Use a long random token, store it only in Railway variables + your client config, and rotate it (change the variable, redeploy) if it leaks. - OAuth secrets:
OWNER_PASSWORDis your login to approve claude.ai access — make it strong. ChangingOAUTH_JWT_SECRET(or a redeploy that loses it) invalidates all issued tokens and registered connectors, so clients must reconnect. Keep it stable in Railway variables.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。