devbcn-mcp-server 0.0.0-202507050716
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +37005 -0
- package/package.json +20 -0
- package/src/index.js +107 -0
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "devbcn-mcp-server",
|
|
3
|
+
"version": "0.0.0-202507050716",
|
|
4
|
+
"homepage": "https://github.com/marcnuri-demo/blog-tutorials",
|
|
5
|
+
"licenese": "Apache-2.0",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"devbcn-mcp-server": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "bun build --target=node --outdir=dist src/index.js",
|
|
13
|
+
"inspector": "bun x @modelcontextprotocol/inspector@latest",
|
|
14
|
+
"watch": "bun run --watch src/index.js"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@modelcontextprotocol/sdk": "1.13.3",
|
|
18
|
+
"express": "5.1.0"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import {McpServer} from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
+
import {StdioServerTransport} from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
|
+
import {StreamableHTTPServerTransport} from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
5
|
+
import {z} from 'zod';
|
|
6
|
+
|
|
7
|
+
const SERVER_NAME = 'devbcn-2025-mcp-server';
|
|
8
|
+
const RESOURCE_PREFIX = 'devbcn://2025/';
|
|
9
|
+
const HTTP_PORT = 3000; // Set to 0 to use a random port
|
|
10
|
+
|
|
11
|
+
const SESSIONIZE_ID = 'kdiixcgx';
|
|
12
|
+
|
|
13
|
+
// Create an MCP server
|
|
14
|
+
const server = new McpServer({
|
|
15
|
+
name: SERVER_NAME,
|
|
16
|
+
version: '1.0.0'
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
server.registerResource(
|
|
20
|
+
'devbcn-2025-speakers',
|
|
21
|
+
`${RESOURCE_PREFIX}speakers`,
|
|
22
|
+
{
|
|
23
|
+
title: 'DevBcn 2025 Speakers',
|
|
24
|
+
description: 'List of speakers for DevBcn (Formerly JBCNConf) 2025',
|
|
25
|
+
},
|
|
26
|
+
async (uri) => ({
|
|
27
|
+
contents: [{
|
|
28
|
+
uri: uri.href,
|
|
29
|
+
text: await fetch(`https://sessionize.com/api/v2/${SESSIONIZE_ID}/view/Speakers`).then(res => res.text()),
|
|
30
|
+
}]
|
|
31
|
+
})
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
server.registerPrompt('devbcn-2025-speaker',
|
|
35
|
+
{
|
|
36
|
+
title: 'DevBcn 2025 Speaker',
|
|
37
|
+
description: 'Get information about a specific speaker for DevBcn (Formerly JBCNConf) 2025',
|
|
38
|
+
argsSchema: {name: z.string()}
|
|
39
|
+
},
|
|
40
|
+
({name}) => ({
|
|
41
|
+
messages: [{
|
|
42
|
+
role: 'user',
|
|
43
|
+
content: {
|
|
44
|
+
type: 'text',
|
|
45
|
+
text: `Get me the bio of the DevBcn 2025 speaker named "${name}".`
|
|
46
|
+
}
|
|
47
|
+
}]
|
|
48
|
+
})
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
server.registerResource(
|
|
52
|
+
'devbcn-2025-sessions',
|
|
53
|
+
`${RESOURCE_PREFIX}sessions`,
|
|
54
|
+
{
|
|
55
|
+
title: 'DevBcn 2025 Sessions',
|
|
56
|
+
description: 'List of sessions for DevBcn (Formerly JBCNConf) 2025',
|
|
57
|
+
},
|
|
58
|
+
async (uri) => ({
|
|
59
|
+
contents: [{
|
|
60
|
+
uri: uri.href,
|
|
61
|
+
text: await fetch(`https://sessionize.com/api/v2/${SESSIONIZE_ID}/view/Sessions`).then(res => res.text()),
|
|
62
|
+
}]
|
|
63
|
+
})
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
server.registerResource(
|
|
67
|
+
'devbcn-2025-schedule',
|
|
68
|
+
`${RESOURCE_PREFIX}schedule`,
|
|
69
|
+
{
|
|
70
|
+
title: 'DevBcn 2025 Schedule',
|
|
71
|
+
description: 'Schedule for DevBcn (Formerly JBCNConf) 2025',
|
|
72
|
+
},
|
|
73
|
+
async (uri) => ({
|
|
74
|
+
contents: [{
|
|
75
|
+
uri: uri.href,
|
|
76
|
+
text: await fetch(`https://sessionize.com/api/v2/${SESSIONIZE_ID}/view/GridSmart`).then(res => res.text()),
|
|
77
|
+
}]
|
|
78
|
+
})
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
try {
|
|
82
|
+
// HTTP
|
|
83
|
+
const expressApp = express();
|
|
84
|
+
expressApp.use(express.json());
|
|
85
|
+
expressApp.post('/mcp', async (req, res) => {
|
|
86
|
+
const httpTransport = new StreamableHTTPServerTransport({
|
|
87
|
+
sessionIdGenerator: undefined
|
|
88
|
+
});
|
|
89
|
+
res.on('close', () => {
|
|
90
|
+
httpTransport.close();
|
|
91
|
+
});
|
|
92
|
+
await server.connect(httpTransport);
|
|
93
|
+
await httpTransport.handleRequest(req, res, req.body);
|
|
94
|
+
});
|
|
95
|
+
const expressServer = expressApp.listen(HTTP_PORT, () => {
|
|
96
|
+
const address = expressServer.address();
|
|
97
|
+
console.log(`DevBCN 2025 MCP HTTP Server is listening on http://localhost:${address.port}/mcp`);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// STDIO
|
|
101
|
+
const stdioTransport = new StdioServerTransport();
|
|
102
|
+
await server.connect(stdioTransport);
|
|
103
|
+
console.log('DevBCN 2025 MCP Server is running!');
|
|
104
|
+
} catch (error) {
|
|
105
|
+
console.error('Error starting MCP server:', error);
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|