trac-mcp-server
Standalone MCP server that gives AI agents full access to Trac project management -- tickets, wiki, milestones, and search -- via the Model Context Protocol.
Quick Start
Requires Python 3.10 or later.
pip install .
Set your Trac connection:
export TRAC_URL="https://trac.example.com"
export TRAC_USERNAME="your-username"
export TRAC_PASSWORD="your-password"
Run the server:
trac-mcp-server
Using auto-pm? When trac-mcp-server is driven through auto-pm, auto-pm reads its connection settings from
.auto_pm/config.ymlin your project root (rather than the environment variables above). Runauto-pm setupin your project directory to generate the file; the resulting.auto_pm/config.ymlcarriestrac.url,trac.username, a${TRAC_PASSWORD}reference, and component mappings.
Configuration
Configuration via environment variables, .env file, or YAML config file (.trac_mcp/config.yaml):
For YAML config file format and advanced options, see Configuration Reference. For the http transport specifically, including multi-identity auth, see HTTP Transport.
MCP Client Integration
Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"trac": {
"command": "trac-mcp-server",
"env": {
"TRAC_URL": "https://trac.example.com",
"TRAC_USERNAME": "your-username",
"TRAC_PASSWORD": "your-password"
}
}
}
}
Claude Code
claude mcp add trac -e TRAC_URL=https://trac.example.com \
-e TRAC_USERNAME=your-username \
-e TRAC_PASSWORD=your-password \
-- trac-mcp-server
Other MCP Clients
Any MCP client that supports stdio transport can launch trac-mcp-server as a subprocess. Pass Trac credentials via environment variables.
For a shared or remote deployment, trac-mcp-server can also serve MCP over streamable HTTP instead of stdio:
TRAC_MCP_AUTH_TOKEN=your-token trac-mcp-server --transport http --port 8080
See HTTP Transport for auth, bind-safety rules, and reverse-proxy guidance.
Format Conversion CLI
The package also installs trac-convert, a standalone CLI for converting between TracWiki and Markdown without requiring a Trac connection. Useful for one-off conversions, editor pipelines, and clipboard workflows.
# Convert Markdown to TracWiki (stdin → stdout)
trac-convert --from md --to tracwiki < README.md > README.tw
# Convert a file (auto-detects source format)
trac-convert --to md notes.tw -o notes.md
# Clipboard round-trip
trac-convert --from-clipboard --to tracwiki --to-clipboard
Supports stdin/stdout pipes, file I/O, and system clipboard on Linux, macOS, and Windows (via pyperclip). See CLI Reference for the full flag list.
Trac Wiki I/O
trac-convert can also read from and write to a live Trac instance via --from-wiki PAGE and --to-wiki PAGE, reusing the same credentials and config precedence as trac-mcp-server: .trac_mcp/config.yml, TRAC_* env vars, or --trac-* CLI flags — CLI wins.
# Verify Trac connectivity (prints resolved config, pings server)
trac-convert --check-trac
# Fetch a Trac wiki page, convert to Markdown, save locally
trac-convert --from-wiki DesignDoc --to md -o design.md
# Edit design.md in your favourite editor, then push it back
trac-convert --from-file design.md --to-wiki DesignDoc --wiki-comment "Refined via CLI"
# One-liner Trac → clipboard for quick reference lookup
trac-convert --from-wiki ReleaseNotes --to md --to-clipboard
Auth setup: use an existing .trac_mcp/config.yml (the same file trac-mcp-server uses) or supply ad-hoc flags — --trac-url, --trac-username, --trac-password-file ~/.trac_pass (prefer --trac-password-file to keep secrets out of shell history). See Configuration for the full precedence rules.
Trac errors (auth, network, page-not-found, permission-denied) exit with code 4 and write a human-readable message to stderr. See CLI Reference for the full flag list.
File Transfer CLI
When the server runs on another machine (the HTTP transport), its file tools cannot see your files, and over HTTP they refuse server-side paths by default. trac-mcp runs on your machine and moves the bytes through the server for you, keeping your identity and the server's conversion and link checks:
trac-mcp wiki-push Docs/Design design.md # Markdown is converted on the way in
trac-mcp wiki-pull Docs/Design design.md
trac-mcp attach-put --ticket 42 trace.bin
trac-mcp attach-get --page Docs/Design diagram.png diagram.png
It connects with the nearest .mcp.json entry (or --url). See CLI Reference and File Access.
Available Tools (44)
Every tool below also accepts an optional instance argument to route the call to another Trac project on the same host (or a named instance from config) instead of the default -- see Multiple Instances.
Tickets (11)
Ticket Attachments (4)
Ticket Admin (6)
Wiki (8)
Wiki Files (3)
Wiki Attachments (4)
Milestones (5)
System (2)
Instances (1)
Development
pip install -e ".[dev]"
pytest tests/ -v
The two CI halves
./ci.sh # lint + offline tests + dual-binary build. Hermetic:
# no credentials, no daemon, no network
./ci-live.sh # the same suite with --run-live, against a real Trac
ci.sh is what GitHub Actions runs, and it deliberately does not pass
--run-live, so every @pytest.mark.live test is skipped there. Those tests
are the only place this project exercises the real Trac substrate, so run
ci-live.sh too before deploying a change to a shared daemon. It needs
TRAC_URL, TRAC_USERNAME and TRAC_PASSWORD (see .env.example), and
without them it exits non-zero without running pytest — not run must not be
able to look like passed.
ci.sh runs the offline suite with TRAC_* scrubbed from the environment,
and .env is loaded only under --run-live. An offline test that needs
credentials therefore fails locally rather than only on Actions.
Project Structure
src/trac_mcp_server/
config.py # Environment variable configuration
core/ # Trac XML-RPC client, async utilities
mcp/ # MCP server, tools, resources
converters/ # Markdown <-> TracWiki conversion
detection/ # Content format detection
Documentation
See docs/reference/overview.md for detailed tool reference, configuration, and troubleshooting.