# Deny a request to connect an agent

> Page: https://docs.plotwork.dev/api/post-user-mcp-deny. Index of every page: https://docs.plotwork.dev/llms.txt

Records that you said no to a sign-in link, so it cannot be approved afterwards, and answers with the MCP server callback that tells the agent.

`POST /user/mcp/deny`

## TL;DR

| Question | Answer |
|---|---|
| What does it do? | Deny a request to connect an agent. |
| What does it take? | A JSON body of type [`DenyConnectionBody`](https://docs.plotwork.dev/api/schemas.md#denyconnectionbody). |
| What does it return? | Status 200 with a body of type [`Denial`](https://docs.plotwork.dev/api/schemas.md#denial). |
| What can go wrong? | `400` the request is malformed, has expired (mcp.request_expired), or was not signed by the MCP server (mcp.request_invalid); `401` not signed in; `403` the request came from an origin that may not make changes; `409` the sign-in link was already approved or denied (mcp.request_used); `429` too many requests; `503` connecting an agent is not set up on this server. Every failure uses the one error envelope. |

## What it does

Records that you said no to a sign-in link, so it cannot be approved afterwards, and answers with the MCP server callback that tells the agent. Nothing is made. A link already approved or denied is 409 mcp.request_used.

## Request body

The body has the type [`DenyConnectionBody`](https://docs.plotwork.dev/api/schemas.md#denyconnectionbody).

| Field | Type | Required | Description |
|---|---|---|---|
| `request` | `string` | yes | The signed authorization request, exactly as the MCP server put it in the address. at least 1 character; at most 6144 characters. |

## Responses

| Status | Meaning | Body |
|---|---|---|
| 200 | Denied. | [`Denial`](https://docs.plotwork.dev/api/schemas.md#denial) |
| 400 | The request is malformed, has expired (mcp.request_expired), or was not signed by the MCP server (mcp.request_invalid). | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 401 | Not signed in. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 403 | The request came from an origin that may not make changes. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 409 | The sign-in link was already approved or denied (mcp.request_used). | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 429 | Too many requests. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 503 | Connecting an agent is not set up on this server. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |

## Response body

A 200 answer has the type [`Denial`](https://docs.plotwork.dev/api/schemas.md#denial).

| Field | Type | Required | Description |
|---|---|---|---|
| `redirectTo` | `string` | yes | Where to send the browser: the MCP server callback with the request and `error=access_denied` attached. |

## See also

| Doc | Why |
|---|---|
| [API reference](https://docs.plotwork.dev/api/reference.md) | Every endpoint, and the error envelope |
| [Schemas](https://docs.plotwork.dev/api/schemas.md) | Every request and response type |
| [Tool reference](https://docs.plotwork.dev/mcp/tools.md) | The operations as callable tools |
