owen-lacey/timesheets-mcp
If you are the rightful owner of timesheets-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
A blank Model Context Protocol (MCP) server application scaffolded for timesheets.
Timesheets MCP Server
A Model Context Protocol (MCP) server that provides a comprehensive interface to manage timesheets using Notion databases. This server offers tools for querying, creating, and updating timesheet entries, activities, responsibilities, competencies, and evidence.
Features
- 📊 Timesheet Management: Start, end, and query timesheet entries
- 🎯 Activity Tracking: Search and manage work activities
- 📋 Responsibility Management: Organize work by responsibility categories
- 🔍 Advanced Queries: Date range filtering and metadata retrieval
- 😊 Mood Tracking: Track mood for timesheet entries
- 🔧 Type-Safe: Full TypeScript support with Zod validation
Quick Start
-
Install dependencies
npm install -
Set up environment variables Create a
.envfile in the project root:NOTION_API_KEY=your_notion_api_key_here TIMESHEETS_DB_ID=your_timesheets_database_id ACTIVITIES_DB_ID=your_activities_database_id_optional RESPONSIBILITIES_DB_ID=your_responsibilities_database_id_optional TOPICS_DB_ID=your_topics_database_id_optional COMPETENCIES_DB_ID=your_competencies_database_id_optional EVIDENCE_DB_ID=your_evidence_database_id_optional -
Build the project
npm run build -
Start the server
npm start -
Development mode
npm run dev
Available Tools
Core Timesheet Operations
getTodaysTimesheets- Get all timesheet entries for todaygetTimesheetsByDateRange- Query timesheets by date rangestartTimesheet- Create a new timesheet entryendTimesheet- Complete a timesheet with end time and moodupdateTimesheetMood- Update mood for existing timesheet
Search & Management
searchActivities- Search activities by namesearchResponsibilities- Search responsibilities by namesearchTopics- Search topics by namecreateTopic- Create a new topic/responsibility entrycreateActivity- Create a new activity entryupdateActivity- Update an existing activity entrygetDatabaseMetadata- Get schema information for databases
Competencies & Evidence
searchCompetencies- Search competencies by name and PE Content with evidence countsaddEvidence- Create a new evidence entry with competencies and topicsupdateEvidence- Update existing evidence (appends relations)
Project Structure
timesheets-mcp/
├── src/
│ ├── server.ts # Main MCP server setup and tool registration
│ ├── tools/ # Individual tool implementations
│ │ ├── startTimesheet.ts
│ │ ├── endTimesheet.ts
│ │ ├── getTodaysTimesheets.ts
│ │ ├── getTimesheetsByDateRange.ts
│ │ ├── updateTimesheetMood.ts
│ │ ├── searchActivities.ts
│ │ ├── searchResponsibilities.ts
│ │ ├── searchTopics.ts
│ │ ├── createTopic.ts
│ │ ├── createActivity.ts
│ │ ├── updateActivity.ts
│ │ ├── searchCompetencies.ts
│ │ ├── addEvidence.ts
│ │ ├── updateEvidence.ts
│ │ └── getDatabaseMetadata.ts
│ ├── types/
│ │ ├── schemas.ts # Zod input/output validation schemas
│ │ └── notion.ts # Notion API type definitions
│ └── utils/
│ ├── notion-api.ts # Notion API wrapper functions
│ └── helpers.ts # Utility functions (date/time helpers)
├── build/ # Compiled JavaScript output
├── docs/ # Documentation
├── postman/ # Postman collections for API testing
├── package.json
├── tsconfig.json
└── README.md
Database Schema
This server works with six interconnected Notion databases:
Timesheets Database (Required)
Desc(title): Description of work performedDate(date): Date of the timesheet entryStart(rich_text): Start time in HH:MM formatEnd(rich_text): End time in HH:MM formatActivities(relation): Links to Activities databaseTopics(relation): Links to Topics/Responsibilities database""(select): Mood emoji (property name is empty string)
Activities Database (Optional)
Name(title): Activity nameDescription(rich_text): Activity descriptionResponsibilities(relation): Links to Responsibilities database
Responsibilities Database (Optional)
Title(title): Responsibility nameDescription(rich_text): Responsibility description
Topics Database (Optional)
Title(title): Topic nameText(rich_text): Topic description- Can be associated with timesheet entries and evidence
Competencies Database (Optional)
Name(rich_text): Competency namePE Content(rich_text): Professional Experience content descriptionEvidence(relation): Links to Evidence database (used for counting)
Evidence Database (Optional)
Summary(title): Title/summary of the evidence entryDate(date): When the evidence occurredWhat happened(rich_text): Detailed description of the evidenceCompetencies(relation): Links to one or more competenciesTopics(relation): Links to one or more topics
Adding New Tools
To add a new MCP tool to this server, follow these steps:
1. Create the Tool Implementation
Create a new file in src/tools/yourToolName.ts:
// Tool implementation for your new feature
import { YourInputSchema } from '../types/schemas.js';
import { someUtilityFunction } from '../utils/notion-api.js';
export async function yourToolNameTool(
databaseId: string,
input: YourInputType
) {
try {
// Validate input
const validatedInput = YourInputSchema.parse(input);
// Implement your logic here
const result = await someUtilityFunction(databaseId, validatedInput);
return {
content: [
{
type: "text" as const,
text: `Success: ${JSON.stringify(result, null, 2)}`
}
]
};
} catch (error) {
return {
content: [
{
type: "text" as const,
text: `Error: ${error}`
}
]
};
}
}
2. Define Input/Output Schemas
Add your schemas to src/types/schemas.ts:
// Add to existing schemas
export const YourInputSchema = z.object({
requiredField: z.string().min(1, "Field is required"),
optionalField: z.string().optional(),
// Add validation as needed
});
export type YourInputType = z.infer<typeof YourInputSchema>;
3. Register the Tool
Add your tool to src/server.ts:
// Import your tool
import { yourToolNameTool } from './tools/yourToolName.js';
// Register the tool (add this with other tool registrations)
server.registerTool('yourToolName', {
description: "Clear description of what your tool does",
inputSchema: {
requiredField: z.string().min(1, "Field is required"),
optionalField: z.string().optional()
}
}, async (request: any) => {
return await yourToolNameTool(timesheetsDatabaseId, request);
});
4. Add Utility Functions (if needed)
If you need new Notion API interactions, add them to src/utils/notion-api.ts:
export async function yourNewNotionFunction(databaseId: string, data: any) {
return notionRequest(`https://api.notion.com/v1/databases/${databaseId}/your-endpoint`, {
method: 'POST',
body: JSON.stringify(data)
});
}
5. Update Types (if needed)
Add any new Notion-specific types to src/types/notion.ts.
Development Guidelines
Code Patterns
- Error Handling: All tools should use try/catch and return standardized error responses
- Input Validation: Use Zod schemas for all inputs
- Type Safety: Leverage TypeScript throughout
- Consistent Response Format: Return
{ content: [{ type: "text", text: string }] }
Environment Variables
- Always validate required environment variables at startup
- Use optional database IDs for features that may not be configured
- Check for empty strings, not just undefined values
Testing
- Use the Postman collection in
postman/collections/for manual testing - Use
npm run inspectto debug tools with the MCP inspector - Test both success and error scenarios
Configuration
Required Environment Variables
NOTION_API_KEY: Your Notion integration API keyTIMESHEETS_DB_ID: ID of your timesheets Notion database
Optional Environment Variables
ACTIVITIES_DB_ID: ID of your activities databaseRESPONSIBILITIES_DB_ID: ID of your responsibilities databaseTOPICS_DB_ID: ID of your topics databaseCOMPETENCIES_DB_ID: ID of your competencies databaseEVIDENCE_DB_ID: ID of your evidence database
MCP Client Integration
Add this server to your MCP client configuration (e.g., Claude Desktop):
{
"mcpServers": {
"timesheets": {
"command": "node",
"args": ["/path/to/timesheets-mcp/build/src/server.js"]
}
}
}
Scripts
npm run build- Compile TypeScript to JavaScriptnpm run start- Run the compiled servernpm run dev- Run in development mode with ts-nodenpm run inspect- Debug with MCP inspectornpm test- Run tests (not yet implemented)
License
MIT - see file for details.