# Stack Exchange — how to use (mcp.ai)

Stack Exchange is a network of Q&A communities where users ask questions, share knowledge, and collaborate on topics like coding, math, and more

## Option A — via MCP (recommended)
Remote MCP endpoint (HTTP, streamable): `https://api.mcp.ai/p_stack_exchange?ms=1781541780000`
Add it as a custom/remote MCP connector in your client (Claude, Cursor, VS Code…), then authenticate when prompted. Once connected, ask the agent to use the server's tools (e.g. `stack_exchange_get_collective_questions`).

## Option B — via direct REST API
Base URL: `https://api.mcp.ai/api/stack_exchange`
Auth: `Authorization: Bearer sk_live_…` — create a workspace API key at https://mcp.ai/settings/api-keys
Discover endpoints: `GET https://api.mcp.ai/api/stack_exchange/_endpoints`

### Endpoints
- `POST https://api.mcp.ai/api/stack_exchange/get/collective/questions` — Tool to retrieve questions associated with the specified collective. use when you have a collective id and need its questions for a site.
  - body: { id: string, max?: integer, min?: integer, page?: integer, site: string, sort?: string, order?: string, filter?: string, todate?: integer, fromdate?: integer, pagesize?: integer }
- `POST https://api.mcp.ai/api/stack_exchange/get/collective/tags` — Tool to retrieve tags associated with specified collectives. use when you need collective tags for display or analysis after confirming which collectives to query.
  - body: { key?: string, page?: integer, site: string, filter?: string, pagesize?: integer, access_token?: string, collective_ids?: integer[] }
- `POST https://api.mcp.ai/api/stack_exchange/get/collectives` — Tool to retrieve all collectives on a stack exchange site in alphabetical order. use when you need to list collectives for display or filtering.
  - body: { max?: string, min?: string, page?: integer, site: string, sort?: string, order?: string, todate?: integer, fromdate?: integer, pagesize?: integer }
- `POST https://api.mcp.ai/api/stack_exchange/get/comment/flag/options` — Tool to fetch valid flag options for a given comment. use when you need to know which flags a user can raise before submitting. requires authenticated access.
  - body: { ids: string, key?: string, site: string, filter?: string, preview?: boolean, access_token?: string }
- `POST https://api.mcp.ai/api/stack_exchange/get/comments` — Tool to retrieve comments from a specified stack exchange site. use when you need to list comments with optional filters and sorting.
  - body: { max?: integer, min?: integer, page?: integer, site: string, sort?: string, order?: string, filter?: string, todate?: integer, fromdate?: integer, pagesize?: integer }
- `POST https://api.mcp.ai/api/stack_exchange/get/revisions/by/ids` — Tool to retrieve revisions for specific posts by their ids. use when you need to examine the edit history of posts by providing semicolon-delimited ids.
  - body: { ids: string, page?: integer, site: string, filter?: string, todate?: integer, fromdate?: integer, pagesize?: integer }
- `POST https://api.mcp.ai/api/stack_exchange/get/search/results` — Tool to search the site for questions meeting certain criteria. use after defining tags or keywords to locate relevant questions. at least one of 'tagged' or 'intitle' must be set.
  - body: { key?: string, max?: integer, min?: integer, page?: integer, site: string, sort?: string, order?: string, filter?: string, tagged?: string[], todate?: integer, intitle?: string, fromdate?: integer, pagesize?: integer, nottagged?: string[], access_token?: string }
- `POST https://api.mcp.ai/api/stack_exchange/get/sites` — Tool to retrieve all stack exchange sites and their api site parameter values. use when you need to discover available sites for api calls.
  - body: { page?: integer, filter?: string, pagesize?: integer }

## More
- Page: https://mcp.ai/stack_exchange
- Agent spec (llms.txt): https://mcp.ai/stack_exchange/llms.txt
- Postman collection: https://mcp.ai/stack_exchange/postman.json
