Risha.ai MCP Server

Risha.ai MCP Server

MCP server for the Risha.ai API enabling authentication, capability discovery, credit balance checks, and generation requests with automatic polling.

Category
访问服务器

README

Risha.ai MCP Server

A Model Context Protocol (MCP) server for the Risha.ai API.

This server lets MCP clients such as Codex, Claude Code, and Claude Desktop discover Risha API operations, authenticate with email/password, inspect capabilities, check credit balance and create generation requests.

Features

  • Email/password authentication using Risha /auth/login/
  • Automatic login at MCP startup
  • Automatic startup context loading:
    • current user
    • active capabilities
    • credit wallet / balance
  • Generic Swagger-backed API caller for all Risha operations
  • Convenience generation helpers:
    • risha_generate_image
    • risha_create_generation
  • Automatic polling for generation completion

Requirements

  • Node.js 18+
  • A valid Risha.ai account (www.risha.ai)
  • An MCP-capable client, for example:
    • Codex
    • Claude Code
    • Claude Desktop

Install

git clone https://github.com/aimedialab/risha-mcp-server.git
cd risha-mcp-server
npm install

Environment variables

Required for email/password login:

RISHA_EMAIL="you@example.com"
RISHA_PASSWORD="your-password"

Optional:

RISHA_API_BASE_URL="https://adminxcore-api.risha.ai/api"

Token-based auth is also supported, but email/password is the recommended flow:

RISHA_API_TOKEN="your-access-token"
RISHA_REFRESH_TOKEN="your-refresh-token"

Never commit real credentials. Put them in your MCP client config or a local .env file. .env is ignored by git.

Run manually

RISHA_EMAIL="you@example.com" RISHA_PASSWORD="your-password" npm start

Expected startup log:

[risha-mcp] logged in, loaded 32 capabilities, credit balance: 72621

An MCP stdio server normally waits silently after startup. That is expected.

Available MCP tools

risha_api_info

Shows API metadata, authentication mode, startup status, capabilities count, credit balance, and Swagger tag list.

risha_startup_state

Shows the context loaded at startup:

  • login state
  • current user
  • capabilities count
  • credit balance
  • startup errors, if any

risha_capabilities

Returns the active capabilities retrieved at startup.

Input example:

{
  "filter": "image",
  "limit": 20
}

risha_credit_balance

Returns credit balance, wallet, summary, and user wallet data.

risha_refresh_context

Logs in again and refreshes current user, capabilities, and credit data.

risha_login

Manually logs in with RISHA_EMAIL and RISHA_PASSWORD and caches the JWT for the current MCP session.

risha_list_operations

Searches all Swagger operations.

Input example:

{
  "filter": "generation",
  "limit": 20
}

risha_get_operation

Returns schema details for one operation.

Input example:

{
  "operationId": "generation-requests_create"
}

risha_call

Generic caller for any Swagger operation.

Input example:

{
  "operationId": "auth_me"
}

Generation request example:

{
  "operationId": "generation-requests_create",
  "body": {
    "capability": 21,
    "title": "MCP smoke test",
    "prompt_data": {
      "prompt": "a red apple on a white table",
      "resolution": "0.5k",
      "aspect_ratio": "1:1"
    }
  }
}

risha_create_generation

Creates any generation request and optionally polls until it reaches a terminal state.

Input example:

{
  "capability": 21,
  "title": "MCP image test",
  "prompt_data": {
    "prompt": "a red apple on a white table",
    "resolution": "0.5k",
    "aspect_ratio": "1:1"
  },
  "wait": true,
  "timeoutSeconds": 300,
  "pollSeconds": 5
}

risha_generate_image

Convenience text-to-image tool. Defaults to capability 21, 0.5k, 1:1.

Input example:

{
  "prompt": "a cinematic photo of a red apple on a white table",
  "resolution": "0.5k",
  "aspect_ratio": "1:1",
  "timeoutSeconds": 300,
  "pollSeconds": 5
}

