personal-timesheet-mcp

personal-timesheet-mcp

MCP server providing CRUD operations for timesheet management via REST API endpoints, enabling creation, reading, updating, and deletion of timesheet entries along with project management.

Category
访问服务器

README

Timesheet MCP Server

A Model Context Protocol (MCP) server that provides CRUD operations for timesheet management via REST API endpoints.

👤 For End Users: See README-USER.md for simple installation instructions
👨‍💻 For Developers: Continue reading below
📦 Publishing: See Publishing Guide to distribute your connector

Features

  • Create timesheet entries
  • Read timesheet entries (list and get single)
  • Update existing entries
  • Delete timesheet entries
  • List Projects for reference
  • Configurable API base URL
  • Support for both Go and Node.js backend APIs

Prerequisites

  • Node.js 18 or higher
  • A running instance of the Timesheet Logger backend API
  • Claude Desktop (for integration)

Installation

  1. Navigate to the mcp directory:
cd mcp
  1. Install dependencies:
npm install
  1. Configure environment variables:
cp .env.example .env
# Edit .env and set TIMESHEET_API_BASE_URL
  1. Build the project:
npm run build

Configuration

Environment Variables

Create a .env file or set environment variables:

TIMESHEET_API_BASE_URL=http://localhost:3000/api

Claude Desktop Integration

Add to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

For end users (after publishing to npm):

{
  "mcpServers": {
    "timesheet": {
      "command": "timesheet-mcp",
      "env": {
        "TIMESHEET_API_BASE_URL": "http://localhost:3000/api"
      }
    }
  }
}

For local development:

{
  "mcpServers": {
    "timesheet": {
      "command": "node",
      "args": ["/absolute/path/to/timesheet_logger/mcp/build/index.js"],
      "env": {
        "TIMESHEET_API_BASE_URL": "http://localhost:3000/api"
      }
    }
  }
}

Usage

Development Mode

Run in development mode with auto-reload:

npm run dev

Production Mode

Build and run:

npm run build
npm start

Available Tools

1. create_timesheet_entry

Create a new timesheet entry.

Parameters:

  • project_id (string, required): Project ID
  • date (string, required): Entry date (YYYY-MM-DD)
  • hours (number, required): Hours worked
  • description (string, optional): Entry description
  • billable (boolean, optional): Whether entry is billable (default: true)

2. list_timesheet_entries

List timesheet entries with optional filters.

Parameters:

  • start_date (string, optional): Filter by start date (YYYY-MM-DD)
  • end_date (string, optional): Filter by end date (YYYY-MM-DD)
  • project_id (string, optional): Filter by project ID
  • limit (number, optional): Maximum results (default: 50)
  • offset (number, optional): Offset for pagination (default: 0)

3. get_timesheet_entry

Get a single timesheet entry by ID.

Parameters:

  • entry_id (string, required): Entry ID

4. update_timesheet_entry

Update an existing timesheet entry.

Parameters:

  • entry_id (string, required): Entry ID
  • project_id (string, optional): New project ID
  • date (string, optional): New date (YYYY-MM-DD)
  • hours (number, optional): New hours
  • description (string, optional): New description
  • billable (boolean, optional): New billable status

5. delete_timesheet_entry

Delete a timesheet entry.

Parameters:

  • entry_id (string, required): Entry ID

6. list_projects

List available projects.

Parameters: None

7. create_project

Create a new project. Requires admin or manager role.

Parameters:

  • name (string, required): Project name
  • description (string, optional): Project description
  • is_active (boolean, optional): Whether project is active (default: true)

8. login

Manually trigger browser-based login. Opens a browser window for authentication.

Parameters: None

Note: Useful after logout or for manual authentication. If already logged in, will show current user.

9. logout

Logout from the current session and clear stored authentication tokens.

Parameters: None

Note: After logout, you will need to re-authenticate (via browser login) on the next request.

Testing

Test with Local Backend

  1. Start your backend API:
# From backend/api-nodejs or backend/api-go
docker-compose up
  1. Run the MCP server:
npm run dev
  1. Test through Claude Desktop or use the MCP Inspector

Troubleshooting

Connection Refused

  • Ensure the backend API is running
  • Verify the TIMESHEET_API_BASE_URL is correct
  • Check that the port matches your backend configuration

Authentication Errors

  • Verify API key if required by your backend
  • Check that the API endpoint supports the operations

Tool Not Found

  • Rebuild the project: npm run build
  • Restart Claude Desktop
  • Verify the path in Claude Desktop config is absolute

Development

Project Structure

mcp/
├── src/
│   ├── index.ts              # Main MCP server entry point
│   ├── config.ts             # Configuration management
│   ├── types.ts              # TypeScript types
│   ├── api/
│   │   ├── client.ts         # HTTP client wrapper
│   │   └── timesheet.ts      # Timesheet API operations
│   └── tools/
│       ├── create-entry.ts   # Create tool
│       ├── list-entries.ts   # List tool
│       ├── get-entry.ts      # Get tool
│       ├── update-entry.ts   # Update tool
│       └── delete-entry.ts   # Delete tool
├── build/                    # Compiled output
├── package.json
├── tsconfig.json
└── README.md

Adding New Tools

  1. Create a new file in src/tools/
  2. Define the tool schema using Zod
  3. Implement the handler function
  4. Register the tool in src/index.ts

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选