Merge branch 'main' into patch-1

This commit is contained in:
Mamerto Fabian Jr
2024-12-20 07:05:31 +08:00
committed by GitHub
2 changed files with 37 additions and 0 deletions

View File

@@ -103,6 +103,7 @@ A growing set of community-developed and maintained servers demonstrates various
- **[TMDB](https://github.com/Laksh-star/mcp-server-tmdb)** - This MCP server integrates with The Movie Database (TMDB) API to provide movie information, search capabilities, and recommendations. - **[TMDB](https://github.com/Laksh-star/mcp-server-tmdb)** - This MCP server integrates with The Movie Database (TMDB) API to provide movie information, search capabilities, and recommendations.
- **[MongoDB](https://github.com/kiliczsh/mcp-mongo-server)** - A Model Context Protocol Server for MongoDB. - **[MongoDB](https://github.com/kiliczsh/mcp-mongo-server)** - A Model Context Protocol Server for MongoDB.
- **[Airtable](https://github.com/felores/airtable-mcp)** - Airtable Model Context Protocol Server. - **[Airtable](https://github.com/felores/airtable-mcp)** - Airtable Model Context Protocol Server.
- **[Fetch](https://github.com/zcaceres/fetch-mcp)** - A server that flexibly fetches HTML, JSON, Markdown, or plaintext
- **[Everything Search](https://github.com/mamertofabian/mcp-everything-search)** - Fast file searching capabilities across Windows (using [Everything SDK](https://www.voidtools.com/support/everything/sdk/)), macOS (using mdfind command), and Linux (using locate/plocate command). - **[Everything Search](https://github.com/mamertofabian/mcp-everything-search)** - Fast file searching capabilities across Windows (using [Everything SDK](https://www.voidtools.com/support/everything/sdk/)), macOS (using mdfind command), and Linux (using locate/plocate command).
## 📚 Resources ## 📚 Resources

View File

@@ -1,6 +1,7 @@
import { Server } from "@modelcontextprotocol/sdk/server/index.js"; import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { import {
CallToolRequestSchema, CallToolRequestSchema,
CompleteRequestSchema,
CreateMessageRequest, CreateMessageRequest,
CreateMessageResultSchema, CreateMessageResultSchema,
GetPromptRequestSchema, GetPromptRequestSchema,
@@ -50,6 +51,13 @@ const SampleLLMSchema = z.object({
.describe("Maximum number of tokens to generate"), .describe("Maximum number of tokens to generate"),
}); });
// Example completion values
const EXAMPLE_COMPLETIONS = {
style: ["casual", "formal", "technical", "friendly"],
temperature: ["0", "0.5", "0.7", "1.0"],
resourceId: ["1", "2", "3", "4", "5"],
};
const GetTinyImageSchema = z.object({}); const GetTinyImageSchema = z.object({});
enum ToolName { enum ToolName {
@@ -431,6 +439,34 @@ export const createServer = () => {
throw new Error(`Unknown tool: ${name}`); throw new Error(`Unknown tool: ${name}`);
}); });
server.setRequestHandler(CompleteRequestSchema, async (request) => {
const { ref, argument } = request.params;
if (ref.type === "ref/resource") {
const resourceId = ref.uri.split("/").pop();
if (!resourceId) return { completion: { values: [] } };
// Filter resource IDs that start with the input value
const values = EXAMPLE_COMPLETIONS.resourceId.filter(id =>
id.startsWith(argument.value)
);
return { completion: { values, hasMore: false, total: values.length } };
}
if (ref.type === "ref/prompt") {
// Handle completion for prompt arguments
const completions = EXAMPLE_COMPLETIONS[argument.name as keyof typeof EXAMPLE_COMPLETIONS];
if (!completions) return { completion: { values: [] } };
const values = completions.filter(value =>
value.startsWith(argument.value)
);
return { completion: { values, hasMore: false, total: values.length } };
}
throw new Error(`Unknown reference type`);
});
server.setRequestHandler(SetLevelRequestSchema, async (request) => { server.setRequestHandler(SetLevelRequestSchema, async (request) => {
const { level } = request.params; const { level } = request.params;