Skip to content

MCP Servers

MCP servers provide tools and resources that Polytoken can use during a session. Add servers in the MCP pane of polytoken config ui.

Choose a server name, then select its transport. A server name may contain only ASCII letters, digits, underscores, and hyphens, must not start with an underscore, and must not contain two underscores in a row. For a local server, enter the executable in the command field and add each command-line argument as a separate item. For a remote server, enter its HTTP URL. The pane shows settings that apply to the selected transport.

A local stdio MCP server stops after its process exits unless you configure restart_policy. The default none policy leaves the server stopped. restart_policy takes an object rather than a single value: set mcp_servers.<name>.restart_policy.mode to bounded and set mcp_servers.<name>.restart_policy.max_attempts to the number of attempts. Polytoken then starts a fresh process after a failure, with progressively longer delays between attempts. The accepted attempt range appears in the Application Configuration reference.

When Polytoken exhausts the configured attempts, the server enters Disabled and stays stopped until you enable it again. A configuration reload cancels retries for the replaced server and applies the new configuration. Manually disabling a server also cancels pending retries.

restart_policy applies only to stdio servers. HTTP servers reconnect on their own after a connection failure.

MCP tool results that contain images reach the model as inline images when the model supports vision and its provider accepts images in tool results. Text in the result arrives alongside the inline image. When Polytoken cannot deliver an image inline, it saves the image under the session directory with a name such as mcp-image-1.png, and the tool result names the saved path. If the model lacks vision, the tool result also says the model cannot see the image.

Polytoken processes PNG, JPEG, GIF, and WebP images. The tool result notes each image Polytoken skips because of an unsupported format, invalid data, or a processing limit. An image that fails to save also produces a note instead of a saved path. For a result with multiple images and inline delivery, Polytoken sends the first image inline and saves the remaining images under the session directory.

For an HTTP server that uses a bearer token, choose Authorization header authentication and enter the header value. Prefer an environment reference such as ${MCP_AUTHORIZATION} over a literal secret. Polytoken redacts literal authorization values and stdio server environment values in the configurator display and save preview.

Set mcp_servers.<name>.block_list to hide MCP tools from the model. Each entry matches a synthesized tool name such as mcp__github__admin_delete. The * character matches any sequence of characters, so mcp__github__admin_* hides every admin_ tool from the github server. Entries without * match one tool name exactly. Polytoken rejects entries containing [, {, or ?; use * for wildcard matching.

Choose the OAuth login action in the MCP pane to sign in without starting a daemon. You can also run polytoken auth mcp login --server <server> from a terminal. The command accepts --no-open to print the authorization URL instead of opening a browser, and --force to replace stored credentials without a confirmation prompt.

OAuth uses a loopback callback by default. If the server has a fixed redirect URI, Polytoken uses that URI and asks you to paste the completed callback URL instead of opening a local callback listener. A fixed redirect URI must use HTTPS, or HTTP on a loopback host. Pasting the callback URL requires an interactive terminal.

The URL you paste must match the server’s configured redirect URI: the scheme, host, effective port, and path have to be the same, and the URL must not carry a user-info component such as user@host. Polytoken ignores query and fragment differences and treats an explicit default port as equivalent to omitting the port. A pasted URL that lost its scheme still matches: Polytoken supplies http:// for loopback hosts and https:// for any other host before comparing. Any other URL fails before Polytoken exchanges the authorization code for tokens.

By default Polytoken requests every scope the server advertises when you sign in. Set mcp_servers.<name>.auth.scopes to request an explicit subset instead. Polytoken uses the same scope list in the authorization request and in the stored client credentials, so a later token refresh asks for the same access the initial sign-in requested.

When the token exchange or a later token refresh fails, Polytoken shows the complete response the OAuth server returned: the request method and URL, the HTTP status, every response header with cookie values hidden, and the response body. Polytoken formats the body for reading when the server labels it JSON or XML, then truncates very long responses with a notice. The same text appears in the terminal after polytoken auth mcp login, in the browser page that closes a loopback callback, and in the error body the daemon returns. Failures with no response to show, such as a network outage, keep the original error text unchanged.

See Application Configuration for the complete MCP server key list and configuration details.