risha_resolve_media_url

Converts a private authenticated Risha media URL into a signed public CDN URL.

Input example:

{
  "url": "https://adminxcore-api.risha.ai/api/media/asset/4c6cbe1c-7696-4c13-8790-6456e5d64698/?f=webp&h=600&q=85&w=600"
}

Use with Codex

Codex reads MCP servers from ~/.codex/config.toml.

Add this block:

[mcp_servers.risha]
command = "node"
args = ["/absolute/path/to/risha-mcp-server/src/index.js"]
startup_timeout_sec = 60

[mcp_servers.risha.env]
RISHA_EMAIL = "you@example.com"
RISHA_PASSWORD = "your-password"

For the local project path created by this agent:

[mcp_servers.risha]
command = "node"
args = ["/Users/amirhamdani/Documents/risha-mcp-server/src/index.js"]
startup_timeout_sec = 60

[mcp_servers.risha.env]
RISHA_EMAIL = "you@example.com"
RISHA_PASSWORD = "your-password"

Restart Codex after editing the config.

Codex test prompts

Use the Risha MCP server and run risha_api_info.
Use the Risha MCP server and show my Risha credit balance.
Use the Risha MCP server and list image capabilities.
Use Risha MCP to generate a small image of a red apple on a white table.

Use with Claude Code

Claude Code supports MCP servers over stdio. You can add the server using either the CLI or JSON configuration.

Option A: Claude Code CLI

From the project directory:

claude mcp add risha \
  --env RISHA_EMAIL="you@example.com" \
  --env RISHA_PASSWORD="your-password" \
  -- node /absolute/path/to/risha-mcp-server/src/index.js

Then restart Claude Code or start a new session.

Test prompts:

Use the risha MCP server and run risha_api_info.
Use the risha MCP server to show my credit balance.
Use the risha MCP server to generate a small image of a robot holding a camera.

Option B: Claude MCP JSON config

If your Claude Code setup uses JSON MCP configuration, add:

{
  "mcpServers": {
    "risha": {
      "command": "node",
      "args": ["/absolute/path/to/risha-mcp-server/src/index.js"],
      "env": {
        "RISHA_EMAIL": "you@example.com",
        "RISHA_PASSWORD": "your-password"
      }
    }
  }
}

Use with Claude Desktop

Add this to your Claude Desktop MCP config:

{
  "mcpServers": {
    "risha": {
      "command": "node",
      "args": ["/absolute/path/to/risha-mcp-server/src/index.js"],
      "env": {
        "RISHA_EMAIL": "you@example.com",
        "RISHA_PASSWORD": "your-password"
      }
    }
  }
}

Restart Claude Desktop after editing the config.

Test with MCP Inspector

cd risha-mcp-server
npx @modelcontextprotocol/inspector \
  env RISHA_EMAIL="you@example.com" RISHA_PASSWORD="your-password" \
  node src/index.js

Open the Inspector URL printed in the terminal and try:

  1. risha_api_info
  2. risha_credit_balance
  3. risha_capabilities
  4. risha_generate_image

Typical workflow for agents

  1. Call risha_api_info to confirm authentication and startup state.
  2. Call risha_credit_balance to check credits.
  3. Call risha_capabilities to pick a capability.
  4. Use risha_generate_image for simple image generation, or risha_create_generation for arbitrary capabilities.
  5. Use returned public CDN URLs directly. Private media URLs are resolved automatically when possible.

Notes on generation time

Image/video generation is asynchronous. The MCP server can create a request immediately, but final completion depends on provider queue and model runtime. risha_generate_image and risha_create_generation poll until completion or timeout.

Default polling values:

  • timeoutSeconds: 300
  • pollSeconds: 5

Development

npm install
node --check src/index.js
npm start

Project layout:

risha-mcp-server/
  src/
    index.js       # MCP server implementation
    swagger.json   # Risha Swagger/OpenAPI document
  package.json
  README.md

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

官方
精选