Skip to main content
Glama

Tracxn MCP Server

by pHequals7
resources.ts2.17 kB
import { Server } from '@modelcontextprotocol/sdk/server/index.js'; import { Resource, ListResourcesRequestSchema, ReadResourceRequestSchema } from '@modelcontextprotocol/sdk/types.js'; import { z } from 'zod'; import axios from 'axios'; // Create axios instance with base configuration const tracxnClient = axios.create({ baseURL: 'https://platform.tracxn.com/a/api', headers: { 'Authorization': `Bearer ${process.env.TRACXN_API_KEY}`, 'Content-Type': 'application/json', }, }); interface ResourceParams { path: string; params?: Record<string, unknown>; } export async function registerTracxnResources(server: Server) { const tracxnResource: Resource = { name: 'tracxn_raw', uri: 'tracxn://raw', description: 'Access raw JSON data from any Tracxn API endpoint (read-only)', inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'The API endpoint path (e.g., "/companies/123")' }, method: { type: 'string', enum: ['GET'], default: 'GET', description: 'HTTP method (only GET is supported)' }, params: { type: 'object', additionalProperties: true, description: 'Query parameters for the request' } }, required: ['path'] }, outputSchema: { type: 'object', additionalProperties: true, description: 'Raw JSON response from the Tracxn API' } }; // Register the resource with the server server.setRequestHandler(ListResourcesRequestSchema, async (request) => { return { resources: [tracxnResource] }; }); server.setRequestHandler(ReadResourceRequestSchema, async (request) => { const { uri, params } = request.params; if (uri !== 'tracxn://raw') { throw new Error(`Unknown resource: ${uri}`); } const resourceParams = params as ResourceParams; const response = await tracxnClient.get(resourceParams.path, { params: resourceParams.params }); return { content: [{ type: 'text', text: JSON.stringify(response.data) }], isError: false }; }); }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pHequals7/tracxn-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server