# Directory Structure
```
├── .gitignore
├── dist
│ ├── index.js
│ └── tools
│ ├── ExampleTool.js
│ └── YtDlpTool.js
├── package-lock.json
├── package.json
├── README.md
├── src
│ ├── index.ts
│ └── tools
│ └── YtDlpTool.ts
├── test-ytdlp.ts
├── tsconfig.json
└── yt-dlp.exe
```
# Files
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
```
1 | /logs
2 | /node_modules
3 |
```
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
```markdown
1 | # yt-mcp-server
2 |
3 | A Model Context Protocol (MCP) server built with mcp-framework.
4 |
5 | ## Quick Start
6 |
7 | ```bash
8 | # Install dependencies
9 | npm install
10 |
11 | # Build the project
12 | npm run build
13 |
14 | ```
15 |
16 | ## Project Structure
17 |
18 | ```
19 | yt-mcp-server/
20 | ├── src/
21 | │ ├── tools/ # MCP Tools
22 | │ │ └── ExampleTool.ts
23 | │ └── index.ts # Server entry point
24 | ├── package.json
25 | └── tsconfig.json
26 | ```
27 |
28 | ## Adding Components
29 |
30 | The project comes with an example tool in `src/tools/ExampleTool.ts`. You can add more tools using the CLI:
31 |
32 | ```bash
33 | # Add a new tool
34 | mcp add tool my-tool
35 |
36 | # Example tools you might create:
37 | mcp add tool data-processor
38 | mcp add tool api-client
39 | mcp add tool file-handler
40 | ```
41 |
42 | ## Tool Development
43 |
44 | Example tool structure:
45 |
46 | ```typescript
47 | import { MCPTool } from "mcp-framework";
48 | import { z } from "zod";
49 |
50 | interface MyToolInput {
51 | message: string;
52 | }
53 |
54 | class MyTool extends MCPTool<MyToolInput> {
55 | name = "my_tool";
56 | description = "Describes what your tool does";
57 |
58 | schema = {
59 | message: {
60 | type: z.string(),
61 | description: "Description of this input parameter",
62 | },
63 | };
64 |
65 | async execute(input: MyToolInput) {
66 | // Your tool logic here
67 | return `Processed: ${input.message}`;
68 | }
69 | }
70 |
71 | export default MyTool;
72 | ```
73 |
74 | ## Publishing to npm
75 |
76 | 1. Update your package.json:
77 | - Ensure `name` is unique and follows npm naming conventions
78 | - Set appropriate `version`
79 | - Add `description`, `author`, `license`, etc.
80 | - Check `bin` points to the correct entry file
81 |
82 | 2. Build and test locally:
83 | ```bash
84 | npm run build
85 | npm link
86 | yt-mcp-server # Test your CLI locally
87 | ```
88 |
89 | 3. Login to npm (create account if necessary):
90 | ```bash
91 | npm login
92 | ```
93 |
94 | 4. Publish your package:
95 | ```bash
96 | npm publish
97 | ```
98 |
99 | After publishing, users can add it to their claude desktop client (read below) or run it with npx
100 | ```
101 |
102 | ## Using with Claude Desktop
103 |
104 | ### Local Development
105 |
106 | Add this configuration to your Claude Desktop config file:
107 |
108 | **MacOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
109 | **Windows**: `%APPDATA%/Claude/claude_desktop_config.json`
110 |
111 | ```json
112 | {
113 | "mcpServers": {
114 | "yt-mcp-server": {
115 | "command": "node",
116 | "args":["/absolute/path/to/yt-mcp-server/dist/index.js"]
117 | }
118 | }
119 | }
120 | ```
121 |
122 | ### After Publishing
123 |
124 | Add this configuration to your Claude Desktop config file:
125 |
126 | **MacOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
127 | **Windows**: `%APPDATA%/Claude/claude_desktop_config.json`
128 |
129 | ```json
130 | {
131 | "mcpServers": {
132 | "yt-mcp-server": {
133 | "command": "npx",
134 | "args": ["yt-mcp-server"]
135 | }
136 | }
137 | }
138 | ```
139 |
140 | ## Building and Testing
141 |
142 | 1. Make changes to your tools
143 | 2. Run `npm run build` to compile
144 | 3. The server will automatically load your tools on startup
145 |
146 | ## Learn More
147 |
148 | - [MCP Framework Github](https://github.com/QuantGeekDev/mcp-framework)
149 | - [MCP Framework Docs](https://mcp-framework.com)
150 |
```
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
```json
1 | {
2 | "compilerOptions": {
3 | "target": "ESNext",
4 | "module": "ESNext",
5 | "moduleResolution": "node",
6 | "outDir": "./dist",
7 | "rootDir": "./src",
8 | "strict": true,
9 | "esModuleInterop": true,
10 | "skipLibCheck": true,
11 | "forceConsistentCasingInFileNames": true
12 | },
13 | "include": [
14 | "src/**/*"
15 | ],
16 | "exclude": [
17 | "node_modules"
18 | ]
19 | }
```
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
```json
1 | {
2 | "name": "yt-mcp-server",
3 | "version": "0.0.1",
4 | "description": "yt-mcp-server MCP server",
5 | "type": "module",
6 | "bin": {
7 | "yt-mcp-server": "./dist/index.js"
8 | },
9 | "files": [
10 | "dist"
11 | ],
12 | "scripts": {
13 | "build": "mcp-build",
14 | "prepare": "npm run build",
15 | "watch": "tsc --watch",
16 | "start": "node dist/index.js"
17 | },
18 | "dependencies": {
19 | "mcp-framework": "^0.1.27"
20 | },
21 | "devDependencies": {
22 | "@types/node": "^20.11.24",
23 | "typescript": "^5.3.3"
24 | }
25 | }
```