MCP servers
MCP servers give an agent more tools, prompts and resources: an issue tracker, a database, a design tool or your own internal service. Codity agents use the same file format as Claude Code, so a server you already use there works here. Your organization's and team's agent policies decide which servers may run.
Where servers are defined
| Scope | Where it lives | Used by |
|---|---|---|
| You | ~/.codity/mcp.json |
Every project you open on this machine. |
| Project | .mcp.json at the project root, shared through the repository |
Everyone who opens the project, once each person approves it. |
| Session | Added in the VS Code panel or the terminal UI for this session only | This session; gone when the agent restarts. |
If you and a project both define a server with the same name, yours is used. Names starting with codity are reserved for Codity's own servers, such as team memory.
Your own file follows the same rule as hooks: it is loaded only when you own it and nobody else can write to it or its folder (chmod 600 ~/.codity/mcp.json). Set CODITY_CONFIG_HOME to use another folder.
File format
{
"mcpServers": {
"notion": { "type": "http", "url": "https://mcp.notion.com/mcp" },
"github": {
"type": "http",
"url": "https://api.githubcopilot.com/mcp/",
"headers": { "Authorization": "Bearer ${GITHUB_TOKEN}" }
},
"airtable": {
"command": "npx",
"args": ["-y", "airtable-mcp-server"],
"env": { "AIRTABLE_API_KEY": "${AIRTABLE_API_KEY}" }
}
}
}
| Field | Meaning |
|---|---|
type |
http, sse or stdio. Defaults to stdio when there is a command, otherwise http. |
url, headers |
Remote servers. The URL must use https, or plain http only for a server on this machine (localhost, 127.0.0.1 or [::1]). |
command, args, env |
Local servers, started on your machine. |
Write ${VAR} or ${VAR:-default} anywhere in a value to take it from your environment when the agent starts. This keeps tokens out of files you share. A reference to a variable that is not set, with no default, stops that server from loading and says which variable is missing. Server names use letters, digits, - and _, up to 64 characters, and a file can define up to 50 servers.
A local server is started with the environment you launched the agent with, never with the agent's own credentials.
Add servers from the terminal
codity mcp add --transport http notion https://mcp.notion.com/mcp
codity mcp add github -H 'Authorization: Bearer ${GITHUB_TOKEN}' https://api.githubcopilot.com/mcp/
codity mcp add --scope project airtable -e 'AIRTABLE_API_KEY=${AIRTABLE_API_KEY}' -- npx -y airtable-mcp-server
codity mcp list
codity mcp remove notion
--scope user (the default) writes ~/.codity/mcp.json; --scope project writes the project's .mcp.json. Put a local command after -- so its own flags are not read as Codity's, and single-quote ${VAR} so your shell leaves it for the agent to fill in.
Inside a running agent, /mcp in the terminal UI and Codity: MCP Servers in VS Code list every server with its state and let you add, connect, disconnect, sign in and remove. See MCP servers in VS Code.
Approving a project's servers
A project's .mcp.json can start programs on your machine, so its servers wait until you approve them. The prompt shows what each server runs or connects to and which environment variables it reads. Approve and start records your approval in ~/.codity/mcp-approvals.json for that exact definition. If someone changes the server's command, URL, headers or environment in the repository, it waits for your approval again.
Signing in
A remote server that uses OAuth shows Sign in. Your browser opens the provider's sign-in page; once you finish, the server connects and its tools become available. The sign-in is kept on your machine, so the server connects on its own next time until you choose Sign out.
Prompts and resources
- Prompts a server offers appear as commands, named
/server:prompt, in the/menu. - Resources a server offers can be attached to a message: in VS Code from the attach menu (MCP resource). The agent reads the resource with your message.
Organization and team policy
Administrators decide which servers agents may use on the MCP servers tab of the organization's or a team's agent policy (Settings → Policies → Agent policy, or the team's Settings → Agent policy). Choose Any not denied or Only allowed ones, then add rules by Name, URL or Command to the denied and allowed lists, and select Review changes. The rules apply to servers added in the panel, in ~/.codity/mcp.json and in a project's .mcp.json. In the policy YAML they appear under mcp_servers (see Permissions and YAML policies):
version: 1
permissions: []
mcp_servers:
allowed:
- name: notion
- url: "https://*.internal.example.com/*"
- command: "npx -y @company/mcp-*"
denied:
- name: "*-experimental"
- url: "http://*"
Each rule names exactly one of:
| Rule | Matches |
|---|---|
name |
The server's name, with * as a wildcard, ignoring case. |
url |
A remote server's URL, written scheme://host[:port][/path]. The scheme, host, port and path are checked separately against the parsed URL, so https://*.example.com/* cannot be satisfied by https://evil.example.net/.example.com/. * as the port matches any port; a rule with no path matches any path. |
command |
A local server's whole command line (command and arguments), with * as a wildcard. |
How rules combine:
- A deny in any policy that applies wins.
- With no
allowedlist, every server that is not denied may run. An emptyallowed: []allows none. - When both the organization and the team have an
allowedlist, a server must be on both. - A server admitted only by a
commandrule may set only credential variables (names ending inTOKEN,KEY,SECRET,PASSWORDorCREDENTIALS); other variables could change what the command runs. Allow such a server bynameinstead. - Codity's own
codity*servers are not affected by these rules.
A refused server is listed as Blocked by policy with the reason, and calls to its tools are refused. Policies are read when a session starts. Switching team policy during a session stops any server the new team denies.

