MCP servers
How to register Model Context Protocol servers in Cognipeer, test their tools, and expose them to agents. The endpoint contract is in the MCP API reference.
An MCP server in Cognipeer is a gateway: Cognipeer holds the definition and the credentials, discovers the tools, and serves them over the Model Context Protocol. Your agents bind it, and so can any external MCP client (an IDE, another agent platform) with an API token.
Open Build → MCP Servers (/dashboard/mcp). Its pages are listed under it in the left menu: Servers, MCP Hubs (Enterprise, see MCP Hub) and Monitor.
This page is about the project's shared servers. A server can also be created inside one agent and belong to it; see MCP servers of one agent.
Where the tools come from
New MCP server asks for a Source type. The form fields of the three classic sources are listed in Build and publish an agent; in short:
| Source type | What Cognipeer does | API sourceType |
|---|---|---|
| OpenAPI spec | Parses an OpenAPI or Postman document (paste, upload or fetch from a URL) and turns each operation into a tool that calls your upstream API | openapi |
| Remote MCP URL | Connects to an MCP server you already run (Streamable HTTP or SSE), discovers its tools and proxies calls | remote |
| npx / uvx package | Launches an MCP package (npx or uvx) with its arguments and environment variables. Stateless subprocess is the community execution mode; Persistent sandbox needs the sandbox module in the package | stdio |
| Internal service | Publishes a Cognipeer capability as MCP tools without writing a spec. The providers registered in this build are Knowledge Base (a Knowledge Engine module: search, read_document, read_document_lines), Agent Observability and Browser (a browser profile: browser_open_session and the Browser Use tools) and, in Enterprise, Sandbox and Persistent sandbox (see Sandbox over MCP) | internal |
| Composite (other servers) | Republishes the tools of other MCP servers of the same workspace under one endpoint | composite |
The five values are accepted by the dashboard API (POST /api/mcp). The client API (POST /api/client/v1/mcp) creates openapi, remote and stdio servers only.
Upstream authentication
OpenAPI and remote servers authenticate to their upstream with None, Bearer token, Custom header (name and value), Basic auth (username and password), OAuth 2.0 (see OAuth 2.0 for a remote server) or Console identity: no stored secret, every call carries a short-lived token Cognipeer signs for the person behind it (see Console identity). Secrets are encrypted at rest and masked in every response. Environment variables of an npx/uvx package are sealed the same way.
OAuth 2.0 for a remote server
Choose OAuth 2.0 when the upstream MCP server (or API) signs people in with any OAuth 2.0 authorization server. Cognipeer signs in and renews the access token itself; nobody pastes a token.
| Setting | What it does |
|---|---|
| Grant | Authorization code: a person signs in, or Client credentials: server to server (the client credentials grant needs a client secret). |
| Discover from the server | Reads the authorization server from the MCP server URL (RFC 9728 and RFC 8414) and fills the endpoints, scopes and client settings. Enter the MCP server URL first. |
| Client | I have a client ID, or Register Cognipeer automatically (dynamic registration) when the authorization server offers it. |
| Client ID, Client secret, Scopes | The secret is optional for a public client (PKCE only). Keep the masked value to keep the stored secret. Scopes are separated by spaces. |
| Client authentication | Secret in the request (client_secret_post), HTTP Basic (client_secret_basic) or None: public client with PKCE. |
| Resource indicator | RFC 8707, sent with the sign-in and token requests. Leave it empty if the authorization server does not take it. |
| Redirect URI | Copy it and register that exact address as the callback URL of the OAuth client. |
| Whose account | Shared: one account for everyone (an MCP administrator connects it), Each person's own account, or Each person's own, else the shared account. |
The authorization, token, revocation and registration addresses must be https. Changing the client, the authorization server or the server URL disconnects the server: connect it again after saving.
On the server page, the OAuth connection card shows the state (Not connected, Connected, Needs reconnect) with Connect, Reconnect, Disconnect (stored tokens are deleted and, where the server offers it, revoked) and Test connection. Connecting and disconnecting a shared connection needs MCP admin permission. For a server where each person uses their own account, People's connections lists who connected; tokens are never shown, and an administrator can remove one person's connection or all of them.
A call that needs a connection that is missing or expired fails with "OAuth sign-in required". In a portal the paused agent turn waits (up to 900 seconds by default) for the person to finish signing in, then goes on. Every person manages their own connections under My account → Connected accounts (/dashboard/account/connections): Connect, Reconnect and Disconnect per server, for the servers that work with their own account.
Operators set the defaults with environment variables, see Configuration.
Composite servers
A composite is useful when an agent or an IDE should see one endpoint instead of five. For each member you choose a server, an optional tool prefix (default: the member's key) and Always prefix. Member tools keep their own authentication, their own enable/disable and rename overrides, their own request logs and their own guardrail binding; the composite only decides which tools are included and under which name. A tool is prefixed when its name would collide with another member's, or always when Always prefix is on.
Do not make a composite public by accident
Cognipeer marks a member that is backed by an internal service (a Knowledge Base, Agent Observability) so that you are warned before the composite is exposed publicly. A public endpoint needs no token.
A composite that includes a Browser member cannot be public at all: a browser reaches whatever address Cognipeer can, so a browser server and every composite that includes one take an API token only.
Expose the server
The Endpoint exposure section of the form decides how callers reach the server:
| Setting | Options |
|---|---|
| Protocols | Streamable HTTP (JSON-RPC) and SSE (legacy); at least one stays on |
| Access mode | API token required (default) or Public URL (no auth); a browser server, and a composite with a browser member, take an API token only |
| Custom path | Public servers only. Leave blank for a random unguessable path, or set your own stable one: unique within the workspace, at least 8 characters (letters, numbers, hyphens) |
Token-authenticated callers use /api/client/v1/mcp/{serverKey}/...: GET /execute lists the tools, POST /execute runs one, GET /sse and POST /message speak the MCP protocol (version 2024-11-05). A public server is served at /api/public/mcp/{tenantId}/{endpointSlug}/sse and /message. The wire format is documented in the MCP API reference.
Public means anyone with the URL
A Public URL server runs without a token. Anyone who learns the path can call its tools with your upstream credentials. Use it only for tools that are safe to publish, and prefer a random path over a memorable one.
Change a server's key
Each server has a key, shown as Server Key on its Overview tab (the pencil icon changes it). The key is the identifier in the API path (/api/client/v1/mcp/{serverKey}) and the one agents bind by. Set your own key when you create the server through the API (key), or rename it later. Renaming asks for confirmation first because every agent bound to the old key stops resolving it. Keys are slugified and made unique within the project.
Switch off tools you do not need
Open the server's Tools tab. Every tool has a toggle; the header shows N / M enabled. Search by name, path or description, filter by All / Enabled / Disabled, and use Enable / Disable for everything matching the filter. Changes are staged and applied with Save changes.
A disabled tool disappears from tools/list, the client API and every agent that has it bound. The list is stored per server (disabledTools), survives Update tools (rediscovery) and can be set through the API:
curl -X PATCH "$BASE/api/client/v1/mcp/support-tools" \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{ "disabledTools": ["delete_ticket", "export_all"] }'disabledTools is a full replacement list; an empty list enables everything.
Rename and reword tools
The row action Edit description & annotations opens the tool's settings:
| Field | Effect |
|---|---|
| Description | Replaces the description discovered from the spec or the upstream server, everywhere the tool is shown, including to the model |
| Tool name | The name MCP clients and agents call the tool by. Letters, numbers, _ and -, at most 128 characters, unique on the server. Calls under the new name still run the same underlying tool. Clear it to restore the discovered name |
| Title | A human-readable label for MCP clients; cosmetic |
| Annotations | readOnlyHint, destructiveHint, idempotentHint, openWorldHint. Every tool is served with a full set because strict clients reject servers that omit them. Values come from the override, else are derived (read-only for GET/HEAD operations and for internal Knowledge Base tools, otherwise the conservative "not read-only, potentially destructive") |
These overrides are stored per server and survive rediscovery. Descriptions and annotations can also be patched through the client API (toolDescriptions, toolAnnotations, with null removing an override); the tool name override is set from the dashboard (toolNames on PATCH /api/mcp/{id}).
Rename to fix collisions and to guide the model
Two upstreams that both expose search confuse the model. Rename them search_docs and search_tickets, or give each a description that says when to use it.
Server instructions
The server's Instructions field in the edit form holds text that initialize returns to MCP clients, telling the model how the server's tools fit together. It is at most 8000 characters; clearing the field removes it. Text you write wins over the text Cognipeer discovers from the upstream server (a remote or stdio server's own instructions, or the text an internal provider writes). A composite server joins one section per active member. A failed discovery keeps the text already stored. The wire format is in the MCP API reference.
Titles, errors and discovery
- Titles. Each tool in
tools/listcarries a top-leveltitle: your Title override, else the upstream tool's title, else the OpenAPI operation summary, else the tool name. - Bad arguments are a tool result. A call with a missing or invalid argument now answers with a normal tool result that has
isError: trueand the message, so the model can read it and retry. Only an unknown tool is still a JSON-RPC error. This holds on the token, public and built-in console endpoints. The RESTPOST /executestill answers400. - Remote servers. A streamed (SSE) answer is matched to the request by id, so log and progress notifications that arrive first are no longer taken as the result. A tool list that continues over several pages is followed to the end, up to 50 pages.
Pass caller headers to the upstream
Off by default. A server can be told to forward headers that the caller supplies at run time (for example the end user's own Authorization) to its upstream, either all of them or an allow-list of names (runtimeHeaders: { allow, allowedNames }). Leave it off unless the upstream needs the caller's identity.
Guard and monitor
The server's Security tab now lets you pick a workspace guardrail per server. New servers start with no guardrail selected. If you bind one, MCP calls can be checked by both the agent's own guardrails and the server's guardrail: input checks run agent-first then server, output checks run server-first then agent, and the same guardrail in the same project is evaluated only once.
When you update a server over the API, guardrail: { "guardrailKey": "..." } now binds that named guardrail directly even if you omit mode; the guardrail's own enforce, monitor or disabled mode applies. An unknown key returns 400. To remove the binding, send guardrail: { "mode": "off" }.
The managed mcp-protection guardrail from v1.34.0 is no longer provisioned or auto-selected for new servers. Existing bindings remain in place, but for new servers you now create and choose a guardrail yourself or use From a template.
Create a server guardrail from a template
On the create form and the Security tab, From a template creates a new monitor-mode guardrail and selects it for the server in one step. The recommended MCP server protection template combines size and network checks, credential masking and tool-result checks. Injection in tool results and Private network (SSRF) guard are also offered there.
Server setup uses the same template catalog available from Operate → Guardrail → Start from. The catalog includes twelve ready-made templates across baseline, credential handling, profanity, KVKK, GDPR, payment-card data, prompt checks, tool-result checks, agent tool safety, MCP server protection, private-network checks and strict content. Templates start in monitor mode and do not require a model.
Tool-definition checks
The same Security tab can apply a separate guardrail to tool definitions. Configure definitionGuardrail: { "guardrailKey": "..." } on a server update, or null to disable it. This applies to remote, stdio and OpenAPI definitions.
In enforce mode, a blocked definition is held for review, including a previously approved definition when a new block appears. In monitor mode, findings are informational and do not stop the definition from being stored.
PII-protected evaluation logs
If server PII protection is enabled, guardrails still evaluate the real values on both request and response paths, but evaluation logs, finding messages and block reasons keep tokens for the detected values. Server PII protection remains configured separately from the guardrail binding itself.
The server's Usage, Request Logs and Audit tabs, and the Monitor page, show every call.
Client metadata in request logs
MCP hosts can send a _meta object with a tool call (for example anonymised user or conversation ids, a locale or a coarse location). Cognipeer keeps a bounded copy of it in the request-log row, under requestPayload._client.meta, for tokens, public servers and the client MCP gateway. The copy keeps at most 32 keys with short keys and values and one level of nesting, drops progressToken, masks sensitive values, and stores coordinates (latitude, longitude, lat, lng, lon) as keys with the value [redacted]. A row that went over the size limit is marked _truncated. These rows follow the telemetry class in Data retention.
| Variable | Description | Default |
|---|---|---|
MCP_LOG_CLIENT_META | false stores no client metadata | true |
MCP_LOG_CLIENT_META_MAX_BYTES | Largest serialized _meta kept per row (minimum 256) | 2048 |
Bind it to an agent
Open the agent's Build → Tools and choose Add → Add from hub / library…. In Select Tools, MCP servers carry the MCP server badge; tick the tools the agent may call. See Tools overview.
What the agent gets with them:
- The server's instructions. When a bound server has instructions, they are added to the agent's system prompt under the server's name, listing the tools the agent has from it — the same way an MCP client puts them in front of its model. A server's text is cut at 2,000 characters and all servers together at 8,000. To change what an agent reads, edit the server's Instructions.
- A name the model can call. A tool keeps its own name unless it cannot: a name every model provider accepts has only letters, numbers,
_and-and at most 64 characters, so other characters become_. When two bound tools share a name (two servers that both exportsearch) or a tool is named like a built-in (web_search), it is offered as<serverKey>__<name>, and its description starts with the server's name. Request logs and guardrails still know it by its own name, and so do the approval settings — except a built-in's name, whose read-only exemption a server's tool never gets. - A deadline. One call to a remote server may take at most 2 minutes, reading a streamed answer included (
MCP_CALL_TIMEOUT_MS). When a run is stopped, a call in flight is abandoned rather than waited for, and a stdio server's process is ended.
MCP servers of one agent
An MCP server created from inside an agent belongs to that agent. Only that agent lists it, binds it, runs it and manages it. Everything else a server has (credentials, tool discovery, tool switches and renames, guardrails, request logs) works as on a shared server.
In the agent's Build → Tools
Build → Tools of an agent is one list with a row per source:
- This agent — the agent's own MCP servers, bound or not ("only this agent uses these; they are deleted with it"). Manage opens the server in a side panel, with the same tabs as the server page; the bin icon (Delete server) deletes it and takes its tools off the agent.
- Shared — what the agent uses from the project: shared MCP servers, custom tools, system tools and flows. The cross (Remove from agent) takes a source off the agent; the source itself stays.
A row's tool count (for example 3/12 tools) opens Select Tools on that source alone. The Add menu has:
| Item | What it does |
|---|---|
| New MCP server for this agent | Opens "New MCP server for this agent": the usual form without Endpoint exposure and Add to hub, because the server has no endpoint of its own. The new server is bound with all its tools. Needs write access to MCP. |
| Add from hub / library… | Opens Select Tools on the shared sources. |
| New custom tool | Creates a custom tool and binds all its actions. Needs write access to Tools. |
What is different about an agent's own server
- Not listed with the shared servers. It does not appear under Build → MCP Servers, in another agent's Select Tools, or in an MCP Hub. Another agent cannot bind or run it.
- Not served outside the agent. The client API (
/api/client/v1/mcp/{serverKey}) answers as if the key did not exist, and the public MCP endpoint does not serve it. - Deleted with the agent. Deleting the agent deletes its servers (and its own skills).
- Sub-agents. A sub-agent defined inside the agent can bind the agent's own servers; a referenced agent uses its own. A composite can include an agent's own server only when the composite belongs to the same agent.
- Export and import. An exported agent's own servers are re-created as shared servers when the agent is imported.
Servers that agents created before this feature existed stay shared.
API
| Request | Returns or does |
|---|---|
GET /api/mcp | The project's shared servers only. |
GET /api/mcp?agentId={id} | The shared servers plus that agent's own (what the agent's picker shows). |
GET /api/mcp?agentId={id}&owned=only | That agent's own servers only. owned=only without agentId is a 400. |
POST /api/mcp with ownerAgentId | Creates the server for that agent, which must be an agent of the same project (400 otherwise). The owner cannot be changed afterwards. |
Who can do this
MCP servers belong to the mcp service (MCP Hub in the access settings). Reading needs mcp.read; creating, changing and deleting needs mcp.write. Executing a tool through the client API is checked as mcp-server.call. See the Permissions reference.

