Add MCP discovery endpoint and document static pages functionality
ci/woodpecker/push/woodpecker Pipeline failed
Details
ci/woodpecker/push/woodpecker Pipeline failed
Details
- Add /.well-known/mcp.json endpoint for MCP protocol discovery - Document static pages functionality in about.md - Document MCP endpoint availability in about.md - MCP endpoint provides API discovery for AI assistants
This commit is contained in:
parent
63de9cfd84
commit
d8e76de175
24
about.md
24
about.md
|
|
@ -12,6 +12,30 @@ It's important to understand that this service is purely plain text-based. Data
|
|||
|
||||
The source code for this Hastebin instance is available at our Git repository: [Nixius/hastebin](https://git.nixc.us/Nixius/hastebin.git). Feel free to explore, contribute, or use it to set up your own instance.
|
||||
|
||||
## Static Pages
|
||||
|
||||
Hastebin supports static documents that are permanently stored and never expire. These documents are loaded at server startup and can be accessed like regular pastes. Currently, the following static documents are available:
|
||||
|
||||
- **About page**: Accessible at `/about` (this page)
|
||||
|
||||
Static documents are configured in the server configuration and are useful for hosting documentation, help pages, or other content that should persist indefinitely. Unlike regular pastes, static documents do not expire and are always available.
|
||||
|
||||
## MCP (Model Context Protocol) Support
|
||||
|
||||
Hastebin provides an MCP discovery endpoint for AI assistants and tools that support the Model Context Protocol. You can discover Hastebin's capabilities by accessing:
|
||||
|
||||
```
|
||||
/.well-known/mcp.json
|
||||
```
|
||||
|
||||
This endpoint returns information about:
|
||||
- Available API endpoints (create, read, read raw)
|
||||
- Service capabilities
|
||||
- Base URL and protocol information
|
||||
- List of static documents
|
||||
|
||||
The MCP endpoint allows AI assistants to automatically discover and interact with Hastebin's paste creation and retrieval functionality.
|
||||
|
||||
## Tools for Uploading
|
||||
|
||||
### haste CLI Tool
|
||||
|
|
|
|||
43
server.js
43
server.js
|
|
@ -150,6 +150,49 @@ if (config.rateLimits) {
|
|||
|
||||
// first look at API calls
|
||||
app.use(route(function(router) {
|
||||
// MCP discovery endpoint
|
||||
router.get('/.well-known/mcp.json', function(request, response) {
|
||||
var protocol = request.headers['x-forwarded-proto'] ||
|
||||
(request.connection.encrypted ? 'https' : 'http');
|
||||
var host = request.headers.host || (config.host + ':' + config.port);
|
||||
var baseUrl = protocol + '://' + host;
|
||||
|
||||
var mcpInfo = {
|
||||
name: 'hastebin',
|
||||
version: '0.2.0',
|
||||
description: 'Hastebin pastebin service - create and retrieve text documents',
|
||||
capabilities: {
|
||||
resources: ['paste'],
|
||||
tools: ['create_paste', 'read_paste', 'read_raw_paste']
|
||||
},
|
||||
endpoints: {
|
||||
create: {
|
||||
method: 'POST',
|
||||
path: '/documents',
|
||||
description: 'Create a new paste',
|
||||
contentType: 'text/plain'
|
||||
},
|
||||
read: {
|
||||
method: 'GET',
|
||||
path: '/documents/:id',
|
||||
description: 'Read a paste as JSON',
|
||||
contentType: 'application/json'
|
||||
},
|
||||
readRaw: {
|
||||
method: 'GET',
|
||||
path: '/raw/:id',
|
||||
description: 'Read a paste as raw text',
|
||||
contentType: 'text/plain'
|
||||
}
|
||||
},
|
||||
baseUrl: baseUrl,
|
||||
staticDocuments: Object.keys(config.documents)
|
||||
};
|
||||
|
||||
response.writeHead(200, { 'content-type': 'application/json' });
|
||||
response.end(JSON.stringify(mcpInfo, null, 2));
|
||||
});
|
||||
|
||||
// get raw documents - support getting with extension
|
||||
router.get('/raw/:id', function(request, response) {
|
||||
var key = request.params.id.split('.')[0];
|
||||
|
|
|
|||
Loading…
Reference in New Issue