The FreeAgent MCP Server enables Claude to interact with your FreeAgent account for time tracking, including managing timeslips and timers. This integration works through the Model Context Protocol (MCP), giving Claude direct access to your time-tracking data.
git clone https://github.com/yourusername/freeagent-mcp.git
cd freeagent-mcp
npm install
# Set your FreeAgent credentials
export FREEAGENT_CLIENT_ID="your_client_id"
export FREEAGENT_CLIENT_SECRET="your_client_secret"
# Run the OAuth setup script
node scripts/get-oauth-tokens.js
git clone https://github.com/yourusername/freeagent-mcp.git
cd freeagent-mcp
cp .env.example .env
# Edit .env with your FreeAgent credentials
docker build -t freeagent-mcp .
Add the server to your MCP settings file (typically located at %APPDATA%/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
):
{
"mcpServers": {
"freeagent": {
"command": "node",
"args": ["path/to/freeagent-mcp/build/index.js"],
"env": {
"FREEAGENT_CLIENT_ID": "your_client_id",
"FREEAGENT_CLIENT_SECRET": "your_client_secret",
"FREEAGENT_ACCESS_TOKEN": "your_access_token",
"FREEAGENT_REFRESH_TOKEN": "your_refresh_token"
},
"disabled": false,
"autoApprove": []
}
}
}
{
"mcpServers": {
"freeagent": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e", "FREEAGENT_CLIENT_ID",
"-e", "FREEAGENT_CLIENT_SECRET",
"-e", "FREEAGENT_ACCESS_TOKEN",
"-e", "FREEAGENT_REFRESH_TOKEN",
"freeagent-mcp"
],
"env": {
"FREEAGENT_CLIENT_ID": "your_client_id",
"FREEAGENT_CLIENT_SECRET": "your_client_secret",
"FREEAGENT_ACCESS_TOKEN": "your_access_token",
"FREEAGENT_REFRESH_TOKEN": "your_refresh_token"
},
"disabled": false,
"autoApprove": []
}
}
}
Once configured, Claude can access several tools to interact with your FreeAgent account:
Claude can retrieve timeslips with various filters:
{
"from_date": "2024-01-01", // Start date (YYYY-MM-DD)
"to_date": "2024-03-04", // End date (YYYY-MM-DD)
"updated_since": "2024-03-04T12:00:00Z", // ISO datetime
"view": "all", // "all", "unbilled", or "running"
"user": "https://api.freeagent.com/v2/users/123",
"task": "https://api.freeagent.com/v2/tasks/456",
"project": "https://api.freeagent.com/v2/projects/789",
"nested": true // Include nested resources
}
Claude can create new timeslips with the following parameters:
{
"task": "https://api.freeagent.com/v2/tasks/123",
"user": "https://api.freeagent.com/v2/users/456",
"project": "https://api.freeagent.com/v2/projects/789",
"dated_on": "2024-03-04",
"hours": "1.5",
"comment": "Optional comment"
}
Claude can start and stop timers with a simple command:
// Start timer
{
"id": "123"
}
// Stop timer
{
"id": "123"
}
The FreeAgent MCP Server provides these key capabilities:
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "freeagent" '{"command":"node","args":["path/to/freeagent-mcp/build/index.js"],"env":{"FREEAGENT_CLIENT_ID":"your_client_id","FREEAGENT_CLIENT_SECRET":"your_client_secret","FREEAGENT_ACCESS_TOKEN":"your_access_token","FREEAGENT_REFRESH_TOKEN":"your_refresh_token"},"disabled":false,"autoApprove":[]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"freeagent": {
"command": "node",
"args": [
"path/to/freeagent-mcp/build/index.js"
],
"env": {
"FREEAGENT_CLIENT_ID": "your_client_id",
"FREEAGENT_CLIENT_SECRET": "your_client_secret",
"FREEAGENT_ACCESS_TOKEN": "your_access_token",
"FREEAGENT_REFRESH_TOKEN": "your_refresh_token"
},
"disabled": false,
"autoApprove": []
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"freeagent": {
"command": "node",
"args": [
"path/to/freeagent-mcp/build/index.js"
],
"env": {
"FREEAGENT_CLIENT_ID": "your_client_id",
"FREEAGENT_CLIENT_SECRET": "your_client_secret",
"FREEAGENT_ACCESS_TOKEN": "your_access_token",
"FREEAGENT_REFRESH_TOKEN": "your_refresh_token"
},
"disabled": false,
"autoApprove": []
}
}
}
3. Restart Claude Desktop for the changes to take effect