Codex CLI
Use an environment-backed bearer token so the token does not live in the config file.
export LAWS_SG_MCP_TOKEN=laws_sg_REPLACE_WITH_YOUR_TOKEN
codex mcp add laws-sg --url https://laws.sg/api/mcp --bearer-token-env-var LAWS_SG_MCP_TOKENMCP connect
Add laws.sg as an MCP server so Claude, Cursor, and other assistants can search and cite Singapore legislation directly, using your personal access token.
Create a personal MCP token from your account. Tokens are shown once and can be revoked any time.
Manage tokenshttps://laws.sg/api/mcp{
"mcpServers": {
"laws.sg": {
"type": "streamable-http",
"url": "https://laws.sg/api/mcp",
"headers": {
"Authorization": "Bearer laws_sg_REPLACE_WITH_YOUR_TOKEN"
}
}
}
}Use an environment-backed bearer token so the token does not live in the config file.
export LAWS_SG_MCP_TOKEN=laws_sg_REPLACE_WITH_YOUR_TOKEN
codex mcp add laws-sg --url https://laws.sg/api/mcp --bearer-token-env-var LAWS_SG_MCP_TOKENAdd the remote HTTP server with an Authorization header.
export LAWS_SG_MCP_TOKEN=laws_sg_REPLACE_WITH_YOUR_TOKEN
claude mcp add --transport http laws-sg https://laws.sg/api/mcp --header "Authorization: Bearer ${LAWS_SG_MCP_TOKEN}"Use mcp.json with a streamable HTTP server and a token environment variable.
{
"mcpServers": {
"laws.sg": {
"type": "streamable-http",
"url": "https://laws.sg/api/mcp",
"headers": {
"Authorization": "Bearer ${LAWS_SG_MCP_TOKEN}"
}
}
}
}Prompt for the token at runtime and pass it as an Authorization header.
{
"inputs": [
{
"type": "promptString",
"id": "laws-sg-mcp-token",
"description": "laws.sg MCP token",
"password": true
}
],
"servers": {
"laws.sg": {
"type": "http",
"url": "https://laws.sg/api/mcp",
"headers": {
"Authorization": "Bearer ${input:laws-sg-mcp-token}"
}
}
}
}