# Integrations and automation
Extend magi-code with MCP servers, language-server diagnostics, hooks, and optional Jev checks.
## Connect MCP tools
MCP servers expose external tools to the agent. Magi-code supports local stdio servers and Streamable HTTP servers.
Create `~/.magi-code/.mcp.json` for global definitions or `.mcp.json` in the launch directory for project definitions:
```json
{
"mcpServers": {
"example": {
"command": "example-mcp-server",
"args": ["--stdio"]
}
}
}
```
Then:
1. Enter `/mcp` in Mission Control.
2. Review the discovered definition.
3. Approve the server.
4. Restart magi-code.
Definitions do not approve themselves. Diagnose setup without a provider call:
```sh
magi-code mcp list
magi-code mcp test example
```
Keep credentials out of `.mcp.json`. Use environment references or the supported HTTP OAuth flow.
## Enable post-edit diagnostics
LSP diagnostics can append fresh errors and warnings after agent file edits. Install the relevant language server, then add:
```json
{
"capabilities": {
"lsp": {
"enabled": true,
"inject_diagnostics_on_edit": true
}
}
}
```
Built-in routes cover Rust, TypeScript/JavaScript, Python, and Go. Servers start only when a matching file is edited. Diagnostics supplement tests and builds; they do not replace them.
## Run local hooks
Hooks run trusted local scripts before or after tools, assistant messages, or reasoning summaries. Use them for audits, policy checks, notifications, or carefully controlled context injection.
```json
{
"automation": {
"hooks": {
"enabled": true,
"show_in_tui": true,
"before_tool": [
{
"label": "audit",
"command": "./scripts/magi-hooks/audit.sh"
}
]
}
}
}
```
Hook scripts receive JSON on standard input. They run with your local permissions and may receive sensitive tool data. Review them like executable code. Keep provider context injection off unless the script output is intended for the model.
## Enable Jev checks
Jev features provide optional semantic checks for command risk, prose edits, prompt injection, and completion quality, plus optional Bash file tracking for Session Files.
1. Set `TYPESAFE_API_KEY` in the launch environment.
2. Open `/settings` → **Internal Tooling**.
3. Enable **Jev tooling** and only the checks you need.
4. Save. Future actions use the new settings; Bash file tracking applies after restart.
Enabled checks send relevant commands, edits, tool output, or turn evidence to TypeSafe. Review data handling before enabling them.
## Advanced reference
- [MCP reference](../features/mcp-stdio-tools.md)
- [LSP diagnostics reference](../features/lsp-diagnostics.md)
- [Hook reference](../features/tool-call-hooks.md)
- [Jev reference](../features/jev-and-internal-tooling.md)