Skip to main content
Glama
standardbeagle

Harvest MCP Server

harvest_get_project

Retrieve detailed information about a specific project from Harvest time tracking system by providing its unique project ID.

Instructions

Get details of a specific project. Use about {"tool": "harvest_get_project"} for detailed usage examples.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesProject ID

Implementation Reference

  • Core handler function that executes the Harvest API request to retrieve details of a specific project by ID.
    async getProject(id: string) {
      return this.makeRequest(`/projects/${id}`);
    }
  • MCP tool call dispatcher case that invokes the HarvestClient.getProject method and formats the JSON response.
    case 'harvest_get_project':
      const project = await harvestClient.getProject(typedArgs.id as string);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(project, null, 2),
          },
        ],
      };
  • Defines the tool's metadata, description, and input schema requiring a 'id' parameter of type string.
    {
      name: 'harvest_get_project',
      description: 'Get details of a specific project. Use about {"tool": "harvest_get_project"} for detailed usage examples.',
      inputSchema: {
        type: 'object',
        properties: {
          id: { type: 'string', description: 'Project ID' }
        },
        required: ['id']
      }
    },
  • src/index.ts:69-73 (registration)
    Registers the list tools handler which returns the tools array including harvest_get_project schema.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: tools,
      };
    });
  • Generic HTTP request helper used by getProject to make authenticated API calls to Harvest.
    private async makeRequest(endpoint: string, options: RequestInit = {}) {
      const url = `${this.baseUrl}${endpoint}`;
      
      const response = await fetch(url, {
        ...options,
        headers: {
          'Authorization': `Bearer ${this.accessToken}`,
          'Harvest-Account-ID': this.accountId,
          'User-Agent': this.userAgent,
          'Content-Type': 'application/json',
          ...options.headers,
        },
      });
    
      if (!response.ok) {
        let errorMessage = `Harvest API error: ${response.status} ${response.statusText}`;
        
        try {
          const errorBody = await response.json() as any;
          if (errorBody.message) {
            errorMessage += ` - ${errorBody.message}`;
          }
        } catch {
          // If we can't parse the error response, use the basic error message
        }
        
        throw new Error(errorMessage);
      }
    
      return response.json();
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/standardbeagle/harvest-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server