Import jpcite into OpenAI Codex CLI / Agents SDK in one line
from agents import Agent, HostedMCPTool plus HostedMCPTool(tool_config={'type':'mcp','server_label':'jpcite','server_url':'https://api.jpcite.com/mcp','require_approval':'never'}) binds 261 MCP tools. Anonymous free 3 req/IP/day; paid metered at ¥3/billable unit excl. tax.
Five-minute setup
- Install openai-agents:
pip install openai-agents(Python 3.10+). - Build jpcite with HostedMCPTool: write
mcp_tool = HostedMCPTool(tool_config={'type': 'mcp', 'server_label': 'jpcite', 'server_url': 'https://api.jpcite.com/mcp', 'require_approval': 'never'})in a single line. - Bind it to an Agent:
agent = Agent(name='jp_subsidy', tools=[mcp_tool])binds all 261 MCP tools to the Agent. - (Optional) Pass an API key: add
'headers': {'X-API-Key': os.environ.get('JPCITE_API_KEY', '')}totool_configto upgrade to metered mode. Omit it to stay on the anonymous free tier. - Verify: in the next section, confirm that
Runner.run_sync(agent, input='...')answers through the 261 MCP tools.
Copy-paste snippet
A 30-line sample that defines the Agent and runs through a search_programs call.
import os
from agents import Agent, HostedMCPTool, Runner
# 1) Build the jpcite hosted MCP endpoint as a HostedMCPTool
mcp_tool = HostedMCPTool(
tool_config={
"type": "mcp",
"server_label": "jpcite",
"server_url": "https://api.jpcite.com/mcp",
"require_approval": "never",
"headers": {
# On the anonymous free tier (3 req/IP/day) you can drop "headers" entirely
"X-API-Key": os.environ.get("JPCITE_API_KEY", ""),
},
},
)
# 2) Bind the jpcite tools to an Agent
agent = Agent(
name="jp_subsidy",
instructions=(
"You are an assistant for Japanese subsidies, regulations, and tax. "
"Always call the jpcite tools and cite source_url and fetched_at in your answer. "
"Do not provide individualized tax or legal advice (e.g., Certified Tax Accountant Act §52, "
"Attorney Act §72); only cite general information and recommend consulting a professional."
),
tools=[mcp_tool],
)
# 3) Run it
result = Runner.run_sync(
agent,
input="List 3 of the latest manufacturing subsidies in Tokyo (ものづくり補助金), with source_url",
)
print(result.final_output)
Verification
Send ものづくり補助金 東京都 through the Agent and confirm that the answer comes back via the jpcite tools with a source_url. There are 261 public tools; generation of 36-Agreement labor documents is not offered publicly.
python -c "import os; from agents import Agent, HostedMCPTool, Runner; \
t = HostedMCPTool(tool_config={'type':'mcp','server_label':'jpcite','server_url':'https://api.jpcite.com/mcp','require_approval':'never'}); \
a = Agent(name='probe', tools=[t]); \
print(Runner.run_sync(a, input='ものづくり補助金 東京都').final_output)"
Expected: a response that includes a subsidy name plus a source_url. Confirm the tools list (261) separately on the server side with curl -s https://api.jpcite.com/mcp/tools | jq 'length'.
When smoke-testing the REST endpoint directly, always use -G --data-urlencode. Embedding a Japanese query straight into the URL breaks the HTTP request line, and the API returns {"error":{"code":"bad_request",...,"hint":"Use --data-urlencode for non-ASCII query params..."}}.
curl -G "https://api.jpcite.com/v1/programs/search" \
--data-urlencode "q=ものづくり補助金" \
--data-urlencode "prefecture=東京都" \
-H "X-API-Key: ${JPCITE_API_KEY:-}"
FAQ
REST direct vs MCP — which is better?
If you are wiring it into an Agent loop, MCP (HostedMCPTool) is recommended: the tools schema is expanded into the SDK automatically and stays compatible with the Agent's function calls. For script-style processing, calling REST directly (https://api.jpcite.com/v1/...) is also fine.
How do I issue an API key?
Issue one from /en/pricing.html#api-paid via Stripe Checkout (consent is in custom_text.submit.message). The anonymous free tier is capped at 3 req/day per IP; paid is metered at ¥3/billable unit excl. tax with no cap.
What is the 8-profession legal fence?
jpcite does not return individualized advice that would intrude on the exclusive practice areas under the Certified Tax Accountant Act §52, the Attorney Act §72, and similar statutes. See /en/legal-fence.html, and state it in your Agent's instructions as well.